/* ============================================================
   gateway/static/css/app.css -- read-gateway web UI design system.

   Ported from close_web's design system (C:\Users\JustinNiederklein\code\
   .worktrees\qshape\close_web\static\css\app.css) so the gateway UI matches
   PBA's other Jinja/HTMX apps pixel-for-pixel on shared components (topbar,
   cards, chips, tables, buttons). Only the components this app actually
   uses are ported -- register-table/JE-comment/timeline/dropzone rules from
   the close_web donor are close_web-specific and intentionally omitted.
   Re-sync from the donor if it changes; do not fork the token values.
   ============================================================ */

:root {
  /* --- Raw brand palette (PBA brand standards) --- */
  --pba-blue: #0077C8;
  --pba-blue-deep: #004C82;
  --pba-blue-medium: #609FCA;
  --pba-blue-light: #B8D4E8;
  --pba-charcoal: #373F4C;
  --pba-slate: #8FA3B5;
  --pba-off-white: #F5F7FA;

  /* --- Header / nav: light frosted-glass bar --- */
  --header-glass: rgba(245, 247, 250, 0.92);
  --header-text: var(--pba-charcoal);
  --header-text-dim: #5C6673;
  --header-divider: var(--border-subtle, #DDE6EE);

  /* --- Semantic surface tokens --- */
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --surface-2: #F0F3F7;
  --border: #DDE6EE;
  --border-subtle: #DDE6EE;
  --border-strong: #C7D3DE;
  --text: var(--pba-charcoal);
  --text-muted: #5C6673;
  --accent: var(--pba-blue);
  --accent-deep: var(--pba-blue-deep);
  --accent-text-safe: #006CB5;
  --accent-soft: rgba(0, 119, 200, 0.08);
  --accent-border: rgba(0, 119, 200, 0.28);

  --status-success: #15803D;
  --status-success-bg: rgba(21, 128, 61, 0.09);
  --status-success-border: rgba(21, 128, 61, 0.30);
  --status-warning: #9A6B12;
  --status-warning-bg: rgba(232, 162, 59, 0.14);
  --status-warning-border: rgba(232, 162, 59, 0.40);
  --status-error: #A8322C;
  --status-error-bg: rgba(194, 76, 76, 0.12);
  --status-error-border: rgba(194, 76, 76, 0.38);
  --status-neutral: #5C6673;
  --status-neutral-bg: rgba(92, 102, 115, 0.10);
  --status-neutral-border: rgba(92, 102, 115, 0.28);

  --radius: 14px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-1: 0 1px 2px rgba(0, 76, 130, 0.05), 0 6px 20px rgba(0, 76, 130, 0.07);
  --shadow-2: 0 2px 4px rgba(0, 76, 130, 0.06), 0 14px 34px rgba(0, 76, 130, 0.13);

  --font-sans: "Poppins", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, "Segoe UI Mono", "Courier New", monospace;

  --lh-tight: 1.12;
  --lh-body: 1.65;
}

* { box-sizing: border-box; }
html { font-size: 16px; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: var(--lh-body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--text);
}

a { color: var(--accent-text-safe); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--font-mono); overflow-wrap: anywhere; }

/* ---------------------------------------------------------------
   Top bar (scrolls with the page; the engagements filter bar is the
   sticky element)
   --------------------------------------------------------------- */
.topbar {
  background: #FFFFFF;
  color: var(--header-text);
  border-bottom: 1px solid var(--header-divider);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  min-height: 64px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.25rem;
}
.brand {
  display: flex;
  align-items: center;
  color: var(--header-text);
  white-space: nowrap;
}
.brand img.brand-logo {
  width: 170px;
  max-width: 40vw;
  height: auto;
  display: block;
}
.brand-divider { width: 1px; height: 28px; background: var(--header-divider); }
.brand-sub {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--header-text-dim);
  white-space: nowrap;
}
.topnav { display: flex; gap: 0.25rem; margin-left: 0.75rem; }
.topnav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 0.875rem;
  color: var(--header-text);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: color 0.14s ease, background 0.14s ease;
}
.topnav a:hover { color: #005A97; background: #E8F2FA; text-decoration: none; }
.topnav a.active { color: #005A97; background: #E8F2FA; }
.whoami {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--header-text-dim);
  min-width: 0;
}
.whoami-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

/* ---------------------------------------------------------------
   Hero page-header band
   --------------------------------------------------------------- */
.hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin: 0 -2rem 1.75rem;
  padding: 2rem 2rem 2.1rem;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.hero-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-text-safe);
  margin-bottom: 0.6rem;
}
.hero h1 {
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--text);
  line-height: var(--lh-tight);
}
.hero-meta {
  margin-top: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.hero-meta strong { color: var(--text); font-weight: 600; }
.hero-meta .sep { opacity: 0.5; }
.hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }

/* ---------------------------------------------------------------
   Chips
   --------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.24rem 0.7rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip-success { background: var(--status-success-bg); color: var(--status-success); border-color: var(--status-success-border); }
.chip-warning { background: var(--status-warning-bg); color: var(--status-warning); border-color: var(--status-warning-border); }
.chip-error   { background: var(--status-error-bg);   color: var(--status-error);   border-color: var(--status-error-border); }
.chip-neutral { background: var(--status-neutral-bg); color: var(--status-neutral); border-color: var(--status-neutral-border); }

/* ---------------------------------------------------------------
   Cards + summary row
   --------------------------------------------------------------- */
.summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 1.3rem 1.4rem;
}
.stat-label {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
}
.stat-value {
  font-family: var(--font-sans);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}
.stat-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 1.5rem 1.6rem;
  margin-bottom: 1.6rem;
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-2); }
.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.card-title {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}
.card-note { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.75rem; line-height: var(--lh-body); }

/* Tool cards (catalog grid) */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 1.1rem 1.25rem;
}
.tool-name {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--pba-charcoal);
  word-break: break-word;
}
.tool-desc { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.5rem; }
.tool-params { margin-top: 0.7rem; }
.tool-params summary {
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-text-safe);
}
.tool-params pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem;
  font-size: 0.74rem;
  overflow-x: auto;
  margin-top: 0.5rem;
}

details.card-details { cursor: default; }
details.card-details > summary.card-title {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  user-select: none;
}
details.card-details > summary.card-title::-webkit-details-marker { display: none; }
details.card-details > summary.card-title::before {
  content: "\25B8";
  display: inline-block;
  font-size: 0.7rem;
  transition: transform 0.12s ease;
  color: var(--accent);
}
details.card-details[open] > summary.card-title::before { transform: rotate(90deg); }

/* ---------------------------------------------------------------
   Banners
   --------------------------------------------------------------- */
.banner {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 1.1rem 1.35rem;
  margin-bottom: 1.6rem;
  font-size: 0.88rem;
  box-shadow: var(--shadow-1);
}
.banner-glyph { font-size: 1.15rem; line-height: 1.3; }
.banner-body strong { display: block; margin-bottom: 0.2rem; font-size: 0.9rem; }
.banner-body p { margin: 0; color: var(--text-muted); }
.banner-warning { background: var(--status-warning-bg); border-color: var(--status-warning-border); }
.banner-warning strong { color: var(--status-warning); }
.banner-error { background: var(--status-error-bg); border-color: var(--status-error-border); }
.banner-error strong { color: var(--status-error); }
.banner-success { background: var(--status-success-bg); border-color: var(--status-success-border); }
.banner-success strong { color: var(--status-success); }

/* ---------------------------------------------------------------
   Tables
   --------------------------------------------------------------- */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  margin-bottom: 1.6rem;
}
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.87rem; }
.table-card table { margin: 0; }
thead th {
  text-align: left;
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 0.65rem 0.95rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
.table-card table tbody tr:nth-child(even) td { background: var(--surface-2); }
.table-card table tbody tr:hover td { background: var(--accent-soft); }
td.mono, th.mono { font-family: var(--font-mono); font-size: 0.8rem; }
td.muted { color: var(--text-muted); }

/* ---------------------------------------------------------------
   Empty state
   --------------------------------------------------------------- */
.empty-state {
  border: 1px dashed var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2.4rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}
.empty-state-glyph { font-size: 1.7rem; opacity: 0.5; margin-bottom: 0.5rem; }

/* ---------------------------------------------------------------
   Buttons + forms
   --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 500;
  color: #FFFFFF;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  padding: 0.55rem 1.2rem;
  cursor: pointer;
  transition: background 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}
.btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 76, 130, 0.2); text-decoration: none; }
.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); transform: none; box-shadow: none; }
.btn-xs { font-size: 0.7rem; padding: 0.24rem 0.7rem; }
.copy-path-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.copy-path-row code { word-break: break-all; }

.form-card label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 0.9rem;
}
.form-card input[type=text],
.form-card input[type=password],
.form-card select {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.form-card input:focus, .form-card select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------------------------------------------------------------
   Section utility + code blocks (connect page)
   --------------------------------------------------------------- */
.section-title {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.9rem;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
/* /connect: one row per source the client has (the same list the engagements page shows). */
.cn-sources { display: flex; flex-direction: column; gap: 0.5rem; margin: 0 0 0.25rem; padding: 0; list-style: none; }
.cn-source { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem 0.625rem; font-size: 0.875rem; font-weight: 500; color: var(--text); }
.cn-source-note { font-size: 0.8125rem; font-weight: 300; color: var(--text-muted); }
.code-block {
  position: relative;
  background: var(--pba-charcoal);
  color: #E7EEF5;
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  overflow-x: auto;
  margin: 0.75rem 0 1.2rem;
}
.code-block .copy-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.6rem;
}
.vendor-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-text-safe);
  border: 1px solid var(--accent-border);
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}
.vendor-pill:hover {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent-deep);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 76, 130, 0.18);
  text-decoration: none;
}

.back-link {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: 1rem 0 -0.5rem;
}
.back-link:hover { color: var(--accent-text-safe); text-decoration: none; }

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */
@media (max-width: 720px) {
  .topbar-inner { padding: 0.5rem 1rem; gap: 0.5rem 0.75rem; }
  .topnav { margin-left: 0; }
  .whoami { margin-left: 0; width: 100%; justify-content: space-between; }
  main { padding: 0 1rem 3rem; }
  .hero { margin: 0 -1rem 1.35rem; padding: 1.5rem 1.25rem 1.7rem; }
  .hero h1 { font-size: 1.55rem; }
  .brand img.brand-logo { width: 140px; }
}

/* -- Sign-in button ------------------------------------------------------- */
.btn-signin {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  background: var(--pba-blue);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-signin:hover { background: var(--pba-blue-deep); }

/* -- Sign-out link in nav ------------------------------------------------- */
.whoami-logout {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #0068AF;
}
.whoami-logout:hover { color: var(--accent-deep); }

/* ---------------------------------------------------------------
   Engagements page (index.html) + shared utilities
   --------------------------------------------------------------- */
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.eng {
  --eng-border: #E3E7ED;
  --eng-line: #D5DBE3;
  --eng-heading: #2A303A;
  --eng-muted: #5B6472;
  --eng-link: #0068AF;
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.eng :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.eng-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.eng-eyebrow { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--eng-link); margin-bottom: 0.4rem; }
.eng-head h1 { margin: 0; font-size: 1.875rem; font-weight: 600; color: var(--eng-heading); }
.eng-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1.25rem;
  border-radius: 10px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 0.875rem;
  font-weight: 600;
}
.eng-primary:hover { background: var(--accent-deep); text-decoration: none; }

.eng-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; }
.eng-stat {
  background: #FFFFFF;
  border: 1px solid var(--eng-border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.eng-stat-label { font-size: 0.8125rem; color: var(--eng-muted); }
.eng-stat-value { font-size: 1.75rem; font-weight: 600; line-height: 1.3; color: var(--eng-heading); }
.eng-stat-sub { font-size: 0.875rem; font-weight: 400; color: var(--eng-muted); }
.eng-accent { color: var(--accent); }
.eng-source-counts { display: flex; flex-wrap: wrap; gap: 0.5rem 0.875rem; margin-top: 0.4rem; font-size: 0.8125rem; }
.eng-source-count { display: inline-flex; align-items: center; gap: 0.375rem; }
.eng-source-count strong { font-weight: 600; color: var(--eng-heading); }

/* Source tile: vendor logo when one ships, else a letter. */
.vtile {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #373F4C;
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
}
/* Every tile is the same 30px square. A logo is fitted inside it (the img box is
   square and an SVG scales to fit, so a wide wordmark ends up short, not wide). */
.vtile-logo { background: #FFFFFF; border: 1px solid var(--eng-border); }
.vtile-logo img { width: 24px; height: 24px; display: block; }

/* Search + filter chips; stick to the top of the viewport while the list scrolls. */
.eng-filters {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--bg);
  padding: 0.75rem 0;
}
.eng-search { position: relative; flex: 1 1 240px; max-width: 380px; display: block; }
.eng-search svg { position: absolute; left: 14px; top: 13px; color: #7A8290; pointer-events: none; }
.eng-search input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--eng-line);
  border-radius: 10px;
  background: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--eng-heading);
}
.eng-search input::placeholder { color: #7A8290; }
.eng-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.eng-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0 0.875rem;
  border-radius: 999px;
  border: 1px solid var(--eng-line);
  background: #FFFFFF;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}
.eng-chip span { font-size: 0.75rem; color: var(--eng-muted); }
.eng-chip.is-selected { background: #373F4C; border-color: #373F4C; color: #FFFFFF; }
.eng-chip.is-selected span { color: #FFFFFF; opacity: 0.8; }

/* Client rows: client | sources | chevron. */
.eng-cols,
.eng-row { display: grid; grid-template-columns: minmax(0, 1fr) 210px 40px; column-gap: 1rem; align-items: center; }
.eng-cols {
  padding: 0 1.3125rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--eng-muted);
  margin-bottom: -0.75rem;
}
.eng-list { display: flex; flex-direction: column; gap: 0.75rem; }
.eng-group {
  background: #EEF1F5;
  border: 1px solid var(--eng-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.eng-group-head { display: flex; align-items: center; gap: 0.625rem; padding: 0.625rem 1.25rem; background: #FAFBFC; color: var(--eng-muted); }
.eng-group-head h2 { margin: 0; font-size: 0.8125rem; font-weight: 600; color: var(--eng-heading); line-height: 1.4; }
.eng-group-head span { font-size: 0.75rem; }
.eng-row { position: relative; padding: 0.75rem 1.25rem; background: #FFFFFF; }
.eng-row:hover { background: #FAFBFC; }
.eng-client { display: flex; align-items: center; gap: 0.875rem; min-width: 0; }
.av {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
}
.av-tint-0 { background: #E8F2FA; color: #005A97; }
.av-tint-1 { background: #E7F3EC; color: #1F6B45; }
.av-tint-2 { background: #F5EDE3; color: #7A4E1D; }
.av-tint-3 { background: #EFEAF6; color: #5B3F8C; }
.av-tint-4 { background: #E9EEF3; color: #373F4C; }
.av-tint-5 { background: #F6E9E9; color: #8C3434; }
.eng-id { min-width: 0; display: flex; flex-direction: column; }
.eng-name { font-size: 0.9375rem; font-weight: 600; line-height: 1.35; color: var(--eng-heading); overflow-wrap: anywhere; }
.eng-name:hover { color: var(--eng-link); text-decoration: none; }
/* Stretched link: the whole row opens the client; the copy button, source
   tiles and chevron sit above it. */
.eng-name::after { content: ""; position: absolute; inset: 0; }
.eng-code,
.eng-vendors,
.eng-chev { position: relative; z-index: 1; }
.eng-code {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 24px;
  padding: 0 6px;
  margin-left: -6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--eng-muted);
  cursor: pointer;
}
/* Extends the hit area to 40px, within the row's padding (the group clips
   anything past it); the 4px over the name sits on the row-wide stretched link. */
.eng-code::after { content: ""; position: absolute; inset: -4px -8px -12px; }
.eng-code:hover { background: var(--surface-2); }
.eng-code.is-copied .eng-code-text { font-family: var(--font-sans); color: #1F7A4D; }
.eng-vendors { display: flex; flex-wrap: wrap; gap: 6px; }
.eng-chev { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; color: #7A8290; }
.eng-chev:hover { color: var(--eng-link); }

.eng-empty {
  background: #FFFFFF;
  border: 1px dashed var(--eng-line);
  border-radius: 12px;
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}
.eng-empty-title { font-size: 1rem; font-weight: 600; color: var(--eng-heading); }
.eng-clear {
  min-height: 40px;
  padding: 0 1rem;
  border-radius: 8px;
  border: 1px solid var(--eng-line);
  background: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

@media (max-width: 720px) {
  .eng { padding-top: 1.25rem; }
  .eng-head h1 { font-size: 1.5rem; }
  .eng-cols { display: none; }
  .eng-row {
    grid-template-columns: minmax(0, 1fr) 40px;
    grid-template-areas: "client chev" "vendors vendors";
    row-gap: 0.5rem;
    padding: 0.75rem 0.875rem;
  }
  .eng-client { grid-area: client; }
  .eng-chev { grid-area: chev; }
  .eng-vendors { grid-area: vendors; padding-left: 54px; }
  .eng-search { max-width: none; }
}

/* ---------------------------------------------------------------
   Client detail page (client_detail.html)
   --------------------------------------------------------------- */
.cd-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 0.375rem; min-height: 40px; font-size: 0.8125rem; font-weight: 500; color: var(--eng-link); }
.cd-head { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.av-lg { width: 64px; height: 64px; border-radius: 14px; font-size: 1.375rem; }
.cd-title { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.cd-title h1 { margin: 0; font-size: 1.75rem; font-weight: 600; color: var(--eng-heading); overflow-wrap: anywhere; }
.cd-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0 0.875rem; font-size: 0.8125rem; color: var(--eng-muted); }
.cd-meta strong { font-weight: 500; color: var(--eng-heading); }
.cd-dot { width: 4px; height: 4px; border-radius: 50%; background: #B5BCC6; }
.cd-code {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 40px;
  padding: 0 0.625rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}
.cd-code:hover { background: var(--surface-2); }
.cd-code.is-copied [data-copy-label] { font-family: var(--font-sans); color: #1F7A4D; }

.cd-add { position: relative; margin-left: auto; }
.cd-add > summary { list-style: none; cursor: pointer; }
.cd-add > summary::-webkit-details-marker { display: none; }
.cd-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 6;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  background: #FFFFFF;
  border: 1px solid var(--eng-border);
  border-radius: 12px;
  box-shadow: var(--shadow-2);
}
.cd-menu p { margin: 0; padding: 0.25rem 0.5rem 0.5rem; font-size: 0.75rem; line-height: 1.5; color: var(--eng-muted); }
.cd-menu a { display: flex; align-items: center; gap: 0.625rem; min-height: 44px; padding: 0 0.5rem; border-radius: 8px; font-size: 0.875rem; font-weight: 500; color: var(--eng-heading); }
.cd-menu a:hover { background: var(--surface-2); text-decoration: none; }

.cd-stats { grid-template-columns: repeat(auto-fit, minmax(180px, 220px)); }

.cd-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 0.75rem; align-items: start; }
.cd-panel { min-width: 0; display: flex; flex-direction: column; gap: 0.75rem; padding: 1.125rem 1.25rem; background: #FFFFFF; border: 1px solid var(--eng-border); border-radius: 12px; }
.cd-panel h2 { margin: 0; font-size: 0.875rem; font-weight: 600; color: var(--eng-heading); }
.cd-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
/* 40px hit area, pulled back so the row stays as tall as the heading. */
.cd-panel-head a { display: inline-flex; align-items: center; min-height: 40px; margin: -10px 0; padding: 0 0.25rem; font-size: 0.75rem; font-weight: 500; color: var(--eng-link); }
.cd-note { margin: 0; font-size: 0.75rem; line-height: 1.5; color: var(--eng-muted); }
.cd-fields { display: flex; flex-direction: column; gap: 0.5rem; }
.cd-field { display: flex; align-items: center; justify-content: space-between; gap: 0.625rem; padding: 0.5rem 0.75rem; border-radius: 8px; background: var(--bg); }
.cd-field > div { min-width: 0; display: flex; flex-direction: column; }
.cd-field-label { font-size: 0.6875rem; color: var(--eng-muted); }
.cd-field code { font-size: 0.8125rem; color: var(--eng-heading); }
.cd-copy {
  flex: none;
  min-width: 64px;
  min-height: 40px;
  padding: 0 0.75rem;
  border: 1px solid var(--eng-line);
  border-radius: 8px;
  background: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}
.cd-copy.is-copied { color: #1F7A4D; }
.cd-links { display: flex; flex-direction: column; gap: 0.25rem; }
.cd-link { display: flex; align-items: center; gap: 0.625rem; min-height: 44px; padding: 0 0.5rem; margin: 0 -0.5rem; border-radius: 8px; font-size: 0.8125rem; color: var(--eng-heading); }
.cd-link:hover { background: var(--bg); text-decoration: none; }
.cd-link svg { flex: none; color: #7A8290; }
.cd-link-mark { flex: none; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 7px; background: var(--bg); font-size: 0.625rem; font-weight: 600; color: var(--eng-muted); }
.cd-link-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.cd-link-text > span:first-child { font-weight: 500; }
.cd-link-sub { font-size: 0.6875rem; color: var(--eng-muted); }

.cd-sources { display: flex; flex-direction: column; gap: 0.75rem; }
.cd-sources > h2 { margin: 0; font-size: 1.125rem; font-weight: 600; color: var(--eng-heading); }
.cd-source { display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem; background: #FFFFFF; border: 1px solid var(--eng-border); border-radius: 12px; }
.cd-source-head { display: flex; align-items: center; gap: 0.875rem; }
.cd-source-id { display: flex; flex-direction: column; min-width: 0; }
.cd-source-id h3 { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.3; color: var(--eng-heading); }
.cd-source-count { font-size: 0.8125rem; color: var(--eng-muted); }
.cd-tools { display: flex; flex-direction: column; gap: 0.25rem; padding-top: 0.875rem; border-top: 1px solid #EEF1F5; }
.cd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-chip { padding: 4px 9px; border-radius: 6px; background: var(--bg); font-size: 0.6875rem; line-height: 1.5; color: var(--text); }
.cd-toggle { align-self: flex-start; min-height: 40px; padding: 0; border: 0; background: transparent; font-family: var(--font-sans); font-size: 0.8125rem; font-weight: 500; color: var(--eng-link); cursor: pointer; }

@media (max-width: 720px) {
  .cd-title h1 { font-size: 1.5rem; }
  .cd-menu { max-width: calc(100vw - 2rem); }
  .cd-source { padding: 1rem; }
}

/* ---------------------------------------------------------------
   Guide page (guide.html)
   --------------------------------------------------------------- */
.gd { max-width: 860px; margin: 0 auto; gap: 2.25rem; }
.gd-intro { display: flex; flex-direction: column; gap: 0.25rem; }
.gd-intro h1 { margin: 0; font-size: 1.875rem; font-weight: 600; line-height: 1.25; color: var(--eng-heading); }
.gd-lede { margin: 0.375rem 0 0; max-width: 40rem; font-size: 0.9375rem; line-height: 1.6; color: var(--eng-muted); }
.gd-section { display: flex; flex-direction: column; gap: 0.875rem; }
.gd-section > h2 { margin: 0; font-size: 1.125rem; font-weight: 600; color: var(--eng-heading); }
.gd code { padding: 1px 6px; border-radius: 4px; background: var(--bg); font-size: 0.75rem; }

.gd-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.625rem; }
.gd-step { display: flex; gap: 1rem; padding: 1rem 1.125rem; background: #FFFFFF; border: 1px solid var(--eng-border); border-radius: 12px; }
.gd-num { flex: none; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent); color: #FFFFFF; font-size: 0.8125rem; font-weight: 600; }
.gd-step > div { min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.gd-step-title { font-size: 0.9375rem; font-weight: 600; color: var(--eng-heading); }
.gd-step-text { font-size: 0.8125rem; line-height: 1.55; color: var(--eng-muted); }

.gd-prompts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 0.625rem; }
.gd-prompt { min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; padding: 0.875rem 1rem; background: #FFFFFF; border: 1px solid var(--eng-border); border-radius: 10px; }
.gd-hint { margin: 0; font-size: 0.8125rem; line-height: 1.55; color: var(--eng-muted); }
.gd-tag { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; color: var(--eng-muted); }
.gd-prompt-text { font-size: 0.875rem; line-height: 1.5; color: var(--eng-heading); overflow-wrap: anywhere; }

.gd-sources { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; overflow: hidden; background: #FFFFFF; border: 1px solid var(--eng-border); border-radius: 12px; }
.gd-source { display: flex; align-items: flex-start; gap: 0.875rem; padding: 0.875rem 1.125rem; }
.gd-source + .gd-source { border-top: 1px solid #EEF1F5; }
.gd-source-text { min-width: 0; display: flex; flex-direction: column; gap: 0.125rem; }
.gd-source-name { font-size: 0.875rem; font-weight: 600; color: var(--eng-heading); }
.gd-source-n { font-weight: 400; color: var(--eng-muted); }
.gd-source-desc { font-size: 0.8125rem; line-height: 1.5; color: var(--eng-muted); }

.gd-notes { display: flex; flex-direction: column; gap: 0.5rem; }
.gd-note { display: flex; gap: 0.75rem; padding: 0.875rem 1rem; background: #FFFFFF; border: 1px solid var(--eng-border); border-radius: 10px; }
.gd-note h3 { flex: none; width: 8.5rem; margin: 0; font-size: 0.8125rem; font-weight: 600; line-height: 1.55; color: var(--eng-heading); }
.gd-note p { margin: 0; font-size: 0.8125rem; line-height: 1.55; color: var(--text); }

@media (max-width: 720px) {
  .gd { gap: 1.75rem; }
  .gd-intro h1 { font-size: 1.5rem; }
  .gd-note { flex-direction: column; gap: 0.25rem; }
  .gd-note h3 { width: auto; }
}
