:root {
  --bg: #f7f9fb;
  --surface: #ffffff;
  --surface-soft: #f2f4f6;
  --surface-strong: #eceef0;
  --text: #191c1e;
  --muted: #464555;
  --line: #c7c4d8;
  --primary: #3525cd;
  --primary-soft: #4f46e5;
  --success: #15803d;
  --success-soft: #dcfce7;
  --danger: #ba1a1a;
  --danger-soft: #ffdad6;
  --warning: #a44100;
  --shadow: 0px 10px 30px rgba(25, 28, 30, 0.04);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(79, 70, 229, 0.07), transparent 22rem),
    linear-gradient(180deg, #fafbff 0%, var(--bg) 100%);
  color: var(--text);
}

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

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 18px;
  vertical-align: middle;
  line-height: 1;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

body.auth-locked .app-shell,
body.auth-locked .site-footer {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: 260px;
  padding: 20px 14px;
  background: rgba(242, 244, 246, 0.95);
  border-right: 1px solid rgba(199, 196, 216, 0.15);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-soft));
  color: white;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-mark .material-symbols-outlined {
  font-size: 20px;
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.brand-kicker,
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
  font-weight: 800;
  color: var(--primary);
}

.brand h1,
.page-heading h2,
.panel-head h3,
.stat-card strong,
.topbar-title {
  font-family: "Manrope", sans-serif;
}

.brand h1 {
  margin: 2px 0 0;
  font-size: 16px;
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  color: var(--text);
}

.brand-sub {
  margin: 0;
  font-size: 10px;
  color: var(--muted);
  opacity: 0.7;
}

/* ── Navigation ────────────────────────────────────────── */
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  border-right: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--primary);
}

.nav-item.is-active {
  background: rgba(255, 255, 255, 0.6);
  color: var(--primary);
  border-right: 3px solid var(--primary);
  border-radius: 10px 0 0 10px;
  font-weight: 700;
}

.nav-item .material-symbols-outlined {
  font-size: 20px;
  opacity: 0.8;
}

.nav-item.is-active .material-symbols-outlined {
  opacity: 1;
  font-variation-settings: 'FILL' 0, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 6px;
}

/* ── Main Area ─────────────────────────────────────────── */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: rgba(247, 249, 251, 0.82);
  border-bottom: 1px solid rgba(199, 196, 216, 0.15);
  padding: 0 28px;
  height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-title {
  display: block;
  font-size: 17px;
  font-weight: 800;
  font-family: "Manrope", sans-serif;
  color: var(--primary);
}

.topbar-context {
  color: var(--muted);
  font-size: 13px;
  margin-top: 1px;
  display: block;
}

.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topbar-company-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.topbar-company-summary {
  font-size: 13px;
  font-weight: 600;
}

.topbar-company-switcher .material-symbols-outlined {
  font-size: 16px;
  opacity: 0.7;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-icon-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: grid;
  place-items: center;
}

.topbar-icon-btn:hover {
  background: var(--surface-soft);
  color: var(--primary);
}

.topbar-icon-btn .material-symbols-outlined {
  font-size: 22px;
}

.topbar-alert-btn {
  position: relative;
  background: rgba(213, 224, 248, 0.34);
  color: #586377;
}

.topbar-alert-btn:hover {
  background: rgba(213, 224, 248, 0.62);
}

.topbar-alert-btn.has-alerts {
  color: var(--primary);
  background: rgba(213, 224, 248, 0.72);
}

.topbar-alert-count {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(186, 26, 26, 0.24);
}

.topbar-divider {
  width: 1px;
  height: 24px;
  background: rgba(199, 196, 216, 0.3);
  margin: 0 4px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #dad7ff, #d5e0f8);
  color: var(--primary);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(25, 28, 30, 0.28);
  backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1001;
}

.auth-overlay.is-visible {
  display: flex;
}

.auth-card {
  width: min(100%, 420px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(199, 196, 216, 0.18);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(25, 28, 30, 0.16);
  padding: 24px;
  display: grid;
  gap: 18px;
}

/* ── Pages ─────────────────────────────────────────────── */
.page {
  display: none;
  padding: 32px 28px 80px;
  flex: 1;
}

.page.is-visible {
  display: block;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 28px;
}

.page-heading h2 {
  margin: 8px 0 4px;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1;
}

.subtle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.subtle.warning-text {
  color: var(--warning);
  font-weight: 600;
}

/* ── Buttons ────────────────────────────────────────────── */
.primary-button,
.secondary-button,
.ghost-button,
.toggle {
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.primary-button {
  padding: 11px 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-soft));
  color: white;
  box-shadow: 0px 4px 16px rgba(53, 37, 205, 0.2);
  font-size: 14px;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0px 6px 20px rgba(53, 37, 205, 0.15);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.toggle:disabled,
.action-button:disabled,
.topbar-icon-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.primary-button.wide {
  width: 100%;
  justify-content: center;
}

.secondary-button {
  padding: 11px 18px;
  background: var(--surface);
  color: var(--primary);
  border: 1px solid rgba(199, 196, 216, 0.4);
  font-size: 14px;
}

.ghost-button {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  border: 1px solid rgba(199, 196, 216, 0.35);
  font-size: 13px;
  box-shadow: none;
}

.ghost-button:hover {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.96);
}

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

/* ── Grid Layouts ───────────────────────────────────────── */
.stats-grid,
.content-grid,
.form-grid,
.payload-layout {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.content-grid {
  grid-template-columns: 1.6fr 1fr;
}

.form-grid,
.payload-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ── Cards & Panels ─────────────────────────────────────── */
.stat-card,
.panel {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(199, 196, 216, 0.15);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0px 16px 40px rgba(25, 28, 30, 0.07);
}

.stat-card-accent {
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: rgba(199, 196, 216, 0.4);
  border-radius: 0 0 var(--radius) var(--radius);
}

.stat-card.success .stat-card-accent { background: var(--success); }
.stat-card.warning .stat-card-accent { background: var(--warning); }
.stat-card.danger .stat-card-accent { background: var(--danger); }
.stat-card.muted .stat-card-accent { background: #545f73; }

.stat-progress-track {
  margin-top: 14px;
  height: 3px;
  width: 100%;
  background: var(--surface-strong);
  border-radius: 999px;
  overflow: hidden;
}

.stat-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: rgba(199, 196, 216, 0.6);
  transition: width 0.6s ease;
}

.stat-card.success .stat-progress-fill { background: var(--success); }
.stat-card.warning .stat-progress-fill { background: var(--warning); }
.stat-card.danger .stat-progress-fill { background: var(--danger); }
.stat-card.muted .stat-progress-fill { background: #545f73; }

.stat-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-soft);
  color: var(--muted);
}

.stat-card.success .stat-card-badge {
  background: var(--success-soft);
  color: var(--success);
}

.stat-card.warning .stat-card-badge {
  background: #fff0d5;
  color: var(--warning);
}

.stat-card.danger .stat-card-badge {
  background: var(--danger-soft);
  color: var(--danger);
}

.stat-card-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.stat-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 800;
}

.stat-card strong {
  font-size: 36px;
  display: block;
  line-height: 1.1;
}

.stat-card small {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}

/* ── Panel ──────────────────────────────────────────────── */
.panel {
  padding: 20px;
}

.panel-large {
  min-height: 360px;
}

.panel-head,
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-head h3 {
  margin: 0;
  font-size: 18px;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
}

#company-form-pill {
  background: rgba(213, 224, 248, 0.6);
  color: #31405e;
}

/* ── System Health Dark Panel ───────────────────────────── */
.panel-dark {
  background: #2d3133;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
}

.panel-dark .panel-head h3 {
  color: rgba(255, 255, 255, 0.9);
}

.health-list.dark li {
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.health-list.dark li:last-child {
  border-bottom: none;
}

.health-list.dark span {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

.health-list.dark strong {
  font-size: 12px;
}

.health-dot {
  display: inline-flex;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

/* ── Pills ──────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pill.ok {
  background: var(--success-soft);
  color: var(--success);
}

/* ── Lists ──────────────────────────────────────────────── */
.health-list,
.notes,
.timeline,
.candidate-list {
  display: grid;
  gap: 10px;
}

.health-list {
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 4px;
}

.health-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-soft);
}

.health-list li span {
  color: var(--muted);
  font-size: 13px;
}

.timeline-item,
.candidate-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--surface-soft);
}

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

.timeline-body {
  width: 100%;
  display: grid;
  gap: 10px;
}

.timeline-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.timeline-topline-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.timeline-meta,
.candidate-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.timeline-fields {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.timeline-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.timeline-field-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.timeline-field-value {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-summary {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.timeline-progress {
  display: grid;
  gap: 8px;
}

.timeline-progress-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.timeline-progress-topline strong {
  color: var(--text);
  font-size: 12px;
}

.timeline-progress-track {
  height: 6px;
  width: 100%;
  border-radius: 999px;
  background: rgba(199, 196, 216, 0.45);
  overflow: hidden;
}

.timeline-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-soft));
  transition: width 0.35s ease;
}

.ok-text {
  color: var(--success);
}

.toolbar {
  flex-wrap: wrap;
}

/* ── Form Inputs ────────────────────────────────────────── */
.ghost-input,
.ghost-select,
.run-form input,
.run-form select,
.run-form textarea {
  width: 100%;
  border: 1px solid rgba(199, 196, 216, 0.4);
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-size: 14px;
}

.chips-input {
  width: 100%;
  border: 1px solid rgba(199, 196, 216, 0.4);
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 48px;
}

.chips-input:focus-within {
  outline: none;
  border-color: rgba(53, 37, 205, 0.35);
  box-shadow: 0 0 0 3px rgba(53, 37, 205, 0.06);
}

.chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.input-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(53, 37, 205, 0.1);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.input-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

.chips-input input {
  border: 0;
  background: transparent;
  padding: 4px 2px;
  min-width: 220px;
  flex: 1 1 220px;
  box-shadow: none;
}

.chips-input input:focus {
  outline: none;
  box-shadow: none;
}

.ghost-input:focus,
.run-form input:focus,
.run-form select:focus,
.run-form textarea:focus {
  outline: none;
  border-color: rgba(53, 37, 205, 0.35);
  box-shadow: 0 0 0 3px rgba(53, 37, 205, 0.06);
}

.run-form textarea {
  resize: vertical;
  min-height: 100px;
}

.run-form {
  display: grid;
  gap: 14px;
}

.run-form label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.inline-toggles {
  display: flex;
  gap: 8px;
}

.toggle {
  padding: 10px 16px;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  border-radius: 10px;
}

.toggle.is-on {
  background: var(--primary);
  color: white;
  box-shadow: 0px 4px 12px rgba(53, 37, 205, 0.2);
}

/* ── Tables ─────────────────────────────────────────────── */
.automation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 198px;
  align-items: center;
}

.action-button {
  border: 1px solid rgba(199, 196, 216, 0.34);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  box-shadow: none;
  backdrop-filter: blur(10px);
}

.action-button-icon-only {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 10px;
}

.action-button .material-symbols-outlined {
  font-size: 16px;
  opacity: 0.82;
}

.action-button:hover {
  transform: translateY(-1px);
  color: var(--primary);
  border-color: rgba(53, 37, 205, 0.2);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0px 10px 22px rgba(25, 28, 30, 0.06);
}

.action-button-emphasis {
  background: rgba(213, 224, 248, 0.56);
  color: #31405e;
  border-color: rgba(84, 95, 115, 0.18);
}

.action-button-emphasis:hover {
  color: var(--primary);
  border-color: rgba(53, 37, 205, 0.18);
  background: rgba(213, 224, 248, 0.8);
}

.action-button-warning {
  color: #8b5a17;
  background: rgba(255, 244, 223, 0.92);
  border-color: rgba(245, 158, 11, 0.2);
}

.action-button-warning:hover {
  color: #a16207;
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(255, 237, 194, 0.98);
}

.action-button-danger {
  color: #7f3d3d;
  background: rgba(255, 255, 255, 0.72);
}

.action-button-danger:hover {
  color: var(--danger);
  border-color: rgba(186, 26, 26, 0.18);
  background: rgba(255, 218, 214, 0.55);
}

.table-wrap {
  overflow: auto;
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--surface-soft);
}

th {
  padding: 12px 14px;
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 700;
}

td {
  padding: 13px 14px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid rgba(199, 196, 216, 0.08);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: rgba(242, 244, 246, 0.6);
}

/* ── Status Chips ───────────────────────────────────────── */
.status-chip {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-chip.success {
  background: var(--success-soft);
  color: var(--success);
}

.status-chip.warning {
  background: #fff0d5;
  color: var(--warning);
}

.status-chip.interrupted {
  background: rgba(213, 224, 248, 0.72);
  color: #40506c;
}

.status-chip.error {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ── JSON View ──────────────────────────────────────────── */
.json-view {
  margin: 0;
  padding: 18px;
  border-radius: 12px;
  background: #2d3133;
  color: #d4dcff;
  overflow: auto;
  min-height: 340px;
  font-size: 12px;
  line-height: 1.6;
}

/* ── Notes ──────────────────────────────────────────────── */
.notes {
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
}

.notes li {
  padding: 4px 0;
}

/* ── Toasts ─────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 52px;
  right: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  max-width: 360px;
  box-shadow: 0 8px 24px rgba(25, 28, 30, 0.12);
  animation: toast-in 0.2s ease;
  cursor: pointer;
  line-height: 1.4;
}

.toast.toast-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(186, 26, 26, 0.15);
}

.toast.toast-warning {
  background: #fff0d5;
  color: var(--warning);
  border: 1px solid rgba(164, 65, 0, 0.15);
}

.toast.toast-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(21, 128, 61, 0.15);
}

.toast.toast-info {
  background: #efefff;
  color: var(--primary);
  border: 1px solid rgba(53, 37, 205, 0.15);
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
}

.toast-dismiss {
  font-size: 16px;
  opacity: 0.5;
  flex-shrink: 0;
  margin-top: 1px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Footer ─────────────────────────────────────────────── */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 260px;
  right: 0;
  height: 36px;
  background: rgba(247, 249, 251, 0.95);
  border-top: 1px solid rgba(199, 196, 216, 0.15);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  z-index: 9;
}

.footer-status {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-status-ok {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--success);
  font-weight: 700;
}

.footer-status-ok::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats-grid,
  .content-grid,
  .form-grid,
  .payload-layout {
    grid-template-columns: 1fr;
  }

  .timeline-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .sidebar {
    display: none;
  }

  .topbar {
    padding: 0 18px;
  }

  .page {
    padding: 24px 18px 60px;
  }

  .site-footer {
    left: 0;
  }

  .automation-actions {
    min-width: 0;
  }

  .timeline-fields {
    grid-template-columns: 1fr;
  }
}

.log-view {
  margin: 0;
  padding: 18px;
  border-radius: 12px;
  background: #2d3133;
  color: #d4dcff;
  overflow: auto;
  min-height: 220px;
  max-height: 420px;
  font-size: 12px;
  display: grid;
  gap: 10px;
}

.log-line {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  align-items: start;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-family: monospace;
}

.log-line:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.log-time {
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}

.log-message {
  color: #d4dcff;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.log-level-info {
  background: rgba(59, 130, 246, 0.16);
  color: #93c5fd;
}

.log-level-debug {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
}

.log-level-error {
  background: rgba(239, 68, 68, 0.16);
  color: #fda4af;
}
