/* =====================================================================
   COMPETITIVE RANGE — Brand Stylesheet
   Derived from the CRS 2013 Brand Style Guide:
   • Primary red #EF3E42 (Pantone 180) + 75/50/25% tints
   • Pure black #000000 + grey tints
   • Display: Univers 63 Bold Extended  →  Barlow Condensed (uppercase, condensed bold)
   • Body: Avenir Book  →  Inter (light/regular, generous line-height)
   • Motifs: thin black rule under every section title; bracket-frame accents;
     generous negative space; red used only for accent/CTA/alert.
   ===================================================================== */

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

:root {
  /* Brand primary */
  --crs-red:         #EF3E42;
  --crs-red-75:      #F36E71;
  --crs-red-50:      #F79EA1;
  --crs-red-25:      #FBCFD0;
  --crs-red-soft:    #FCE8E9;  /* alerts/bg wash */

  /* Neutrals */
  --crs-black:       #0A0A0A;
  --crs-ink:         #111318;
  --crs-grey-75:     #4A4D55;
  --crs-grey-50:     #8B8E96;
  --crs-grey-25:     #C8CACD;
  --crs-line:        #DDDEE2;  /* slightly stronger hairline so it still reads on the light-grey canvas */
  --crs-bg-soft:     #EEEFF2;  /* deeper wash for hovers / secondary surfaces */
  --crs-canvas:      #F2F3F5;  /* NEW — light-grey page canvas */
  --crs-white:       #FFFFFF;

  /* Semantic */
  --crs-text:        var(--crs-ink);
  --crs-text-muted:  var(--crs-grey-75);
  --crs-text-faint:  var(--crs-grey-50);
  --crs-bg:          var(--crs-canvas);   /* page background — lighter, less clinical */
  --crs-surface:     var(--crs-white);    /* cards / panels stay white so they lift */
  --crs-surface-2:   var(--crs-bg-soft);
  --crs-border:      var(--crs-line);
  --crs-border-strong: var(--crs-grey-75);

  /* Type */
  --font-display: "Barlow Condensed", "Oswald", "Helvetica Neue", Arial, sans-serif;
  --font-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Rhythm */
  --radius-sm: 2px;
  --radius:    4px;
  --radius-lg: 6px;
  --shadow-card: 0 1px 2px rgba(10,10,10,0.04), 0 1px 1px rgba(10,10,10,0.03);
  --shadow-lift: 0 2px 10px rgba(10,10,10,0.06), 0 1px 3px rgba(10,10,10,0.04);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--crs-bg);
  color: var(--crs-text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
  margin: 0;
  color: var(--crs-black);
}
.crs-display {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Page title + underline rule = direct lift from style-guide section headers */
.crs-page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--crs-black);
  margin: 0 0 6px;
}
.crs-page-subtitle {
  color: var(--crs-text-muted);
  font-size: 13.5px;
  margin: 0 0 12px;
  line-height: 1.55;
}
.crs-rule {
  height: 1px;
  background: var(--crs-black);
  border: 0;
  margin: 0 0 24px;
}
.crs-rule-thin { background: var(--crs-line); }
.crs-rule-red  { background: var(--crs-red); height: 2px; }

/* Links */
a {
  color: var(--crs-red);
  text-decoration: none;
  transition: color 0.15s var(--ease);
}
a:hover { color: var(--crs-black); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* Buttons */
button, .crs-btn {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border: 1px solid var(--crs-black);
  border-radius: var(--radius);
  background: var(--crs-black);
  color: var(--crs-white);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: transform 0.12s var(--ease), background 0.12s var(--ease), color 0.12s var(--ease), border-color 0.12s var(--ease);
  font-kerning: normal;
}
button:hover, .crs-btn:hover { background: var(--crs-red); border-color: var(--crs-red); color: var(--crs-white); }
button:active, .crs-btn:active { transform: translateY(1px); }
button:focus-visible, .crs-btn:focus-visible { outline: 2px solid var(--crs-red); outline-offset: 2px; }

.crs-btn-primary { background: var(--crs-red); border-color: var(--crs-red); }
.crs-btn-primary:hover { background: var(--crs-black); border-color: var(--crs-black); }

.crs-btn-ghost,
button.secondary {
  background: transparent;
  color: var(--crs-black);
  border: 1px solid var(--crs-grey-25);
}
.crs-btn-ghost:hover,
button.secondary:hover { background: var(--crs-black); color: var(--crs-white); border-color: var(--crs-black); }

/* Scoped override: ghost buttons inside dark brand bar use inverted colors for legibility */
.crs-brand-bar button.secondary,
.crs-brand-bar .crs-btn-ghost {
  color: var(--crs-white);
  border-color: var(--crs-grey-50);
  background: transparent;
}
.crs-brand-bar button.secondary:hover,
.crs-brand-bar .crs-btn-ghost:hover {
  background: var(--crs-white);
  color: var(--crs-black);
  border-color: var(--crs-white);
}
.crs-brand-bar a { color: var(--crs-white); text-decoration: none; }
.crs-brand-bar a:hover { color: var(--crs-red); }

button.danger, .crs-btn-danger {
  background: var(--crs-white);
  color: var(--crs-red);
  border-color: var(--crs-red);
}
button.danger:hover, .crs-btn-danger:hover { background: var(--crs-red); color: var(--crs-white); }

button[disabled], .crs-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* Form fields */
input[type=text], input[type=password], input[type=email], input[type=search], select, textarea {
  font-family: var(--font-body);
  font-size: 13.5px;
  padding: 9px 12px;
  border: 1px solid var(--crs-grey-25);
  border-radius: var(--radius);
  background: var(--crs-white);
  color: var(--crs-text);
  width: 100%;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--crs-black);
  box-shadow: 0 0 0 3px rgba(239, 62, 66, 0.12);
}
::placeholder { color: var(--crs-text-faint); opacity: 1; }

label {
  display: block;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--crs-grey-75);
  margin: 0 0 6px;
}

/* Cards / panels */
.crs-panel, .panel, section.panel {
  background: var(--crs-surface);
  border: 1px solid var(--crs-border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin: 0 0 18px;
  box-shadow: var(--shadow-card);
}
.crs-panel h2, section.panel h2 {
  font-family: var(--font-display);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--crs-black);
  margin: 0 0 4px;
  font-weight: 700;
}
.crs-panel h3, section.panel h3 {
  font-family: var(--font-display);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--crs-black);
  margin: 0 0 10px;
  font-weight: 700;
}
.crs-panel .hint, section.panel .hint {
  color: var(--crs-text-muted);
  font-size: 12.5px;
  margin: 0 0 14px;
  line-height: 1.55;
}

/* Bracket-frame accent panel — echoes the logo lockup */
.crs-bracket {
  position: relative;
  padding: 24px 28px;
  border: 0;
}
.crs-bracket::before, .crs-bracket::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid var(--crs-black);
}
.crs-bracket::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.crs-bracket::after  { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* KPI card */
.kpis { display: grid; gap: 14px; }
.kpi {
  background: var(--crs-white);
  border: 1px solid var(--crs-border);
  border-top: 3px solid var(--crs-black);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  transition: border-top-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.kpi:hover { border-top-color: var(--crs-red); transform: translateY(-1px); }
.kpi .label {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--crs-grey-75);
}
.kpi .value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--crs-black);
  margin-top: 4px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi .sub { color: var(--crs-text-muted); font-size: 12px; margin-top: 4px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  padding: 11px 12px;
  background: transparent;
  color: var(--crs-grey-75);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--crs-black);
}
tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--crs-line);
  vertical-align: top;
}
tbody tr { transition: background 0.12s var(--ease); }
tbody tr:hover { background: var(--crs-bg-soft); }
td.money, .money {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  text-align: right;
  color: var(--crs-black);
  font-weight: 500;
  white-space: nowrap;
}
td.rank, .rank {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--crs-grey-50);
  width: 30px;
  text-align: center;
}

/* Pills & chips */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 2px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--crs-bg-soft);
  color: var(--crs-grey-75);
  border: 1px solid var(--crs-grey-25);
  font-family: var(--font-display);
}
.pill.admin    { background: var(--crs-black); color: var(--crs-white); border-color: var(--crs-black); }
.pill.active   { background: var(--crs-white); color: #0a7e32; border-color: #0a7e32; }
.pill.suspended{ background: var(--crs-red-soft); color: var(--crs-red); border-color: var(--crs-red); }
.pill.prime    { background: var(--crs-black); color: var(--crs-white); border-color: var(--crs-black); }
.pill.sub      { background: var(--crs-white); color: var(--crs-black); border-color: var(--crs-black); }

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 500;
  background: var(--crs-bg-soft);
  color: var(--crs-grey-75);
  border: 1px solid var(--crs-line);
  margin-right: 4px;
  margin-bottom: 3px;
}
.chip.set-aside { background: var(--crs-black); color: var(--crs-white); border-color: var(--crs-black); }
.chip.warn      { background: #FFF6E6; color: #8A5A00; border-color: #F0C060; }
.chip.danger    { background: var(--crs-red-soft); color: var(--crs-red); border-color: var(--crs-red); }
.chip.naics     { background: var(--crs-white); color: var(--crs-grey-75); font-family: var(--font-mono); font-size: 11px; }

/* Alerts */
.crs-alert { padding: 12px 14px; border-radius: var(--radius); font-size: 13px; border: 1px solid transparent; }
.crs-alert.danger, .err { background: var(--crs-red-soft); border-color: var(--crs-red); color: var(--crs-red); }
.crs-alert.ok { background: #E8F7EC; border-color: #0a7e32; color: #0a7e32; }
.muted { color: var(--crs-text-muted); }

/* Muted code inline */
code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--crs-bg-soft);
  border: 1px solid var(--crs-line);
  padding: 1px 6px;
  border-radius: 2px;
  color: var(--crs-ink);
}

/* ---------- Global app shell ---------- */
.crs-brand-bar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--crs-black);
  color: var(--crs-white);
  font-size: 12px;
}
.crs-brand-bar .lockup { display: flex; align-items: center; gap: 10px; }
.crs-brand-bar .lockup img { height: 28px; width: auto; display: block; }
/* Full shield+wordmark logo — taller lockup needs a bit more height and a thin right divider-less layout */
.crs-brand-bar .lockup img.brand-logo { height: 40px; width: auto; display: block; }
.crs-brand-bar .lockup img.brand-logo[src*="fullmark"] { image-rendering: -webkit-optimize-contrast; }
.crs-brand-bar .lockup .wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 14px;
  line-height: 1;
}
.crs-brand-bar .lockup .wordmark .red { color: var(--crs-red); }
.crs-brand-bar .lockup .product {
  color: var(--crs-grey-25);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-left: 1px solid var(--crs-grey-75);
  padding-left: 10px;
  margin-left: 2px;
  font-family: var(--font-display);
}
.crs-brand-bar .user-block { display: flex; align-items: center; gap: 14px; }
.crs-brand-bar a { color: var(--crs-white); opacity: 0.8; }
.crs-brand-bar a:hover { color: var(--crs-red); opacity: 1; text-decoration: none; }
.crs-brand-bar .pill-admin {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--crs-red);
  color: var(--crs-red);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10px;
  font-weight: 700;
  border-radius: 2px;
  margin-left: 6px;
}
.crs-brand-bar .user-name { font-weight: 600; color: var(--crs-white); }

/* Secondary tab bar — brand-aligned */
.crs-tabs {
  display: flex;
  gap: 0;
  padding: 0 24px;
  background: var(--crs-white);
  border-bottom: 1px solid var(--crs-black);
  overflow-x: auto;
  scrollbar-width: thin;
  position: sticky;
  top: 0;
  z-index: 20;
}
.crs-tabs button, nav.tabs button {
  all: unset;
  cursor: pointer;
  padding: 14px 18px;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--crs-grey-75);
  border-bottom: 3px solid transparent;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
  white-space: nowrap;
}
.crs-tabs button:hover, nav.tabs button:hover { color: var(--crs-black); }
.crs-tabs button.active, nav.tabs button.active {
  color: var(--crs-black);
  border-bottom-color: var(--crs-red);
}

/* Page header pattern */
.crs-page-header {
  padding: 28px 24px 14px;
  background: var(--crs-white);
  border-bottom: 0;
}
.crs-page-header .title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.crs-page-header .stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--crs-grey-75);
  padding: 4px 10px;
  border: 1px solid var(--crs-grey-25);
  border-radius: 2px;
}
.crs-page-header .stamp::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--crs-red);
  display: inline-block;
  animation: crs-pulse 2.4s var(--ease) infinite;
}
@keyframes crs-pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }

/* Footer */
.crs-footer {
  padding: 28px 24px 40px;
  border-top: 1px solid var(--crs-line);
  margin-top: 40px;
  background: var(--crs-white);
  color: var(--crs-text-muted);
  font-size: 12px;
}
.crs-footer .lockup { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.crs-footer .lockup img { height: 24px; }
.crs-footer .lockup img.brand-logo { height: 36px; width: auto; display: block; }
.crs-footer .lockup .wordmark { font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--crs-black); }
.crs-footer .lockup .wordmark .red { color: var(--crs-red); }

/* Utility */
.crs-stack-sm > * + * { margin-top: 8px; }
.crs-stack > * + * { margin-top: 14px; }
.crs-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.crs-spacer { flex: 1; }
.crs-empty { color: var(--crs-text-muted); text-align: center; padding: 32px 16px; font-size: 13px; }

/* Bar in-table indicator (e.g. agency spend bars) */
.crs-bar { height: 4px; background: var(--crs-line); border-radius: 2px; overflow: hidden; width: 90px; display: inline-block; vertical-align: middle; margin-left: 8px; }
.crs-bar > span { display: block; height: 100%; background: var(--crs-black); }
.crs-bar.red > span { background: var(--crs-red); }

/* Responsive */
@media (max-width: 760px) {
  .crs-brand-bar { padding: 8px 14px; flex-wrap: nowrap; gap: 10px; }
  .crs-brand-bar .product { display: none; }
  .crs-brand-bar .lockup .wordmark .word { display: none; }
  .crs-brand-bar .user-block { gap: 10px; font-size: 11px; }
  .crs-brand-bar .user-name { display: none; }
  .crs-brand-bar .nav-link-intel,
  .crs-brand-bar .nav-link-signed-in { display: none; }
  /* Hide decorative ADMIN pill on mobile — the Admin link already conveys admin access */
  .crs-brand-bar .pill-admin { display: none !important; }
  .crs-brand-bar a { font-size: 11.5px; padding: 6px 2px; min-height: 32px; display: inline-flex; align-items: center; }
  .crs-brand-bar button.secondary { padding: 6px 10px; font-size: 11px; min-height: 32px; }
  .crs-page-header { padding: 20px 14px 10px; }
  .crs-page-title { font-size: 22px; }
  .crs-panel, .panel, section.panel { padding: 16px; }
  main { padding-left: 14px !important; padding-right: 14px !important; }
  .crs-tabs { padding: 0 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .crs-tabs button { padding: 12px 12px; font-size: 11.5px; flex-shrink: 0; min-height: 44px; }
  /* Tables — allow wrapping and keep amounts from overlapping names */
  .crs-table, .panel table { font-size: 12px; }
  .crs-table td, .panel table td, .crs-table th, .panel table th { padding: 8px 6px; }
  /* Inputs/selects — larger tap targets */
  input[type=text], input[type=search], input[type=password], select, textarea { min-height: 40px; font-size: 14px; }
  button { min-height: 40px; }
  .link-btn { min-height: 32px; padding: 4px 8px !important; }
}

/* Print */
@media print {
  .crs-brand-bar, .crs-tabs, .crs-footer, button { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: none; }
}
