/* ================================================================
   NowOnline Control Tower — V2 Design System
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Brand */
  --blue:        #2563EB;
  --blue-mid:    #3B82F6;
  --blue-light:  #EFF6FF;
  --indigo:      #6366F1;
  --violet:      #7C3AED;
  --grad-cta:    linear-gradient(135deg, #2563EB 0%, #6366F1 100%);
  --grad-dark:   linear-gradient(160deg, #0F172A 0%, #1E293B 100%);
  --grad-glow:   linear-gradient(135deg, rgba(37,99,235,0.18) 0%, rgba(99,102,241,0.10) 100%);

  /* Ink */
  --ink:         #0F172A;
  --ink-2:       #1E293B;
  --slate:       #475569;
  --mute:        #94A3B8;
  --subtle:      #CBD5E1;

  /* Surfaces */
  --bg:          #F1F5F9;
  --surface:     #FFFFFF;
  --surface-2:   #F8FAFC;
  --border:      rgba(15,23,42,0.08);
  --border-md:   rgba(15,23,42,0.12);

  /* Semantic */
  --green:       #059669;
  --green-dot:   #10B981;
  --green-bg:    rgba(16,185,129,0.10);
  --amber:       #D97706;
  --amber-bg:    rgba(217,119,6,0.10);
  --red:         #DC2626;
  --red-bg:      rgba(220,38,38,0.10);
  --purple:      #7C3AED;
  --purple-bg:   rgba(124,58,237,0.10);

  /* Tones (connector cards) */
  --tone-blue-bg:   #EFF6FF; --tone-blue-fg:   #1D4ED8;
  --tone-red-bg:    #FEF2F2; --tone-red-fg:    #B91C1C;
  --tone-green-bg:  #ECFDF5; --tone-green-fg:  #065F46;
  --tone-amber-bg:  #FFFBEB; --tone-amber-fg:  #92400E;
  --tone-purple-bg: #F5F3FF; --tone-purple-fg: #5B21B6;
  --tone-slate-bg:  #F1F5F9; --tone-slate-fg:  #334155;

  /* Radius */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-pill:999px;

  /* Shadow */
  --shadow-xs:  0 1px 2px rgba(15,23,42,0.04);
  --shadow-sm:  0 2px 8px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md:  0 4px 16px rgba(15,23,42,0.08), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-lg:  0 8px 32px rgba(15,23,42,0.10), 0 4px 8px rgba(15,23,42,0.06);
  --shadow-xl:  0 20px 48px rgba(15,23,42,0.12), 0 8px 16px rgba(15,23,42,0.06);
  --shadow-glow:0 0 0 3px rgba(37,99,235,0.18);
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body, #root {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
input, button, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Layout skeleton ────────────────────────────────────────────── */
.viewport { position: fixed; inset: 0; overflow: hidden; }
.stage {
  width: 100%; height: 100%;
  display: flex;
  background: var(--bg);
}
/* main fills remaining space after sidebar + right rail */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ================================================================
   COMBINED SIDEBAR (V2)
   ================================================================ */
.sb {
  width: 72px;
  min-width: 72px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: visible;
  transition: width 220ms cubic-bezier(0.4, 0, 0.2, 1),
              min-width 220ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 20;
  flex-shrink: 0;
  position: relative;
}
.sb.sb-open {
  width: 256px;
  min-width: 256px;
}

/* Top — logo + brand + toggle */
.sb-top {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.sb-logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--grad-cta);
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(37,99,235,0.40), inset 0 1px 0 rgba(255,255,255,0.15);
}
.sb-logo svg { width: 22px; height: 22px; color: #fff; }

.sb-brand {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700; font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  flex: 1;
  overflow: hidden;
  opacity: 0;
  transition: opacity 150ms ease 60ms;
}
.sb-open .sb-brand { opacity: 1; }

/* Floating toggle — centered on the right edge of the sidebar, always visible */
.sb-float-toggle {
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-md);
  box-shadow: var(--shadow-md);
  color: var(--slate);
  display: grid; place-items: center;
  cursor: pointer;
  z-index: 30;
  transition: background 150ms, color 150ms, box-shadow 150ms;
}
.sb-float-toggle:hover {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.sb-float-toggle svg { width: 12px; height: 12px; stroke-width: 2.5; }

/* Workspace row — always rendered, slides open with sidebar */
.sb-workspace {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 220ms cubic-bezier(0.4,0,0.2,1),
              opacity 180ms ease 30ms;
}
.sb-open .sb-workspace {
  max-height: 52px;
  opacity: 1;
}
.sb-ws-name {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 600; font-size: 13px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-workspace svg { width: 14px; height: 14px; color: var(--mute); flex-shrink: 0; }

/* Body — scrollable nav area */
.sb-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
}
.sb-body::-webkit-scrollbar { width: 4px; }
.sb-body::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 99px; }

/* Group label — fades + expands when sidebar opens */
.sb-group-label {
  font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--mute); font-weight: 600;
  white-space: nowrap; overflow: hidden;
  padding: 0 10px;
  max-height: 0;
  opacity: 0;
  margin: 0;
  transition: max-height 200ms cubic-bezier(0.4,0,0.2,1),
              opacity 180ms ease,
              margin 200ms ease;
}
.sb-open .sb-group-label {
  max-height: 28px;
  opacity: 1;
  margin: 12px 0 2px;
}

/* Universal nav item — icon always visible, text fades in */
.sb-nav-item {
  width: 100%; height: 42px;
  display: flex; align-items: center;
  padding: 0 7px;
  gap: 0;
  border-radius: 10px;
  color: var(--slate);
  cursor: pointer; border: 0; background: transparent;
  transition: background 130ms, color 130ms;
  position: relative;
  overflow: hidden;
}
.sb-nav-item:hover { background: var(--bg); color: var(--ink); }
.sb-nav-item.active {
  background: var(--blue-light);
  color: var(--blue);
}

.sb-nav-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  flex-shrink: 0;
  border-radius: 8px;
  transition: background 130ms;
}
.sb-nav-icon svg { width: 19px; height: 19px; stroke-width: 1.75; }

.sb-nav-text {
  font-size: 13.5px; font-weight: 500;
  white-space: nowrap;
  flex: 1; text-align: left;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: opacity 170ms ease 50ms, max-width 220ms cubic-bezier(0.4,0,0.2,1);
}
.sb-open .sb-nav-text {
  opacity: 1;
  max-width: 160px;
}

/* Count badge */
.sb-count {
  font-size: 11px; font-weight: 600;
  color: var(--mute);
  background: var(--bg);
  border-radius: 99px; padding: 1px 7px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 150ms ease 60ms;
}
.sb-open .sb-count { opacity: 1; }
.sb-nav-item.active .sb-count {
  background: var(--blue);
  color: #fff;
}

/* Divider between nav groups */
.sb-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
  flex-shrink: 0;
}

/* Footer */
.sb-foot {
  height: 60px;
  display: flex; align-items: center;
  padding: 0 10px; gap: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  justify-content: center;
  transition: justify-content 0ms;
}
.sb-open .sb-foot { justify-content: flex-start; padding: 0 12px; }

/* Bell button in footer */
.sb-foot-bell {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--slate);
  cursor: pointer; border: 0; background: transparent;
  flex-shrink: 0;
  position: relative;
  transition: background 130ms, color 130ms;
}
.sb-foot-bell:hover { background: var(--bg); color: var(--ink); }
.sb-foot-bell svg { width: 18px; height: 18px; stroke-width: 1.75; }

.sb-bell-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green-dot);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px rgba(16,185,129,0.25);
}

/* Footer label — slides in when open */
.sb-foot-label {
  font-size: 13px; color: var(--slate);
  white-space: nowrap; overflow: hidden;
  flex: 1;
  opacity: 0;
  max-width: 0;
  transition: opacity 160ms ease 60ms, max-width 220ms cubic-bezier(0.4,0,0.2,1);
}
.sb-open .sb-foot-label { opacity: 1; max-width: 120px; }

.sb-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--grad-cta);
  display: grid; place-items: center;
  font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700;
  color: #fff; font-size: 11px;
  border: 1.5px solid var(--border);
  flex-shrink: 0; cursor: pointer;
}

/* Hide the old primary/secondary rail styles that no longer apply in v2 */
.nav-primary { display: none; }
.nav-secondary { display: none; }

/* ================================================================
   PRIMARY RAIL
   ================================================================ */
.nav-primary {
  background: var(--grad-dark);
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: 12px;
  z-index: 10;
}

.nav-logo {
  width: 72px; height: 72px;
  display: grid; place-items: center;
  position: relative;
}
.nav-logo::after {
  content: "";
  position: absolute; inset: 14px;
  border-radius: 14px;
  background: var(--grad-cta);
  box-shadow: 0 4px 16px rgba(37,99,235,0.40), inset 0 1px 0 rgba(255,255,255,0.15);
}
.nav-logo svg { width: 36px; height: 36px; position: relative; z-index: 1; color: #fff; }

.nav-primary .icon-btn {
  width: 72px; height: 56px;
  display: grid; place-items: center;
  color: rgba(148,163,184,0.7);
  cursor: pointer; border: 0; background: transparent;
  position: relative;
  transition: color 150ms ease;
}
.nav-primary .icon-btn:hover { color: #fff; }
.nav-primary .icon-btn.active { color: #fff; }
.nav-primary .icon-btn.active::before {
  content: "";
  position: absolute;
  left: 12px; top: 8px;
  width: 48px; height: 40px;
  border-radius: 12px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.08);
}
.nav-primary .icon-btn svg { width: 20px; height: 20px; stroke-width: 1.75; position: relative; z-index: 1; }
.nav-primary .spacer { flex: 1; }

.nav-primary .bell { position: relative; }
.nav-primary .bell .dot {
  position: absolute; top: 12px; right: 16px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green-dot);
  border: 2px solid #1E293B;
  box-shadow: 0 0 0 2px rgba(16,185,129,0.3);
}

.nav-primary .avatar {
  width: 72px; height: 56px;
  display: grid; place-items: center;
}
.nav-primary .avatar > div {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad-cta);
  border: 2px solid rgba(255,255,255,0.15);
  font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700;
  color: #fff; display: grid; place-items: center; font-size: 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ================================================================
   SECONDARY NAV
   ================================================================ */
.nav-secondary {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
  z-index: 9;
}

.workspace {
  height: 72px; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.workspace .name {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700; font-size: 15px; color: var(--ink);
}
.workspace svg { width: 16px; height: 16px; color: var(--mute); }

.nav-section-label {
  padding: 20px 16px 6px;
  font-size: 10.5px; letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--mute); font-weight: 600;
}

.nav-items { padding: 2px 10px; display: flex; flex-direction: column; gap: 1px; }

.nav-item {
  height: 40px; padding: 0 12px;
  border-radius: var(--r-md);
  display: flex; align-items: center; gap: 10px;
  font-weight: 400; font-size: 14px; color: var(--slate);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.active {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 600;
}
.nav-item svg { width: 17px; height: 17px; color: inherit; stroke-width: 1.75; flex-shrink: 0; }
.nav-count {
  margin-left: auto;
  font-size: 11px; font-weight: 600; color: var(--mute);
  background: var(--bg); border-radius: var(--r-pill);
  padding: 2px 7px;
}
.nav-item.active .nav-count { background: rgba(37,99,235,0.12); color: var(--blue); }

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.main { background: var(--bg); }

/* Page header */
.page-header {
  height: 80px; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.page-header .left { display: flex; align-items: center; gap: 14px; }

.badge-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--blue-light);
  display: grid; place-items: center;
}
.badge-icon svg { width: 20px; height: 20px; color: var(--blue); stroke-width: 1.75; }
.badge-icon.btn { cursor: pointer; transition: background 120ms ease; background: var(--bg); }
.badge-icon.btn:hover { background: var(--border-md); }
.badge-icon.btn svg { color: var(--slate); }

.page-title-block { display: flex; flex-direction: column; gap: 1px; }
.page-eyebrow { font-weight: 400; font-size: 12px; color: var(--mute); letter-spacing: 0.02em; }

.breadcrumb {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--mute); font-weight: 400; flex-wrap: wrap;
}
.breadcrumb-link {
  background: transparent; border: 0; padding: 2px 4px; margin: 0 -4px;
  border-radius: 4px; color: var(--mute); font: inherit; cursor: pointer;
  transition: color 120ms ease, background 120ms ease;
}
.breadcrumb-link:hover { color: var(--blue); background: var(--blue-light); }
.breadcrumb-current { color: var(--slate); font-weight: 500; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumb-sep { color: var(--subtle); font-size: 14px; line-height: 1; }

.page-title {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700; font-size: 22px; color: var(--ink);
  line-height: 1.2; margin: 0;
}

.page-header .right { display: flex; align-items: center; gap: 12px; }
.count-pill { font-size: 13px; color: var(--mute); font-weight: 400; }

.search {
  width: 280px; height: 44px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border-md);
  display: flex; align-items: center; padding: 0 18px; gap: 10px;
  transition: border-color 150ms, box-shadow 150ms;
}
.search:focus-within {
  border-color: var(--blue-mid);
  box-shadow: var(--shadow-glow);
  background: #fff;
}
.search input { flex: 1; border: 0; outline: 0; background: transparent; font-weight: 400; font-size: 14px; color: var(--ink); }
.search input::placeholder { color: var(--mute); }
.search svg { width: 16px; height: 16px; color: var(--mute); stroke-width: 1.75; }
.search .filter { color: var(--slate); }

.add-btn {
  height: 44px; border-radius: var(--r-pill);
  background: var(--grad-cta);
  border: 0; cursor: pointer; display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(37,99,235,0.35);
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.add-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,99,235,0.45); }
.add-btn svg { width: 18px; height: 18px; }

/* Page body */
.page-body {
  flex: 1; padding: 24px 32px 32px;
  overflow-y: auto; overflow-x: hidden;
}
.page-body::-webkit-scrollbar { width: 6px; }
.page-body::-webkit-scrollbar-track { background: transparent; }
.page-body::-webkit-scrollbar-thumb { background: var(--subtle); border-radius: 99px; }

/* ================================================================
   TOOLBAR
   ================================================================ */
.toolbar {
  height: 48px; display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 20px;
}
.tabs {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface); padding: 4px;
  border-radius: var(--r-lg); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.tabs .tab {
  height: 34px; padding: 0 16px; border-radius: var(--r-md);
  display: flex; align-items: center; gap: 8px;
  font-weight: 500; font-size: 13px; color: var(--slate);
  cursor: pointer; border: 0; background: transparent;
  transition: background 120ms, color 120ms;
}
.tabs .tab:hover { color: var(--ink); }
.tabs .tab.active {
  background: var(--blue-light);
  color: var(--blue); font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.tabs .tab .count {
  font-size: 11px; font-weight: 600; padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--bg); color: var(--slate);
}
.tabs .tab.active .count { background: rgba(37,99,235,0.15); color: var(--blue); }

.toolbar-right { display: flex; align-items: center; gap: 8px; }

.ghost-btn {
  height: 36px; padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--border-md); background: var(--surface);
  display: flex; align-items: center; gap: 6px;
  font-weight: 500; font-size: 13px; color: var(--slate);
  cursor: pointer; transition: background 120ms, border-color 120ms, color 120ms;
}
.ghost-btn:hover { background: var(--bg); color: var(--ink); border-color: var(--border-md); }
.ghost-btn svg { width: 14px; height: 14px; }

/* View toggle */
.view-toggle {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface); border: 1px solid var(--border-md);
  border-radius: var(--r-md); box-shadow: var(--shadow-xs);
}
.view-toggle .view-btn {
  all: unset; cursor: pointer; width: 30px; height: 28px;
  display: grid; place-items: center;
  color: var(--mute); border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.view-toggle .view-btn svg { width: 15px; height: 15px; }
.view-toggle .view-btn:hover { color: var(--ink); }
.view-toggle .view-btn.active { background: var(--bg); color: var(--ink); box-shadow: var(--shadow-xs); }

/* ================================================================
   TABLE
   ================================================================ */
.table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.row {
  display: grid; align-items: center;
  padding: 0 20px; column-gap: 24px; height: 60px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  transition: background 100ms ease;
}
.row.head {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-md);
  height: 48px;
}
.row:last-child { border-bottom: 0; }
.row:not(.head):hover { background: var(--blue-light); cursor: pointer; }

.col-head {
  display: flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: 12px; color: var(--mute);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.col-head .sort { width: 14px; height: 14px; display: grid; place-items: center; color: var(--blue); }
.col-head .sort svg { width: 12px; height: 10px; }

.cell-name { font-weight: 500; font-size: 14px; color: var(--ink); display: flex; align-items: center; gap: 12px; }
.cell-name .meta-stack { display: flex; flex-direction: column; min-width: 0; }
.cell-name .meta-stack .nm { font-weight: 600; font-size: 14px; color: var(--ink); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-name .meta-stack .em { font-size: 12px; color: var(--mute); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.cell { font-weight: 400; font-size: 13.5px; color: var(--slate); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cb {
  width: 18px; height: 18px; border: 1.5px solid var(--subtle);
  border-radius: 5px; background: #fff; display: grid; place-items: center;
  cursor: pointer; transition: background 100ms, border-color 100ms;
}
.cb:hover { border-color: var(--blue); }
.cb.checked { background: var(--blue); border-color: var(--blue); }
.cb.checked::after { content: ""; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px,-1px); }
.cb.indet { background: var(--blue); border-color: var(--blue); }
.cb.indet::after { content: ""; width: 8px; height: 2px; background: #fff; border-radius: 1px; }

.radio { width: 18px; height: 18px; border: 1.5px solid var(--subtle); border-radius: 50%; background: #fff; display: grid; place-items: center; cursor: pointer; transition: border-color 120ms, background 120ms; }
.radio.checked { border-color: var(--blue); }
.radio.checked::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); }

/* Swatch */
.swatch {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--blue-light); color: var(--blue);
  display: grid; place-items: center;
  font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.endpoint { display: inline-flex; align-items: center; gap: 8px; }
.endpoint .glyph {
  width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid var(--border); display: grid; place-items: center;
  color: var(--slate); background: var(--surface-2); flex-shrink: 0;
}
.endpoint .glyph svg { width: 12px; height: 12px; }

/* Table empty / skeleton */
.table-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 64px 24px; text-align: center; gap: 4px;
}
.table-empty-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--bg); color: var(--mute);
  display: grid; place-items: center; margin-bottom: 12px;
}
.table-empty-icon svg { width: 22px; height: 22px; }
.table-empty-icon.error { background: var(--red-bg); color: var(--red); }
.table-empty-title { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 17px; color: var(--ink); letter-spacing: -0.005em; }
.table-empty-body { color: var(--mute); font-size: 13px; max-width: 360px; line-height: 1.6; margin-top: 4px; }

.skel-row { pointer-events: none; }
.skel {
  display: inline-block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, #E8ECF2 0%, #F4F6F9 50%, #E8ECF2 100%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s linear infinite;
}
@keyframes skel-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* More button */
.more {
  width: 28px; height: 28px; display: grid; place-items: center;
  color: var(--mute); border-radius: var(--r-sm);
  cursor: pointer; background: transparent; border: 0; padding: 0;
  transition: background 120ms ease, color 120ms ease;
}
.more:hover { background: var(--bg); color: var(--ink); }
.more:active { background: var(--border-md); }
.more svg { width: 17px; height: 17px; }

/* Pager */
.table-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 4px 0; font-size: 13px; color: var(--mute);
}
.pager { display: flex; align-items: center; gap: 4px; }
.pager button {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--slate); display: grid; place-items: center;
  cursor: pointer; font-weight: 500; font-size: 13px;
  transition: background 120ms, color 120ms;
}
.pager button.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.pager button:disabled { opacity: 0.4; cursor: default; }

/* Static data badge — marks hardcoded values not yet wired to the DB */
.static-tag {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #b45309;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.28);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 5px;
  vertical-align: middle;
  line-height: 1.6;
  white-space: nowrap;
  flex-shrink: 0;
  pointer-events: none;
}

/* Type chip */
.type-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: var(--r-pill); font-size: 11px; font-weight: 600; line-height: 1.4; letter-spacing: 0.01em; white-space: nowrap; }
.type-chip-ic { display: inline-grid; place-items: center; width: 12px; height: 12px; }
.type-chip-ic svg { width: 12px; height: 12px; }

/* ================================================================
   RIGHT RAIL
   ================================================================ */
.rail-right {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  align-items: center; padding: 14px 0; gap: 4px;
  flex-shrink: 0; width: 56px;
}
.rail-right .icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: grid; place-items: center; color: var(--mute);
  cursor: pointer; border: 0; background: transparent;
  transition: background 120ms, color 120ms;
}
.rail-right .icon-btn:hover { background: var(--bg); color: var(--ink); }
.rail-right .icon-btn svg { width: 17px; height: 17px; }
.rail-right .spacer { flex: 1; }
.rail-right .health {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--green-bg); color: var(--green);
  display: grid; place-items: center;
}
.rail-right .health svg { width: 16px; height: 16px; }

/* ================================================================
   STATUS PILL
   ================================================================ */
.status {
  height: 26px; border-radius: var(--r-pill);
  padding: 0 12px; display: inline-flex; align-items: center;
  gap: 7px; font-size: 12px; font-weight: 600; width: fit-content;
}
.status .dot { width: 6px; height: 6px; border-radius: 50%; }
.status.active  { background: var(--green-bg); color: var(--green); }
.status.active .dot { background: var(--green-dot); box-shadow: 0 0 0 2px rgba(16,185,129,0.25); }
.status.warn    { background: var(--amber-bg); color: var(--amber); }
.status.warn .dot { background: var(--amber); }
.status.error   { background: var(--red-bg); color: var(--red); }
.status.error .dot { background: var(--red); }
.status.draft   { background: var(--bg); color: var(--slate); border: 1px solid var(--border-md); }
.status.draft .dot { background: var(--mute); }
.status.info    { background: var(--blue-light); color: var(--blue); }
.status.info .dot { background: var(--blue); }
.status.pending    { background: var(--amber-bg); color: var(--amber); }
.status.pending .dot { background: var(--amber); }
.status.suspended  { background: var(--red-bg); color: var(--red); }
.status.suspended .dot { background: var(--red); }
.status.rejected   { background: var(--red-bg); color: var(--red); }
.status.rejected .dot { background: var(--red); }

/* ================================================================
   DASHBOARD
   ================================================================ */
.dash-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 22px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-md); }

.card.dark {
  background: var(--grad-dark);
  border-color: rgba(255,255,255,0.06);
  color: #fff;
}
.card.dark:hover { border-color: rgba(255,255,255,0.14); box-shadow: var(--shadow-lg); }

.card.tint {
  background: linear-gradient(160deg, rgba(37,99,235,0.06) 0%, rgba(99,102,241,0.03) 100%);
  border-color: rgba(37,99,235,0.12);
}

.card .label {
  font-size: 12.5px; color: var(--mute); font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.card.dark .label { color: rgba(255,255,255,0.55); }

.card .label .ic {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--blue-light); color: var(--blue);
  display: grid; place-items: center;
}
.card .label .ic svg { width: 14px; height: 14px; }
.card.dark .label .ic { background: rgba(255,255,255,0.08); color: var(--green-dot); }

.card .metric {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 800; font-size: 40px; line-height: 1;
  letter-spacing: -0.03em; color: var(--ink);
}
.card.dark .metric { color: #fff; }
.card .metric-sub { font-size: 16px; font-weight: 400; color: var(--mute); letter-spacing: 0; }
.card.dark .metric-sub { color: rgba(255,255,255,0.45); }

.dash-grid .card { cursor: default; }

.card .delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

.spark { height: 56px; width: 100%; }

.section-title {
  font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700;
  font-size: 17px; color: var(--ink);
  margin: 28px 0 14px; display: flex; align-items: center; justify-content: space-between;
}
.section-title .tools { display: flex; gap: 8px; }

.chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.chart-card .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.chart-card .head h3 { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 17px; margin: 0; color: var(--ink); }
.chart-card .legend { display: flex; gap: 16px; font-size: 12px; color: var(--slate); }
.chart-card .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; }

.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* Event list */
.evlist { display: flex; flex-direction: column; }
.evlist .ev {
  display: grid; grid-template-columns: 36px 1fr auto;
  align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.evlist .ev:last-child { border-bottom: 0; }
.evlist .ev .icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.evlist .ev .icon.g { background: var(--green-bg); color: var(--green); }
.evlist .ev .icon.a { background: var(--amber-bg); color: var(--amber); }
.evlist .ev .icon.r { background: var(--red-bg); color: var(--red); }
.evlist .ev .icon.b { background: var(--blue-light); color: var(--blue); }
.evlist .ev .icon svg { width: 16px; height: 16px; }
.evlist .ev .body { display: flex; flex-direction: column; }
.evlist .ev .ttl { font-size: 13.5px; color: var(--ink); font-weight: 500; }
.evlist .ev .sub { font-size: 12px; color: var(--mute); margin-top: 1px; }
.evlist .ev .when { font-size: 12px; color: var(--mute); white-space: nowrap; }

/* ================================================================
   FORMS
   ================================================================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 900px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field .lbl { font-weight: 600; font-size: 13px; color: var(--ink); }
.field .hint { font-size: 11.5px; color: var(--mute); font-weight: 400; }

.input, .select, .textarea {
  width: 100%; height: 52px; padding: 0 16px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border-md);
  background: var(--surface); font-size: 14px; color: var(--ink); font-weight: 400;
  outline: 0;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--blue);
  box-shadow: var(--shadow-glow);
}
.textarea { height: 130px; padding: 14px 16px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 16px center, var(--surface);
  padding-right: 44px;
}

.dp-input { height: 32px; font-size: 12px; padding: 0 8px; }

.form-actions { display: flex; gap: 10px; margin-top: 8px; max-width: 900px; justify-content: flex-end; }

.btn-primary {
  height: 46px; padding: 0 24px; border-radius: var(--r-pill);
  border: 0;
  background: var(--grad-cta);
  color: #fff; font-weight: 600; font-size: 14px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 12px rgba(37,99,235,0.30);
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(37,99,235,0.40); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-secondary {
  height: 46px; padding: 0 22px; border-radius: var(--r-pill);
  border: 1.5px solid var(--border-md);
  background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.btn-secondary:hover { background: var(--bg); border-color: var(--slate); }
.btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; }

/* ================================================================
   SETTINGS
   ================================================================ */
.settings-grid { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
.set-nav { display: flex; flex-direction: column; gap: 2px; }
.set-nav .item {
  padding: 10px 14px; border-radius: var(--r-md);
  font-size: 13.5px; color: var(--slate); cursor: pointer;
  font-weight: 500; transition: background 120ms, color 120ms;
}
.set-nav .item.active { background: var(--blue-light); color: var(--blue); }
.set-nav .item:hover:not(.active) { background: var(--bg); color: var(--ink); }

.settings-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 28px;
  box-shadow: var(--shadow-sm);
}
.settings-panel h2 {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 700; font-size: 20px; margin: 0 0 4px; color: var(--ink);
}
.settings-panel .sub { color: var(--mute); font-size: 13px; margin-bottom: 24px; }

.set-row {
  display: grid; grid-template-columns: 1fr auto; gap: 16px;
  padding: 18px 0; border-top: 1px solid var(--border); align-items: center;
}
.set-row:first-child { border-top: 0; padding-top: 0; }
.set-row .ttl { font-weight: 600; font-size: 14px; color: var(--ink); }
.set-row .desc { font-size: 12.5px; color: var(--mute); margin-top: 2px; }

.toggle {
  width: 44px; height: 24px; background: var(--subtle);
  border-radius: var(--r-pill); position: relative; cursor: pointer;
  transition: background 150ms ease;
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: left 150ms ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle.on { background: var(--blue); }
.toggle.on::after { left: 23px; }

/* ================================================================
   SOURCES — connector cards
   ================================================================ */
.connector-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.connector {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}
.connector:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-md); }

.connector .top { display: flex; align-items: center; justify-content: space-between; }
.connector .logo {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  font-family: "Plus Jakarta Sans", sans-serif; font-weight: 800; font-size: 14px;
}
.connector .name {
  font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700;
  font-size: 15px; color: var(--ink);
}
.connector .desc { font-size: 12.5px; color: var(--slate); font-weight: 400; min-height: 36px; line-height: 1.5; }
.connector .meta {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--mute);
}
.connector .top-actions { display: flex; align-items: center; gap: 8px; }
.connector .meta-stat { display: inline-flex; align-items: center; gap: 6px; }
.connector .meta-stat .meta-kind { color: var(--ink); font-weight: 600; }
.connector .meta-stat .meta-dot { color: var(--subtle); }

/* Edit button */
.edit-btn {
  height: 30px; padding: 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--border-md); background: var(--surface);
  display: inline-flex; align-items: center; gap: 5px;
  font-family: "Inter", sans-serif; font-weight: 500; font-size: 12.5px;
  color: var(--slate); cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.edit-btn svg { width: 13px; height: 13px; stroke-width: 1.75; color: var(--mute); }
.edit-btn:hover { background: var(--blue-light); border-color: var(--blue); color: var(--blue); }
.edit-btn:hover svg { color: var(--blue); }

/* Users / Customers */
.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.user-cell { display: flex; align-items: center; gap: 12px; }
.user-cell .meta-stack { display: flex; flex-direction: column; }
.user-cell .meta-stack .nm { font-weight: 600; font-size: 14px; color: var(--ink); }
.user-cell .meta-stack .em { font-size: 12px; color: var(--mute); font-weight: 400; }

.role-pill {
  padding: 4px 10px; border-radius: var(--r-sm);
  font-size: 11.5px; font-weight: 600;
  background: var(--bg); color: var(--slate); width: fit-content;
}
.role-pill.admin  { background: var(--purple-bg); color: var(--purple); }
.role-pill.owner  { background: var(--blue-light); color: var(--blue); }
.role-pill.viewer { background: var(--bg); color: var(--slate); }

/* Audit action */
.audit-action { display: inline-flex; align-items: center; gap: 6px; }
.audit-action .verb {
  background: var(--bg); border: 1px solid var(--border-md);
  padding: 2px 8px; border-radius: 6px;
  font-family: "JetBrains Mono", monospace; font-size: 11.5px; color: var(--ink);
}

/* ================================================================
   MAPPING CONFIGURATION PAGE
   ================================================================ */
.mapping-id {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 20px 24px; margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.mapping-id-left { display: flex; align-items: center; gap: 18px; }
.mapping-id-logos { display: flex; align-items: center; gap: 10px; }
.mapping-id-left .logo {
  width: 50px; height: 50px; border-radius: 14px;
  display: grid; place-items: center;
  font-family: "Plus Jakarta Sans", sans-serif; font-weight: 800; font-size: 15px;
}
.mapping-id-meta { display: flex; flex-direction: column; }
.mapping-id-meta .ec { font-size: 11px; color: var(--mute); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.mapping-id-meta .nm { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 20px; color: var(--ink); line-height: 1.25; margin-top: 2px; }
.mapping-id-meta .sub { font-size: 12.5px; color: var(--mute); font-weight: 400; margin-top: 6px; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mapping-id-meta .sub .dot-sep { color: var(--subtle); }

/* Step rail */
.step-rail {
  display: flex; align-items: center; gap: 4px; margin-bottom: 20px;
  padding: 5px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); width: fit-content;
  box-shadow: var(--shadow-xs);
}
.step-pill {
  display: inline-flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 18px; border: 0; background: transparent;
  border-radius: var(--r-md); cursor: pointer;
  font-family: "Inter", sans-serif; font-size: 13.5px; font-weight: 500;
  color: var(--slate); transition: background 120ms, color 120ms;
}
.step-pill:hover { color: var(--ink); }
.step-pill.active {
  background: var(--blue-light);
  color: var(--blue); font-weight: 600;
}
.step-pill[disabled] { opacity: 0.5; cursor: not-allowed; }
.step-pill .step-num {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 12px;
  background: var(--bg); color: var(--mute); flex-shrink: 0;
}
.step-pill.active .step-num { background: var(--blue); color: #fff; }
.step-pill.done .step-num { background: var(--green-bg); color: var(--green); }
.step-pill.done .step-num svg { width: 13px; height: 13px; stroke-width: 2.5; }
.step-line { width: 20px; height: 1px; background: var(--border-md); flex-shrink: 0; }

/* Section cards */
.section-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 24px 28px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.section-card-head { margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-card-title { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 16px; color: var(--ink); }
.section-card-sub { font-size: 12.5px; color: var(--mute); font-weight: 400; margin-top: 3px; line-height: 1.5; }

/* Endpoint pair */
.endpoint-pair { display: grid; grid-template-columns: 1fr 48px 1fr; gap: 12px; align-items: stretch; }
.endpoint-card {
  border: 1.5px solid var(--border); border-radius: var(--r-lg);
  padding: 18px; background: var(--surface);
  transition: border-color 150ms, box-shadow 150ms;
}
.endpoint-card.locked { background: var(--surface-2); border-style: dashed; }
.endpoint-card.empty { display: grid; place-items: center; min-height: 120px; color: var(--mute); border-style: dashed; }
.endpoint-role {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--mute); font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 12px;
}
.endpoint-locked { display: inline-flex; align-items: center; gap: 4px; color: var(--mute); text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12px; }
.endpoint-locked svg { width: 12px; height: 12px; stroke-width: 2; }
.endpoint-body { display: flex; align-items: center; gap: 14px; }
.endpoint-body .logo { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-family: "Plus Jakarta Sans", sans-serif; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.endpoint-meta { flex: 1; min-width: 0; }
.endpoint-name { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 16px; color: var(--ink); }
.endpoint-kind { font-size: 12px; color: var(--mute); font-weight: 400; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.endpoint-select { position: relative; display: flex; align-items: center; }
.endpoint-select .select.bare { height: 34px; padding: 0 32px 0 10px; border-radius: 8px; font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 16px; color: var(--ink); background-image: none; border: 1px solid var(--border); }
.endpoint-select svg { position: absolute; right: 10px; pointer-events: none; width: 12px; height: 12px; color: var(--mute); }
.endpoint-arrow { display: grid; place-items: center; color: var(--blue); }

/* Auth/config panels */
.auth-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-panel {
  border: 1.5px solid var(--border); border-radius: var(--r-lg);
  padding: 20px; background: var(--surface-2);
}
.auth-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.auth-side-pill {
  font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700;
  font-size: 10.5px; letter-spacing: 0.07em; padding: 4px 8px; border-radius: 6px;
}
.auth-panel-label { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 14px; color: var(--ink); flex: 1; }
.auth-test-ok {
  margin-top: 14px; padding: 10px 14px; border-radius: var(--r-md);
  background: var(--green-bg); color: var(--green);
  font-size: 12.5px; display: flex; align-items: center; gap: 8px;
}
.auth-test-ok svg { width: 15px; height: 15px; stroke-width: 2; }

/* Field mapping table */
.mapping-card { padding: 22px 26px 20px; }
.mapping-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.mapping-head-left { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; white-space: nowrap; min-width: 0; overflow: hidden; }
.mapping-eyebrow { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 13px; color: var(--mute); flex-shrink: 0; }
.mapping-route { display: inline-flex; align-items: center; gap: 8px; font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 17px; color: var(--ink); }
.mapping-route svg { width: 15px; height: 15px; color: var(--slate); stroke-width: 1.75; }

.mapping-table {
  border: 1.5px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.mapping-row {
  display: grid; grid-template-columns: 1fr 40px 1fr 130px 44px;
  align-items: center; padding: 10px 18px; gap: 12px;
  border-top: 1px solid var(--border);
  transition: background 120ms;
}
.mapping-row:first-child { border-top: 0; }
.mapping-row:not(.head):hover { background: var(--blue-light); }
.mapping-row:not(.head):hover .mapping-arrow { color: var(--blue); }
.mapping-row.head {
  background: var(--surface-2); padding: 12px 18px;
  font-size: 12px; font-weight: 600; color: var(--mute);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.mapping-row.head > div:first-child,
.mapping-row.head > div:nth-child(3) { color: var(--ink); font-family: "Plus Jakarta Sans", sans-serif; font-size: 13px; letter-spacing: 0; }
.mapping-row.highlight .mapping-arrow { color: var(--blue); }
.mapping-cell { display: flex; align-items: center; }
.mapping-arrow { display: grid; place-items: center; color: var(--subtle); }
.mapping-remove { justify-content: flex-end; opacity: 0; transition: opacity 120ms; }
.mapping-row:hover .mapping-remove { opacity: 1; }

.mapping-input {
  border: 0; background: transparent;
  font-family: "JetBrains Mono", monospace; font-size: 13px; color: var(--ink);
  padding: 6px 8px; border-radius: var(--r-sm); width: 100%; outline: none;
  transition: background 120ms, box-shadow 120ms;
}
.mapping-input:focus { background: var(--surface); box-shadow: 0 0 0 2px rgba(37,99,235,0.18); }
.mapping-row:hover .mapping-input { background: var(--surface); }

/* Required pill */
.req-pill {
  border: 0; height: 26px; padding: 0 12px; border-radius: var(--r-pill);
  font-family: "Inter", sans-serif; font-weight: 600; font-size: 11.5px;
  cursor: pointer; transition: background 120ms, color 120ms;
}
.req-pill.required { background: var(--purple-bg); color: var(--purple); }
.req-pill.required:hover { background: rgba(124,58,237,0.18); }
.req-pill.optional { background: var(--bg); color: var(--slate); border: 1px solid var(--border-md); }
.req-pill.optional:hover { background: var(--border-md); color: var(--ink); }

.ghost-icon {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  border: 0; background: transparent; color: var(--mute);
  cursor: pointer; display: grid; place-items: center;
  transition: background 120ms, color 120ms;
}
.ghost-icon:hover { background: var(--red-bg); color: var(--red); }
.ghost-icon svg { width: 14px; height: 14px; stroke-width: 1.75; }

.mapping-footnote { margin-top: 14px; font-size: 12px; color: var(--mute); font-weight: 400; }

.mapping-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border);
}
.mapping-actions-right { display: flex; align-items: center; gap: 10px; }

/* Empty mapping */
.empty-mapping { display: grid; place-items: center; min-height: 400px; }
.empty-mapping-card { text-align: center; max-width: 360px; }
.empty-mapping-card h3 { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 19px; color: var(--ink); margin: 0 0 8px; }
.empty-mapping-card p { font-size: 13.5px; color: var(--slate); font-weight: 400; margin: 0 0 20px; line-height: 1.6; }

/* ================================================================
   MAPPINGS LIST
   ================================================================ */
.map-sub { font-size: 12px; color: var(--mute); font-weight: 400; }
.map-route { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.map-route .endpoint { font-size: 13px; color: var(--ink); font-weight: 500; }
.map-route-arrow { color: var(--blue); font-weight: 600; }

.field-chip {
  display: inline-flex; align-items: baseline; gap: 2px;
  padding: 4px 10px; border-radius: var(--r-sm);
  background: var(--blue-light); color: var(--blue);
  font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 12.5px;
}
.field-chip .of { font-weight: 400; color: var(--slate); opacity: 0.7; }

.sched-chip {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px;
  border-radius: var(--r-sm); background: var(--bg); border: 1px solid var(--border-md);
  font-family: "JetBrains Mono", monospace; font-size: 11.5px; color: var(--ink);
}

.select.compact {
  height: 34px; padding: 0 32px 0 10px; border-radius: var(--r-md);
  border: 1px solid var(--border-md); font-size: 13px; font-weight: 500;
  color: var(--ink); width: auto; min-width: 150px;
  background-position: right 10px center; background-size: 10px;
}

/* ================================================================
   CONNECTION PICKER
   ================================================================ */
.pick-preview { display: grid; grid-template-columns: 1fr 56px 1fr; gap: 12px; align-items: stretch; margin-bottom: 20px; }
.pick-slot {
  background: var(--surface); border: 1.5px dashed var(--border-md);
  border-radius: var(--r-xl); padding: 18px 22px;
  min-height: 96px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color 120ms, box-shadow 120ms;
}
.pick-slot.filled { border-style: solid; border-color: var(--border-md); }
.pick-slot-label { font-size: 11px; color: var(--mute); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.pick-slot-body { display: flex; align-items: center; gap: 14px; }
.pick-slot-body .logo { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-family: "Plus Jakarta Sans", sans-serif; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.pick-slot-name { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 700; font-size: 17px; color: var(--ink); line-height: 1.2; }
.pick-slot-kind { font-size: 12.5px; color: var(--slate); font-weight: 400; margin-top: 2px; }
.pick-slot-placeholder { color: var(--mute); font-size: 13.5px; font-weight: 400; font-style: italic; display: flex; align-items: center; flex: 1; min-height: 48px; }
.pick-arrow { display: grid; place-items: center; color: var(--blue); }
.pick-arrow svg { width: 28px; height: 28px; stroke-width: 1.5; }

.connector.picker { position: relative; }
.connector.picker.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.14);
}
.connector.picker.selected .name { color: var(--blue); }
.connector.picker.disabled { opacity: 0.4; cursor: not-allowed; }
.connector.picker.disabled:hover { transform: none; box-shadow: var(--shadow-sm); }
.connector-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--blue); color: #fff;
}
.connector-check svg { width: 15px; height: 15px; stroke-width: 2; }

/* ================================================================
   MISC
   ================================================================ */
.fig-tip {
  position: absolute; left: 200px; bottom: 60px; width: 300px;
  background: var(--ink-2); color: rgba(255,255,255,0.9);
  padding: 16px 20px; border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  font-size: 13.5px; font-weight: 400; line-height: 1.6;
  border: 1px solid rgba(255,255,255,0.06);
}
.fig-tip::before {
  content: ""; position: absolute; left: 32px; top: -6px;
  width: 12px; height: 12px; background: var(--ink-2);
  transform: rotate(45deg);
  border-top: 1px solid rgba(255,255,255,0.06);
  border-left: 1px solid rgba(255,255,255,0.06);
}

/* Mapping name tooltip (audit table flow label) */
.mapping-tooltip-wrap { position: relative; display: inline-block; max-width: 100%; }
.mapping-tooltip-bubble {
  position: absolute; left: 0; bottom: calc(100% + 9px);
  display: flex; flex-direction: column; gap: 2px;
  min-width: 140px; max-width: 260px;
  background: var(--ink-2); color: #fff;
  padding: 8px 12px; border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.06);
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none; z-index: 50; white-space: normal;
}
.mapping-tooltip-bubble::after {
  content: ""; position: absolute; left: 14px; top: 100%;
  width: 10px; height: 10px; background: var(--ink-2);
  transform: translateY(-50%) rotate(45deg);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  border-right: 1px solid rgba(255,255,255,0.06);
}
.mapping-tooltip-label {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: rgba(255,255,255,0.5);
}
.mapping-tooltip-name {
  font-size: 12.5px; font-weight: 600; color: #fff;
  overflow-wrap: break-word;
}
.mapping-tooltip-wrap:hover .mapping-tooltip-bubble {
  opacity: 1; visibility: visible; transform: translateY(0);
}

/* Flatpickr theme — align the date/time popup with the app's design tokens */
.flatpickr-calendar {
  font-family: "Inter", system-ui, sans-serif;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.flatpickr-calendar.arrowTop:before,
.flatpickr-calendar.arrowTop:after,
.flatpickr-calendar.arrowBottom:before,
.flatpickr-calendar.arrowBottom:after { display: none; }
.flatpickr-calendar.inline { box-shadow: none; border: none; }
.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-weekdays { background: var(--surface); color: var(--ink); }
.flatpickr-current-month input.cur-year {
  color: var(--ink); margin-left: 4px;
  -webkit-appearance: textfield; -moz-appearance: textfield; appearance: textfield;
}
.flatpickr-current-month input.cur-year::-webkit-outer-spin-button,
.flatpickr-current-month input.cur-year::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.flatpickr-current-month .flatpickr-monthDropdown-months { margin-right: 2px; }
.flatpickr-weekday { color: var(--mute); font-weight: 600; }
.flatpickr-day { color: var(--ink); border-radius: var(--r-sm); }
.flatpickr-day.today { border-color: var(--blue); }
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
  background: var(--blue); border-color: var(--blue); color: #fff;
}
.flatpickr-day:hover { background: var(--blue-light); }
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay { color: var(--subtle); }

/* Range mode — connected band between the two picked endpoints */
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
  background: var(--blue); border-color: var(--blue); color: #fff;
}
.flatpickr-day.inRange {
  background: var(--blue-light);
  border-color: var(--blue-light);
  box-shadow: -5px 0 0 var(--blue-light), 5px 0 0 var(--blue-light);
}
/* Custom TimePicker (replaces flatpickr's stock time widget everywhere) */
.tp-field {
  display: flex; align-items: center; justify-content: center; gap: 2px;
  flex: 1; background: var(--surface); border: 1.5px solid var(--border-md);
  border-radius: var(--r-sm); padding: 3px 6px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.tp-field:focus-within { border-color: var(--blue-mid); box-shadow: var(--shadow-glow); }
.tp-num {
  width: 26px; border: none; background: transparent; outline: 0;
  font-family: inherit; font-size: 13px; font-weight: 700;
  text-align: center; color: var(--ink);
}
.tp-num::placeholder { color: var(--subtle); font-weight: 600; }
.tp-sep { font-size: 13px; font-weight: 700; color: var(--mute); }
.tp-field.tp-pending .tp-num { color: var(--mute); font-weight: 600; }
.tp-meridiem {
  display: flex; flex-direction: column; flex-shrink: 0;
  border: 1.5px solid var(--border-md); border-radius: var(--r-sm); overflow: hidden;
}
.tp-meridiem button {
  border: none; background: var(--surface); color: var(--mute);
  font-size: 9px; font-weight: 700; padding: 2px 7px; cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.tp-meridiem button + button { border-top: 1px solid var(--border-md); }
.tp-meridiem button.active { background: var(--blue); color: #fff; }
.tp-meridiem button:hover:not(.active) { background: var(--blue-light); color: var(--blue); }
.tp-actions button.tp-clear:hover { color: var(--red); }
