/* ============================================================
   ShareWillow Sales Console - Stylesheet
   Ported from the ShareWillow Design System (Next.js / Tailwind v4)
   to plain CSS for the Flask app.

   Token reference: src/app/globals.css in `sharewillow - design`.
   No dark mode (design system is intentionally light-only).
   ============================================================ */

/* ---- Fonts ----------------------------------------------------- */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

@font-face {
  font-family: "Matter";
  font-weight: 400;
  font-style: normal;
  src: url("/static/fonts/Matter-Regular.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Matter";
  font-weight: 500;
  font-style: normal;
  src: url("/static/fonts/Matter-Medium.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Matter";
  font-weight: 600;
  font-style: normal;
  src: url("/static/fonts/Matter-SemiBold.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Matter";
  font-weight: 700;
  font-style: normal;
  src: url("/static/fonts/Matter-Bold.woff2") format("woff2");
  font-display: swap;
}

/* ============================================================
   Tokens - primitives + semantic aliases
   ============================================================ */
:root {
  /* Type scale (dashboard-dense, Figma) */
  --text-xs: 0.625rem;
  --text-sm: 0.75rem;
  --text-base: 0.8125rem;
  --text-lg: 0.9375rem;
  --text-xl: 1.125rem;
  --text-2xl: 1.375rem;
  --text-3xl: 1.625rem;

  /* Neutral scale (Figma "Base Colours") */
  --color-white: #ffffff;
  --color-black: #1a1a1a;
  --color-neutral-50: #fcfcfc;
  --color-neutral-100: #fafafa;
  --color-neutral-200: #f5f5f5;
  --color-neutral-300: #f0f0f0;
  --color-neutral-400: #e6e6e6;
  --color-neutral-500: #dbdbdb;
  --color-neutral-600: #cccccc;
  --color-neutral-700: #a8a8a8;
  --color-neutral-800: #808080;
  --color-neutral-900: #525252;
  --color-neutral-950: #292929;

  /* Brand + status - sRGB approximations of the OKLCH scale step 9 */
  --color-blue-3: #dfe9fb;
  --color-blue-9: #2864e5;
  --color-blue-10: #1f56cf;
  --color-blue-11: #1a48aa;
  --color-blue-12: #133382;

  --color-green-3: #d8eecf;
  --color-green-9: #1aa341;
  --color-green-10: #138c39;
  --color-green-11: #0d702d;

  --color-yellow-3: #f8efa4;
  --color-yellow-9: #d8a300;
  --color-yellow-10: #b88800;
  --color-yellow-11: #8e6800;

  --color-red-3: #fbdcd9;
  --color-red-9: #d63b34;
  --color-red-10: #c12c25;
  --color-red-11: #99201d;

  --color-orange-3: #fbe2c9;
  --color-orange-9: #de7a17;

  --color-purple-3: #e6dffa;
  --color-purple-9: #6d3fe0;

  --color-teal-3: #d2eef0;
  --color-teal-9: #0e9398;

  --color-pink-9: #d63686;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Shadows */
  --shadow-card: 0 1px 2px 2px rgba(20, 20, 20, 0.04);
  --shadow-popover:
    0 1px 2px 0 rgba(0, 0, 0, 0.08),
    0 2px 4px 0 rgba(0, 0, 0, 0.06);

  /* Semantic aliases - change brand here */
  --background: var(--color-white);
  --foreground: var(--color-black);
  --muted: var(--color-neutral-100);
  --muted-foreground: #474747;
  --card: var(--color-white);
  --primary: var(--color-blue-9);
  --primary-hover: var(--color-blue-10);
  --primary-foreground: var(--color-white);
  --secondary: var(--color-neutral-200);
  --destructive: var(--color-red-9);
  --destructive-hover: var(--color-red-10);
  --destructive-foreground: var(--color-white);
  --border: var(--color-neutral-300);
  --input-border: var(--color-neutral-600);
  --ring: var(--color-blue-9);
}

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--color-neutral-100);
  color: var(--foreground);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.font-display { font-family: "Matter", "Inter", system-ui, sans-serif; }

.shell { max-width: 1280px; margin: 0 auto; padding: 24px; }

/* ============================================================
   Dashboard layout - sticky left sidenav + main content
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.dashboard-sidenav {
  position: sticky;
  top: 70px;            /* sit just below the topbar */
  align-self: start;
  padding-top: 4px;
}
.sidenav-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  font-weight: 500;
  margin-bottom: 8px; padding-left: 14px;
}
.sidenav-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.sidenav-list li { margin: 0; padding: 0; }
.sidenav-list a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  color: var(--muted-foreground);
  font-size: var(--text-base); font-weight: 500;
  border-radius: var(--radius-md);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background-color .15s, color .15s, border-color .15s;
}
.sidenav-list a:hover {
  color: var(--foreground);
  background: var(--color-neutral-100);
  text-decoration: none;
}
.sidenav-list a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  background: var(--color-blue-3);
  font-weight: 600;
}
.sidenav-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-neutral-500);
  flex-shrink: 0;
  transition: background-color .15s;
}
.sidenav-list a:hover .sidenav-dot { background: var(--foreground); }
.sidenav-list a.active .sidenav-dot { background: var(--primary); }

/* Below 1024px the sidenav doesn't fit usefully - collapse to top
   bar with horizontal scroll. */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .dashboard-sidenav {
    position: sticky; top: 64px; z-index: 5;
    background: var(--color-neutral-100);
    padding: 8px 0; margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }
  .sidenav-label { display: none; }
  .sidenav-list {
    flex-direction: row; gap: 4px; overflow-x: auto;
    padding: 2px 4px;
  }
  .sidenav-list a {
    padding: 6px 12px;
    border-left: 0; border-bottom: 2px solid transparent;
    border-radius: 0;
    white-space: nowrap;
  }
  .sidenav-list a.active {
    border-left: 0; border-bottom-color: var(--primary);
    background: transparent;
  }
}
.muted, .muted-fg { color: var(--muted-foreground); }
.small { font-size: var(--text-sm); }
.row { display: flex; gap: 8px; align-items: center; }
.inline { display: inline-block; }
.req { color: var(--destructive); font-weight: 600; }
.pos { color: var(--color-green-11) !important; }
.neg { color: var(--color-red-11) !important; }

/* Hide native spinners (matches design system) */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
  background: var(--color-white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.navbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--foreground); }
.brand:hover { text-decoration: none; }
.brand-logo { height: 22px; width: auto; display: block; }
.brand-divider {
  width: 1px; height: 18px; background: var(--border); margin: 0 4px;
}
.brand-tag {
  font-size: var(--text-sm); color: var(--muted-foreground); font-weight: 500;
}
.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-right a { color: var(--muted-foreground); font-size: var(--text-base); font-weight: 500; }
.nav-right a:hover { color: var(--foreground); text-decoration: none; }
.nav-right .cta { color: var(--primary-foreground); }
.link-btn {
  background: none; border: none; color: var(--muted-foreground); cursor: pointer;
  font-size: inherit; font-weight: 500; padding: 0;
}
.link-btn:hover { color: var(--foreground); }

/* ============================================================
   Flash + banners
   ============================================================ */
.flash {
  padding: 10px 14px; border-radius: var(--radius-lg);
  margin-bottom: 12px; border: 1px solid var(--border);
  background: var(--color-white); font-size: var(--text-base);
}
.flash-success { background: var(--color-green-3); border-color: rgba(26,163,65,0.25); color: var(--color-green-11); }
.flash-error   { background: var(--color-red-3);   border-color: rgba(214,59,52,0.25); color: var(--color-red-11); }
.flash-warning { background: var(--color-yellow-3); border-color: rgba(216,163,0,0.30); color: var(--color-yellow-11); }
.flash-info    { background: var(--color-blue-3);  border-color: rgba(40,100,229,0.25); color: var(--color-blue-11); }
.banner-info, .banner-warn, .banner-error {
  padding: 12px 14px; border-radius: var(--radius-lg);
  margin-bottom: 16px; border: 1px solid var(--border); font-size: var(--text-base);
}
.banner-info  { background: var(--color-blue-3);  border-color: rgba(40,100,229,0.25); color: var(--color-blue-11); }
.banner-warn  { background: var(--color-yellow-3); border-color: rgba(216,163,0,0.30); color: var(--color-yellow-11); }
.banner-error { background: var(--color-red-3);   border-color: rgba(214,59,52,0.25); color: var(--color-red-11); }

/* ============================================================
   Forms (Input component port)
   ============================================================ */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-2col .full { grid-column: 1 / -1; }
.form label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: var(--text-base); font-weight: 500;
  color: var(--color-neutral-950);
}
.form label.checkbox {
  flex-direction: row; align-items: center; gap: 8px;
  color: var(--foreground);
}
.form label .muted, .form label .small { font-weight: 400; }
.input {
  background: var(--color-white);
  border: 1px solid var(--input-border);
  color: var(--foreground);
  padding: 9px 12px; height: 40px;
  border-radius: var(--radius-lg);
  font-size: 14px; font-family: inherit; font-weight: 500;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--color-neutral-900); font-weight: 400; }
.input:hover { border-color: var(--color-neutral-700); }
.input:focus, .input:focus-visible {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--color-blue-3);
}
textarea.input { height: auto; min-height: 88px; padding-top: 10px; line-height: 1.5; }
.field-error { color: var(--destructive); font-size: var(--text-sm); font-weight: 400; }

.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }

/* ============================================================
   Buttons (Button component port)
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 14px; gap: 4px;
  border-radius: var(--radius-lg);
  font-family: inherit; font-size: var(--text-base); font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
  border: 1px solid transparent;
}
.btn:focus-visible {
  outline: none; box-shadow: 0 0 0 2px var(--color-white), 0 0 0 4px var(--ring);
}
.btn-primary {
  background: var(--primary); color: var(--primary-foreground);
}
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; }
.btn-secondary, .btn:not(.btn-primary):not(.btn-ghost):not(.btn-danger) {
  background: var(--color-white); color: var(--foreground);
  border-color: var(--color-neutral-600);
}
.btn-secondary:hover, .btn:not(.btn-primary):not(.btn-ghost):not(.btn-danger):hover {
  background: var(--color-neutral-200); border-color: var(--foreground);
  text-decoration: none;
}
.btn-ghost {
  background: transparent; color: var(--foreground); border-color: transparent;
}
.btn-ghost:hover { background: rgba(0,0,0,0.06); text-decoration: none; }
.btn-danger {
  background: var(--destructive); color: var(--destructive-foreground);
  border-color: var(--destructive);
}
.btn-danger:hover { background: var(--destructive-hover); border-color: var(--destructive-hover); }
.btn-small { height: 32px; padding: 0 10px; font-size: var(--text-sm); }

/* ============================================================
   Page chrome
   ============================================================ */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin: 8px 0 24px 0;
}
.page-head h1 {
  margin: 0; font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-2xl); font-weight: 600;
  letter-spacing: -0.01em; line-height: 1.2;
}
.page-head .muted { font-size: var(--text-base); margin-top: 4px; }
.section-title {
  margin: 28px 0 12px 0; font-size: var(--text-sm);
  color: var(--muted-foreground); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.section-subtitle {
  text-transform: none; letter-spacing: 0;
  font-weight: 400; color: var(--muted-foreground);
  font-size: var(--text-sm); margin-left: 4px;
}

/* ============================================================
   Card
   ============================================================ */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px 22px; margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}
.card h2 {
  margin: 0 0 12px 0; font-size: var(--text-xl); font-weight: 600;
  font-family: "Matter", "Inter", sans-serif; letter-spacing: -0.01em;
}
.card h3 {
  margin: 0 0 8px 0; font-size: var(--text-lg); font-weight: 600;
}

.danger-zone { border-color: rgba(214,59,52,0.30); }

/* ============================================================
   Card header with inline controls (filter bars etc.)
   ============================================================ */
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
}
.card-header h2 { margin: 0; }

/* ============================================================
   Filter chips (multi-select pill toggles)
   ============================================================ */
.filter-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
}
.filter-label {
  color: var(--muted-foreground); font-size: var(--text-sm);
  font-weight: 500; margin-right: 4px;
}
.filter-chip {
  display: inline-flex; align-items: center;
  background: var(--color-white); color: var(--muted-foreground);
  border: 1px solid var(--color-neutral-600);
  border-radius: 999px; padding: 4px 12px;
  font-family: inherit; font-size: var(--text-sm); font-weight: 500;
  cursor: pointer; user-select: none;
  transition: background-color .15s, color .15s, border-color .15s;
}
.filter-chip:hover { border-color: var(--foreground); color: var(--foreground); }
.filter-chip.active {
  background: var(--primary); color: var(--primary-foreground);
  border-color: var(--primary);
}
.filter-chip.active:hover {
  background: var(--primary-hover); border-color: var(--primary-hover);
}
.filter-chip:focus-visible {
  outline: none; box-shadow: 0 0 0 2px var(--color-white), 0 0 0 4px var(--ring);
}

/* ============================================================
   Source / last-sync row + refresh icon button
   ============================================================ */
.source-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 4px;
}
.source-row > .tag { margin-left: 2px; }
.last-sync { color: var(--muted-foreground); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--color-white); color: var(--muted-foreground);
  border: 1px solid var(--color-neutral-600);
  border-radius: 999px; width: 28px; height: 28px; padding: 0;
  cursor: pointer; margin-left: 2px;
  transition: background-color .15s, color .15s, border-color .15s;
}
.icon-btn:hover:not(:disabled) {
  background: var(--primary); color: var(--primary-foreground);
  border-color: var(--primary);
}
.icon-btn:focus-visible {
  outline: none; box-shadow: 0 0 0 2px var(--color-white), 0 0 0 4px var(--ring);
}
.icon-btn:disabled { opacity: 0.7; cursor: progress; }
@keyframes spin-cw {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.icon-btn.spinning svg,
.icon-btn:active svg { animation: spin-cw 0.9s linear infinite; }
.icon-btn.spinning {
  background: var(--primary); color: var(--primary-foreground);
  border-color: var(--primary);
}

/* ============================================================
   Share dashboard modal
   ============================================================ */
.share-modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 18, 24, 0.45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.share-modal[hidden] { display: none; }
.share-modal-card {
  background: var(--color-white); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-popover);
  padding: 28px 32px;
  max-width: 540px; width: 100%;
  position: relative;
}
.share-modal-card h3 {
  margin: 0 0 8px 0;
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-xl); font-weight: 600;
}
.share-modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: 0; cursor: pointer;
  font-size: 18px; color: var(--muted-foreground);
  width: 28px; height: 28px; border-radius: var(--radius-sm);
}
.share-modal-close:hover { background: var(--color-neutral-200); color: var(--foreground); }

.share-url-row {
  display: flex; gap: 8px; margin: 14px 0 16px 0;
}
.share-url-input {
  flex: 1; min-width: 0; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px; user-select: all;
}
.share-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  background: var(--color-neutral-50);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px 14px; margin: 12px 0 16px 0;
}
.share-stat-label {
  font-size: var(--text-xs); color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500;
}
.share-stat-value {
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-lg); font-weight: 600; margin-top: 4px;
  color: var(--foreground);
}
.share-actions {
  display: flex; gap: 8px; margin-top: 8px;
  border-top: 1px solid var(--border); padding-top: 12px;
}

/* ============================================================
   Loading overlay (shown while connecting an integration)
   ============================================================ */
.loading-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 18, 24, 0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.loading-overlay[hidden] { display: none; }
.loading-card {
  background: var(--color-white); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-popover);
  padding: 32px 36px;
  max-width: 460px; width: 100%;
}
.loading-card h3 {
  margin: 16px 0 6px 0;
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-xl); font-weight: 600;
}
.loading-card p { margin: 12px 0 0 0; }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--color-neutral-300);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin-cw 0.85s linear infinite;
  margin-bottom: 4px;
}

.step-list {
  list-style: none; padding: 0; margin: 18px 0 4px 0;
  display: flex; flex-direction: column; gap: 8px;
}
.step-list li {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted-foreground);
  font-size: var(--text-base);
  transition: color .25s;
}
.step-list li .dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--color-neutral-500);
  background: var(--color-white);
  flex-shrink: 0;
  transition: all .25s;
}
.step-list li.active {
  color: var(--foreground); font-weight: 500;
}
.step-list li.active .dot {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--color-blue-3);
  animation: pulse 1.4s ease-in-out infinite;
}
.step-list li.done {
  color: var(--color-green-11);
}
.step-list li.done .dot {
  background: var(--color-green-9);
  border-color: var(--color-green-9);
  box-shadow: none;
  animation: none;
  position: relative;
}
.step-list li.done .dot::after {
  content: ""; position: absolute;
  inset: 0;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><path d="M3 7l3 3 5-6" stroke="white" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" fill="none"/></svg>') no-repeat center / 10px 10px;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--color-blue-3); }
  50% { box-shadow: 0 0 0 6px var(--color-blue-3); }
}

.auth-card {
  max-width: 420px; margin: 56px auto; padding: 30px 32px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-card);
}
.auth-card h1 {
  margin: 0 0 4px 0; font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.01em;
}

/* ============================================================
   Data tables (Table component port)
   ============================================================ */
.data-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: var(--text-base);
}
.data-table th, .data-table td {
  text-align: left; padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.data-table th {
  color: var(--muted-foreground); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.04em;
  font-size: var(--text-xs); background: var(--color-neutral-50);
}
.data-table tbody tr:hover { background: var(--color-neutral-100); }
.data-table tbody tr:last-child td { border-bottom: 0; }
/* Keep tech / category names on one line so 'Sasha Isaenko' /
   'John Hahn Jr' / 'Michael Lapp' don't wrap awkwardly. The other
   columns will absorb width as needed. */
.data-table thead th:first-child,
.data-table tbody td:first-child { white-space: nowrap; }
.num { text-align: right; }
.good { color: var(--color-green-11); }
.bad  { color: var(--color-red-11); }

/* Pills / chips / tags */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  background: var(--color-neutral-200); color: var(--foreground);
  font-size: var(--text-xs); font-weight: 500;
}
.tag-ok      { background: var(--color-green-3);  color: var(--color-green-11); }
.tag-pending { background: var(--color-yellow-3); color: var(--color-yellow-11); }
.tag-error   { background: var(--color-red-3);    color: var(--color-red-11); }
.chip {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm);
  background: var(--color-neutral-200); color: var(--muted-foreground);
  font-size: var(--text-xs); margin-right: 4px;
}

/* ============================================================
   Empty state
   ============================================================ */
.empty {
  background: var(--card); border: 1px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: 60px 30px; text-align: center;
}
.empty-title {
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-xl); font-weight: 600; margin-bottom: 8px;
}
.empty-body { color: var(--muted-foreground); margin-bottom: 20px; }

/* ============================================================
   Connector picker grid
   ============================================================ */
.connector-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px; margin-top: 8px;
}
.connector-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
  color: var(--foreground); text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.connector-card:hover {
  border-color: var(--primary); box-shadow: var(--shadow-card);
  text-decoration: none; transform: translateY(-1px);
}
.connector-name {
  font-weight: 600; display: flex; align-items: center; gap: 8px;
  justify-content: space-between; margin-bottom: 4px;
  font-size: var(--text-lg);
}
.connector-tagline {
  color: var(--muted-foreground); font-size: var(--text-sm);
  margin-bottom: 8px;
}
.connector-industries { display: flex; flex-wrap: wrap; gap: 4px; }

/* ============================================================
   KPI cards (MetricCard component port)
   ============================================================ */
.cards {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 18px;
}
.card-stat {
  background: var(--card); border: 0.5px solid var(--color-neutral-400);
  border-radius: var(--radius-lg);
  padding: 14px 16px; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 104px; gap: 18px;
}
.card-stat .label {
  color: var(--foreground); font-size: var(--text-lg);
  font-weight: 500; line-height: 1.2;
}
.card-stat .value {
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-3xl); font-weight: 500;
  line-height: 1; color: var(--foreground);
  font-variant-numeric: tabular-nums;
}
.card-stat .delta {
  color: var(--muted-foreground); font-size: var(--text-sm);
  margin-top: 4px;
}
.card-stat.accent .value { color: var(--primary); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

/* ============================================================
   ROI hero
   ============================================================ */
.roi-hero {
  background: linear-gradient(135deg, #f8faff, var(--color-blue-3));
  border-color: rgba(40,100,229,0.30);
}
.roi-cards {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 12px; margin-bottom: 14px;
}
.roi-card {
  background: var(--color-white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
}
.roi-card .label {
  color: var(--muted-foreground); font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500;
}
.roi-card .value {
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-3xl); font-weight: 600;
  margin-top: 6px; line-height: 1; color: var(--foreground);
  font-variant-numeric: tabular-nums;
}
.roi-card .delta { color: var(--muted-foreground); font-size: var(--text-xs); margin-top: 4px; }
.roi-card.primary {
  background: var(--primary); color: var(--primary-foreground);
  border-color: var(--primary);
}
.roi-card.primary .label,
.roi-card.primary .delta { color: rgba(255,255,255,0.85); }
/* Beat the global `.pos {color: green !important}` / `.neg {color: red !important}`
   when the value sits inside the blue primary card - white reads on blue. */
.roi-card.primary .value,
.roi-card.primary .value.pos,
.roi-card.primary .value.neg {
  color: var(--primary-foreground) !important;
}

.roi-narrative {
  background: var(--color-white); border-left: 3px solid var(--primary);
  border-radius: var(--radius-md); padding: 12px 16px; margin: 10px 0 14px 0;
  color: var(--foreground); font-size: var(--text-base); line-height: 1.6;
}

.sliders {
  margin-top: 12px; padding: 14px 16px;
  background: var(--color-white); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.sliders summary {
  cursor: pointer; color: var(--primary); font-weight: 600;
  font-size: var(--text-base);
}
.slider-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
  margin-top: 14px;
}
.slider-grid label {
  display: block; font-size: var(--text-sm); color: var(--muted-foreground);
  margin-bottom: 6px; font-weight: 500;
}
.slider-grid label span {
  color: var(--primary); font-weight: 600;
  font-family: "Matter", "Inter", sans-serif;
}
.slider-grid input[type=range] {
  width: 100%; accent-color: var(--primary); margin-top: 4px;
}

.sensitivity {
  width: 100%; margin-top: 14px; border-collapse: separate;
  border-spacing: 0; font-size: var(--text-base);
  background: var(--color-white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.sensitivity th, .sensitivity td {
  text-align: left; padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.sensitivity tr:last-child td { border-bottom: 0; }
.sensitivity th {
  color: var(--muted-foreground); font-weight: 500;
  font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: 0.04em; background: var(--color-neutral-50);
}
/* The row whose adoption matches the current slider value - the
   numbers in the cards above are calculated from this scenario, so
   we highlight it so the rep can point at the source row. */
.sensitivity tr.sensitivity-active td {
  background: var(--color-green-3);
  font-weight: 500;
}
.sensitivity tr.sensitivity-active td:first-child {
  border-left: 3px solid var(--color-green-9);
}
.sensitivity .active-marker {
  color: var(--color-green-11); font-weight: 600;
  font-size: var(--text-xs);
}

/* ============================================================
   Incentive plan - scannable lever cards
   ============================================================ */
.plan-tagline {
  margin: -4px 0 14px 0; font-size: var(--text-base);
  color: var(--muted-foreground); max-width: 760px;
}
.lever-grid {
  display: flex; flex-direction: column; gap: 14px;
  margin-bottom: 18px;
}
.lever-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 14px;
  position: relative;
  border-left: 4px solid var(--primary);
}
/* Medal-style left border by rank - top 3 lift potentials stand out */
.lever-card[data-rank="1"] { border-left-color: #e6b800; } /* gold */
.lever-card[data-rank="2"] { border-left-color: #a8a8a8; } /* silver */
.lever-card[data-rank="3"] { border-left-color: #c08350; } /* bronze */
.lever-card[data-rank="4"],
.lever-card[data-rank="5"] { border-left-color: var(--primary); }

.lever-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px; align-items: flex-start;
}
.lever-rank {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-neutral-200);
  display: flex; align-items: center; justify-content: center;
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-lg); font-weight: 700;
  color: var(--foreground); flex-shrink: 0;
}
.lever-card[data-rank="1"] .lever-rank { background: #e6b800; color: white; }
.lever-card[data-rank="2"] .lever-rank { background: #a8a8a8; color: white; }
.lever-card[data-rank="3"] .lever-rank { background: #c08350; color: white; }

.lever-title { min-width: 0; }
.lever-title h3 {
  margin: 0 0 6px 0;
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-xl); font-weight: 600;
  line-height: 1.2;
}
.lever-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lever-kpi-chip {
  display: inline-block;
  font-size: var(--text-xs); color: var(--muted-foreground);
  background: var(--color-neutral-100);
  border: 1px solid var(--border);
  padding: 2px 9px; border-radius: var(--radius-sm);
  text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500;
}
.lever-popularity-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--text-xs); color: var(--color-blue-12);
  background: var(--color-blue-3);
  border: 1px solid rgba(40, 100, 229, 0.20);
  padding: 2px 9px; border-radius: var(--radius-sm);
  font-weight: 500;
}
.lever-popularity-chip .dot-icon {
  color: var(--primary); font-size: 8px; line-height: 1;
}

.lever-lift { text-align: right; flex-shrink: 0; }
.lever-lift-label {
  font-size: var(--text-xs); color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500;
}
.lever-lift-value {
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-2xl); font-weight: 600;
  color: var(--color-green-11);
  font-variant-numeric: tabular-nums;
  line-height: 1.1; margin-top: 2px;
}

.lever-payout {
  background: var(--color-blue-3);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  font-size: var(--text-base); color: var(--color-blue-12);
  display: flex; gap: 8px; align-items: flex-start;
  line-height: 1.5;
}
.lever-payout-icon { flex-shrink: 0; font-size: 16px; line-height: 1.3; }
.lever-payout-label { font-weight: 600; flex-shrink: 0; }
.lever-payout-text { flex: 1; }

.lever-stats {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 8px; align-items: stretch;
}
.lever-stat {
  text-align: center;
  background: var(--color-neutral-50);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.lever-stat-target {
  background: rgba(40, 100, 229, 0.06);
  border-color: rgba(40, 100, 229, 0.25);
}
.lever-stat .stat-label {
  font-size: var(--text-xs); color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 4px; font-weight: 500;
}
.lever-stat .stat-value {
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-lg); font-weight: 600;
  color: var(--foreground); font-variant-numeric: tabular-nums;
}
.lever-stat-target .stat-value { color: var(--primary); }
.lever-stat-arrow {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted-foreground); font-size: 16px;
}

.lever-why summary,
.lever-laggards summary {
  cursor: pointer; font-size: var(--text-sm);
  color: var(--primary); font-weight: 500;
  padding: 4px 0;
}
.lever-why summary:hover,
.lever-laggards summary:hover { color: var(--primary-hover); }
.lever-why p {
  margin: 8px 0 0 0; color: var(--muted-foreground);
  font-size: var(--text-base); line-height: 1.6;
}
.lever-laggards .data-table {
  margin-top: 10px; font-size: var(--text-sm);
}
.formula-caption {
  margin-top: 10px;
  background: var(--color-neutral-100);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px; font-size: var(--text-sm);
  color: var(--muted-foreground);
}
.formula-caption code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--color-white); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: var(--radius-sm);
  color: var(--foreground); font-size: 12px;
}
.data-table.compact th,
.data-table.compact td { padding: 7px 10px; }

/* ============================================================
   Period selector (used for Labor Efficiency by Tech & Category)
   ============================================================ */
.period-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin: 12px 0;
}
.period-pill {
  background: var(--color-white);
  color: var(--muted-foreground);
  border: 1px solid var(--color-neutral-600);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: var(--text-sm); font-weight: 500;
  cursor: pointer; user-select: none;
  font-family: inherit;
  transition: background-color .15s, color .15s, border-color .15s;
}
.period-pill:hover {
  border-color: var(--foreground);
  color: var(--foreground);
}
.period-pill.active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.custom-range {
  display: flex; align-items: center; gap: 8px;
  margin-left: 8px;
  background: var(--color-neutral-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 8px;
}
.custom-range[hidden] { display: none; }
.custom-range label {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--text-sm); color: var(--muted-foreground);
}
.custom-range input[type="date"] {
  border: 1px solid var(--input-border);
  background: var(--color-white);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-family: inherit; font-size: var(--text-sm);
  color: var(--foreground);
}
.period-summary {
  margin: 6px 0 12px 0;
  font-variant-numeric: tabular-nums;
}
.breakout-empty {
  background: var(--color-neutral-50);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 24px; text-align: center;
}
#breakout-table thead th[data-sort]:hover {
  background: var(--color-neutral-200);
}

/* ============================================================
   Labor Time Insights - speed-vs-team category pills
   ============================================================ */
.cat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; margin: 2px 4px 2px 0;
  border-radius: 999px; font-size: var(--text-xs);
  border: 1px solid var(--border);
  background: var(--color-neutral-100);
  white-space: nowrap;
}
.cat-pill strong {
  font-variant-numeric: tabular-nums; font-weight: 600;
}
.cat-pill.faster {
  background: var(--color-green-3); color: var(--color-green-11);
  border-color: rgba(26,163,65,0.25);
}
.cat-pill.faster strong { color: var(--color-green-11); }
.cat-pill.slower {
  background: var(--color-red-3); color: var(--color-red-11);
  border-color: rgba(214,59,52,0.25);
}
.cat-pill.slower strong { color: var(--color-red-11); }
.cat-pill.neutral { color: var(--muted-foreground); }

/* ============================================================
   Per-tech payouts table - the "investment" half of the ROI
   story. Lives at the bottom of the Recommended Incentive Plan.
   ============================================================ */
.payouts-card {
  background: linear-gradient(135deg, var(--color-white), var(--color-neutral-50));
  border-color: var(--border);
}
.payouts-card .card-header {
  align-items: flex-start;
}
.payouts-grand-total {
  text-align: right; flex-shrink: 0;
  background: var(--primary); color: var(--primary-foreground);
  padding: 12px 18px; border-radius: var(--radius-lg);
  min-width: 200px;
}
.payouts-grand-total .muted, .payouts-grand-total .small {
  color: rgba(255,255,255,0.85);
}
.payouts-grand-value {
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-2xl); font-weight: 700;
  margin-top: 4px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.payouts-table {
  width: 100%; margin-top: 4px;
}
.payouts-table thead th {
  background: var(--color-neutral-100);
  position: sticky; top: 0;
}
.payouts-table tbody tr:hover {
  background: var(--color-blue-3);
}
.payouts-table .muted { color: var(--color-neutral-700); }
.payouts-totals-row td {
  background: var(--color-neutral-100);
  border-top: 2px solid var(--border);
  border-bottom: none;
  font-size: var(--text-base);
}
.payouts-totals-row .grand-total-cell {
  color: var(--primary);
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-lg);
}
.payouts-formula {
  margin: 12px 0 0 0; padding-top: 10px;
  border-top: 1px dashed var(--border);
  color: var(--muted-foreground); font-size: var(--text-sm);
}
.payouts-formula code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--color-white); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: var(--radius-sm);
  color: var(--foreground); font-size: 12px;
}

@media (max-width: 760px) {
  .payouts-card .card-header { flex-direction: column; }
  .payouts-grand-total { width: 100%; min-width: 0; }
  .payouts-table { font-size: var(--text-xs); }
  .payouts-table thead th, .payouts-table td { padding: 6px 8px; }
}

/* ============================================================
   Takeaways - closing summary card at the very bottom
   ============================================================ */
.takeaways-card {
  background: linear-gradient(135deg, #f8faff, var(--color-blue-3));
  border: 1px solid rgba(40, 100, 229, 0.30);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  margin: 18px 0 28px 0;
  box-shadow: var(--shadow-card);
}
.takeaways-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px;
}
.takeaways-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--color-white);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.takeaways-header h2 {
  margin: 0;
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-xl); font-weight: 600;
}
.takeaways-body {
  display: flex; flex-direction: column; gap: 14px;
}
.takeaway {
  background: var(--color-white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
}
.takeaway-label {
  font-size: var(--text-sm); font-weight: 600;
  color: var(--primary);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.takeaway p {
  margin: 0; font-size: var(--text-base);
  color: var(--foreground); line-height: 1.6;
}
.takeaway p strong {
  color: var(--primary); font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.takeaways-footer {
  margin-top: 18px; text-align: right;
}

/* ============================================================
   Recommended additional levers - high-popularity metrics we
   can't compute from the connected data sources today.
   ============================================================ */
.additional-levers-card {
  background: var(--color-white);
  border: 1px dashed rgba(40, 100, 229, 0.35);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}
.additional-header {
  display: flex; gap: 14px; align-items: center;
  margin-bottom: 18px;
}
.additional-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--color-blue-3); border: 1px solid rgba(40,100,229,0.20);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.additional-header h3 {
  margin: 0; font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-xl); font-weight: 600;
}
.additional-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.additional-item {
  background: var(--color-neutral-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.additional-item-head {
  display: flex; align-items: baseline; gap: 8px;
}
.additional-pop {
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-lg); font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.additional-name {
  font-weight: 600; font-size: var(--text-base);
  color: var(--foreground); line-height: 1.3;
}
.additional-needs {
  font-size: var(--text-sm); color: var(--muted-foreground);
  line-height: 1.4;
}
.additional-needs strong { color: var(--foreground); font-weight: 600; }
.additional-why {
  font-size: var(--text-sm); color: var(--muted-foreground);
  line-height: 1.5; padding-top: 4px;
  border-top: 1px dashed var(--border);
}

/* ============================================================
   Team revenue tier - celebratory card
   ============================================================ */
.team-bonus-card {
  background: linear-gradient(135deg, #f8faff, var(--color-blue-3));
  border: 1px solid rgba(40,100,229,0.25);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}
.team-bonus-header {
  display: flex; gap: 14px; align-items: center;
  margin-bottom: 18px;
}
.team-bonus-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--color-white); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.team-bonus-header h3 {
  margin: 0; font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-xl); font-weight: 600;
}
.team-bonus-tiers {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr; gap: 12px;
}
.team-bonus-tier {
  background: var(--color-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.team-bonus-tier.tier-target {
  border: 2px solid var(--primary);
  background: var(--color-white);
}
.team-bonus-tier.tier-stretch {
  background: var(--primary); color: var(--primary-foreground);
  border-color: var(--primary);
}
.team-bonus-tier .tier-label {
  font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: 0.06em; font-weight: 500;
  color: var(--muted-foreground); margin-bottom: 6px;
}
.team-bonus-tier.tier-stretch .tier-label { color: rgba(255,255,255,0.85); }
.team-bonus-tier .tier-value {
  font-family: "Matter", "Inter", sans-serif;
  font-size: var(--text-2xl); font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1; margin-bottom: 6px;
}
.team-bonus-tier .tier-sub {
  font-size: var(--text-sm); line-height: 1.4; color: var(--muted-foreground);
}
.team-bonus-tier.tier-stretch .tier-sub { color: rgba(255,255,255,0.9); }
.team-bonus-why { margin-top: 16px; }
.team-bonus-why summary {
  cursor: pointer; font-size: var(--text-sm);
  color: var(--primary); font-weight: 500;
}
.team-bonus-why p {
  margin: 8px 0 0 0; color: var(--muted-foreground);
  font-size: var(--text-base); line-height: 1.6;
}

@media (max-width: 760px) {
  .lever-header { grid-template-columns: auto 1fr; }
  .lever-lift { grid-column: 1 / -1; text-align: left; }
  .lever-stats { grid-template-columns: 1fr 1fr 1fr; }
  .lever-stat-arrow { display: none; }
  .team-bonus-tiers { grid-template-columns: 1fr; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
  .roi-cards { grid-template-columns: repeat(2, 1fr); }
  .slider-grid { grid-template-columns: 1fr 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-2col { grid-template-columns: 1fr; }
}
