/* ==========================================================================
   Vaimo BidPilot — Brand Design System
   Brand Guidelines 2025
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Libre+Franklin:ital,wght@0,300;0,400;0,500;0,600;1,300&family=Caveat:wght@400;500;600&display=swap');

/* --------------------------------------------------------------------------
   1. Brand Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Vaimo official palette */
  --vaimo-yellow:      #F5B000;
  --vaimo-line:        #FABF2B;
  --vaimo-jet:         #333333;
  --vaimo-light-grey:  #D8D8D8;
  --vaimo-caribbean:   #00726F;
  --vaimo-violet:      #4B3F72;
  --vaimo-royal-blue:  #2563EB;
  --vaimo-tomato:      #FF5A36;

  /* Surface tokens — dark theme built on Jet */
  --c-bg:          #111111;
  --c-surface:     #1C1C1C;
  --c-surface2:    #242424;
  --c-jet:         var(--vaimo-jet);
  --c-border:      rgba(216, 216, 216, 0.10);
  --c-border-med:  rgba(216, 216, 216, 0.18);
  --c-text:        #F0F0EE;
  --c-text-sec:    #B8B8B6;
  --c-muted:       #787876;

  /* Semantic accent tokens */
  --c-accent:      var(--vaimo-yellow);
  --c-cta:         var(--vaimo-caribbean);
  --c-cta-hover:   #008F8C;
  --c-link:        var(--vaimo-royal-blue);
  --c-critical:    var(--vaimo-tomato);
  --c-high:        var(--vaimo-yellow);
  --c-reviewing:   var(--vaimo-violet);
  --c-positive:    var(--vaimo-caribbean);

  /* Typography */
  --font-headline: 'Roboto', 'Segoe UI', system-ui, sans-serif;
  --font-body:     'Libre Franklin', 'Inter', system-ui, sans-serif;
  --font-caveat:   'Caveat', cursive;

  /* Shape */
  --radius-sm:  6px;
  --radius:     9px;
  --radius-lg:  14px;
}

/* --------------------------------------------------------------------------
   2. Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-link); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: .85em;
  background: var(--c-surface2);
  padding: .1em .35em;
  border-radius: 4px;
  color: var(--vaimo-light-grey);
}

/* --------------------------------------------------------------------------
   3. Navigation
   -------------------------------------------------------------------------- */
.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 2rem;
  height: 56px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 200;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo-img {
  height: 22px;
  max-height: 22px;
  width: auto;
  flex-shrink: 0;
  display: block;
}

.nav-logo-divider {
  display: block;
  width: 1px;
  height: 18px;
  background: var(--c-border-med);
  flex-shrink: 0;
}

.nav-logo-text {
  font-family: var(--font-headline);
  font-weight: 400;
  font-size: .95rem;
  color: var(--c-text-sec);
  letter-spacing: -.2px;
}

.nav-logo-text em {
  font-style: normal;
  color: var(--vaimo-yellow);
}

.nav-breadcrumb {
  font-size: .8rem;
  color: var(--c-muted);
  margin-left: .25rem;
}

.nav-breadcrumb a { color: var(--c-muted); }
.nav-breadcrumb a:hover { color: var(--c-text); text-decoration: none; }

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.nav-tagline {
  font-size: .75rem;
  color: var(--c-muted);
  font-weight: 300;
}

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.page-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2.25rem 1.75rem;
}

.page-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.75rem;
  align-items: start;
}

.main-col { min-width: 0; }
.side-col  { display: flex; flex-direction: column; gap: 1rem; }

@media (max-width: 960px) {
  .page-grid { grid-template-columns: 1fr; }
  .side-col  { order: -1; }
}

/* --------------------------------------------------------------------------
   5. Page headings with "Vaimo Line"
   -------------------------------------------------------------------------- */
.page-heading {
  font-family: var(--font-headline);
  font-weight: 300;
  font-size: 1.75rem;
  letter-spacing: -.4px;
  line-height: 1.2;
  margin-bottom: .2rem;
}

/* The yellow brand line — 1px, min ~3 characters wide */
.vaimo-line-rule {
  display: block;
  width: 3.5rem;          /* ≈ 3–4 characters at current size */
  height: 2px;
  background: var(--vaimo-line);
  margin-top: .45rem;
  margin-bottom: .75rem;
  border-radius: 1px;
}

.page-subtitle {
  color: var(--c-muted);
  font-size: .875rem;
  font-weight: 300;
  margin-bottom: 1.75rem;
}

/* Section card titles — sentence case, no ALL CAPS */
.card-label {
  font-family: var(--font-headline);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .06em;
  color: var(--c-muted);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.card-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-border);
}

/* --------------------------------------------------------------------------
   6. Cards & Surfaces
   -------------------------------------------------------------------------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.card:last-child { margin-bottom: 0; }

.side-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
}

.side-card-title {
  font-family: var(--font-headline);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .07em;
  color: var(--c-muted);
  margin-bottom: .85rem;
  text-transform: none;
}

/* --------------------------------------------------------------------------
   7. Stat chips / Quick-stats bar
   -------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .85rem;
  margin-bottom: 1.75rem;
}

.stat-chip {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
}

.stat-chip__label {
  font-size: .68rem;
  font-weight: 400;
  letter-spacing: .05em;
  color: var(--c-muted);
  margin-bottom: .3rem;
}

.stat-chip__value {
  font-family: var(--font-headline);
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 1.1;
  color: var(--c-text);
}

.stat-chip__value--accent   { color: var(--vaimo-yellow); }
.stat-chip__value--positive { color: var(--vaimo-caribbean); }
.stat-chip__value--warn     { color: var(--vaimo-yellow); }
.stat-chip__value--danger   { color: var(--vaimo-tomato); }

/* Compact stat chip for detail page quick-stats bar */
.qstat {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: .85rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.qstat__label {
  font-size: .66rem;
  font-weight: 400;
  letter-spacing: .05em;
  color: var(--c-muted);
}

.qstat__value {
  font-family: var(--font-headline);
  font-size: .95rem;
  font-weight: 500;
  color: var(--c-text);
}

.qstat__value--accent  { color: var(--vaimo-yellow); }
.qstat__value--ok      { color: var(--vaimo-caribbean); }
.qstat__value--warn    { color: var(--vaimo-yellow); }
.qstat__value--danger  { color: var(--vaimo-tomato); }
.qstat__sub { font-size: .73rem; color: var(--c-muted); }

/* --------------------------------------------------------------------------
   8. Toolbar / Search bar
   -------------------------------------------------------------------------- */
.toolbar {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.field-group label {
  font-size: .67rem;
  font-weight: 400;
  letter-spacing: .05em;
  color: var(--c-muted);
}

.toolbar input[type="text"],
.toolbar select {
  background: var(--c-bg);
  color: var(--c-text);
  border: 1px solid var(--c-border-med);
  border-radius: var(--radius-sm);
  padding: .48rem .8rem;
  font-family: var(--font-body);
  font-size: .85rem;
  font-weight: 300;
  outline: none;
  transition: border-color .15s;
}

.toolbar input[type="text"] { min-width: 240px; }
.toolbar input[type="text"]:focus,
.toolbar select:focus { border-color: var(--vaimo-yellow); }

.toolbar-actions { display: flex; gap: .5rem; align-items: flex-end; margin-left: auto; }

/* --------------------------------------------------------------------------
   9. Results meta row
   -------------------------------------------------------------------------- */
.results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
  font-size: .8rem;
  color: var(--c-muted);
}

.results-meta strong { color: var(--c-text); font-weight: 500; }

/* --------------------------------------------------------------------------
   10. Tender table
   -------------------------------------------------------------------------- */
.tender-table {
  width: 100%;
  border-collapse: collapse;
}

.tender-table th {
  text-align: left;
  padding: .55rem .9rem;
  font-size: .67rem;
  font-weight: 500;
  letter-spacing: .06em;
  color: var(--c-muted);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border-med);
  white-space: nowrap;
  position: sticky;
  z-index: 1;
}

.tender-table td {
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}

.tender-table tbody tr:hover td {
  background: rgba(250, 191, 43, 0.04);
}

.tender-table .title-cell { max-width: 380px; }
.tender-table .title-cell a {
  font-weight: 400;
  color: var(--c-text);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  transition: color .12s;
}
.tender-table .title-cell a:hover { color: var(--vaimo-yellow); }

.tender-id {
  font-size: .71rem;
  color: var(--c-muted);
  font-weight: 300;
  margin-top: .1rem;
  font-family: monospace;
}

/* --------------------------------------------------------------------------
   11. Priority & Status pills
   -------------------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .6rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.5;
}

/* Priority */
.pill--critical  { background: rgba(255,90,54,.14);  color: var(--vaimo-tomato);    border: 1px solid rgba(255,90,54,.28); }
.pill--high      { background: rgba(245,176,0,.14);  color: var(--vaimo-yellow);    border: 1px solid rgba(245,176,0,.28); }
.pill--medium    { background: rgba(75,63,114,.18);  color: #9B8FD4;                border: 1px solid rgba(75,63,114,.35); }
.pill--low       { background: rgba(216,216,216,.07);color: var(--c-muted);         border: 1px solid var(--c-border-med); }
.pill--unscored  { background: var(--c-surface2);    color: var(--c-muted);         border: 1px solid var(--c-border-med); }

/* Status */
.pill--new         { background: rgba(37,99,235,.12);  color: #6BA3FF;               border: 1px solid rgba(37,99,235,.25); }
.pill--reviewing   { background: rgba(75,63,114,.18);  color: #9B8FD4;               border: 1px solid rgba(75,63,114,.35); }
.pill--shortlisted { background: rgba(0,114,111,.15);  color: #4DC9C6;               border: 1px solid rgba(0,114,111,.3);  }
.pill--under_bid   { background: rgba(0,114,111,.25);  color: #7DDFDC;               border: 1px solid rgba(0,114,111,.45); }
.pill--discarded   { background: rgba(255,90,54,.1);   color: var(--vaimo-tomato);   border: 1px solid rgba(255,90,54,.2);  }

/* Score badge (table) */
.score-badge {
  display: inline-block;
  min-width: 2.2rem;
  text-align: center;
  padding: .12rem .45rem;
  border-radius: 99px;
  font-weight: 600;
  font-size: .78rem;
}
.score-badge--high   { background: rgba(0,114,111,.15);  color: #4DC9C6; }
.score-badge--medium { background: rgba(245,176,0,.14);  color: var(--vaimo-yellow); }
.score-badge--low    { background: rgba(255,90,54,.12);  color: var(--vaimo-tomato); }
.score-badge--none   { background: var(--c-surface2);    color: var(--c-muted); }

/* --------------------------------------------------------------------------
   12. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border-med);
  background: var(--c-surface2);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: .83rem;
  font-weight: 400;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}

.btn:hover { background: var(--c-jet); border-color: var(--c-muted); text-decoration: none; color: var(--c-text); }

.btn--primary {
  background: var(--vaimo-caribbean);
  border-color: var(--vaimo-caribbean);
  color: #fff;
  font-weight: 500;
}
.btn--primary:hover { background: var(--c-cta-hover); border-color: var(--c-cta-hover); color: #fff; }

.btn--yellow {
  background: var(--vaimo-yellow);
  border-color: var(--vaimo-yellow);
  color: var(--vaimo-jet);
  font-weight: 500;
}
.btn--yellow:hover { background: #FFD050; border-color: #FFD050; color: var(--vaimo-jet); }

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--c-muted);
}
.btn--ghost:hover { background: var(--c-surface2); color: var(--c-text); border-color: var(--c-border-med); }

.btn--block { width: 100%; margin-bottom: .5rem; }
.btn--block:last-child { margin-bottom: 0; }

.btn--disabled { opacity: .35; pointer-events: none; }

.btn--save {
  background: rgba(0,114,111,.14);
  border-color: rgba(0,114,111,.3);
  color: #4DC9C6;
  font-weight: 500;
}
.btn--save:hover { background: rgba(0,114,111,.25); }

/* --------------------------------------------------------------------------
   13. Pagination
   -------------------------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 .6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border-med);
  background: var(--c-surface);
  color: var(--c-text-sec);
  font-size: .82rem;
  text-decoration: none;
  transition: all .12s;
}

.page-btn:hover        { border-color: var(--vaimo-yellow); color: var(--vaimo-yellow); text-decoration: none; }
.page-btn--active      { background: var(--vaimo-yellow); border-color: var(--vaimo-yellow); color: var(--vaimo-jet); font-weight: 600; }
.page-btn--disabled    { opacity: .3; pointer-events: none; }
.page-ellipsis         { color: var(--c-muted); padding: 0 .25rem; }

/* --------------------------------------------------------------------------
   14. Empty state
   -------------------------------------------------------------------------- */
.empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--c-muted);
}
.empty__icon  { font-size: 2.5rem; margin-bottom: .75rem; display: block; }
.empty__title { font-family: var(--font-headline); font-weight: 300; font-size: 1rem; margin-bottom: .4rem; color: var(--c-text-sec); }

/* --------------------------------------------------------------------------
   15. Detail page — Header card
   -------------------------------------------------------------------------- */
.detail-header {
  background: linear-gradient(135deg, var(--c-surface) 0%, #1E1E28 100%);
  border: 1px solid var(--c-border);
  border-top: 3px solid var(--vaimo-line);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}

.detail-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, rgba(250,191,43,.05) 0%, transparent 60%);
  pointer-events: none;
}

.detail-header__top {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.detail-header__title {
  font-family: var(--font-headline);
  font-weight: 300;
  font-size: 1.35rem;
  line-height: 1.35;
  flex: 1;
  letter-spacing: -.3px;
}

.detail-header__meta {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: .25rem;
}

.meta-item__label {
  font-size: .66rem;
  font-weight: 400;
  letter-spacing: .05em;
  color: var(--c-muted);
  display: block;
  margin-bottom: .15rem;
}

.meta-item__value {
  font-size: .88rem;
  font-weight: 400;
  color: var(--c-text-sec);
}

/* --------------------------------------------------------------------------
   16. Detail page — AI Insight / Score ring
   -------------------------------------------------------------------------- */
.ai-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.75rem;
  align-items: start;
}
@media (max-width: 640px) { .ai-layout { grid-template-columns: 1fr; } }

.score-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .65rem;
  flex-shrink: 0;
}

.score-ring {
  width: 114px;
  height: 114px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color, var(--vaimo-yellow)) calc(var(--score, 0) * 1%), #2A2A2A 0%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.score-ring::after {
  content: '';
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: var(--c-surface);
  position: absolute;
}

.score-ring__number {
  font-family: var(--font-headline);
  font-size: 1.7rem;
  font-weight: 300;
  position: relative;
  z-index: 1;
  line-height: 1;
  color: var(--ring-color, var(--vaimo-yellow));
}

.score-ring__label {
  font-size: .7rem;
  font-weight: 400;
  color: var(--c-muted);
  text-align: center;
}

/* Reasoning callout — Caveat font for the "human touch" */
.reasoning-callout {
  background: rgba(250, 191, 43, 0.05);
  border: 1px solid rgba(250, 191, 43, 0.18);
  border-left: 3px solid var(--vaimo-line);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.reasoning-callout__text {
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.6;
  color: #D8D4B8;
}

.no-score-callout {
  background: var(--c-surface2);
  border: 1px dashed var(--c-border-med);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  color: var(--c-muted);
  font-size: .85rem;
  font-weight: 300;
}

/* Tech stack badges */
.tech-badges { display: flex; flex-wrap: wrap; gap: .5rem; }

.tech-badge {
  background: rgba(75, 63, 114, .2);
  color: #9B8FD4;
  border: 1px solid rgba(75, 63, 114, .4);
  border-radius: var(--radius-sm);
  padding: .22rem .65rem;
  font-size: .78rem;
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   17. Detail page — Description body
   -------------------------------------------------------------------------- */
.description-body {
  font-size: .88rem;
  font-weight: 300;
  line-height: 1.85;
  color: var(--c-text-sec);
  white-space: pre-wrap;
  word-break: break-word;
}

.description-empty {
  color: var(--c-muted);
  font-style: italic;
  font-size: .85rem;
  font-weight: 300;
}

/* --------------------------------------------------------------------------
   18. CPV chips
   -------------------------------------------------------------------------- */
.cpv-chips { display: flex; flex-wrap: wrap; gap: .4rem; }

.cpv-chip {
  background: var(--c-surface2);
  border: 1px solid var(--c-border-med);
  border-radius: 4px;
  padding: .18rem .55rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: .75rem;
  color: var(--c-muted);
}

/* --------------------------------------------------------------------------
   19. Sidebar — Status form
   -------------------------------------------------------------------------- */
.status-select {
  width: 100%;
  background: var(--c-bg);
  color: var(--c-text);
  border: 1px solid var(--c-border-med);
  border-radius: var(--radius-sm);
  padding: .5rem .75rem;
  font-family: var(--font-body);
  font-size: .85rem;
  font-weight: 300;
  cursor: pointer;
  outline: none;
  margin-bottom: .75rem;
  transition: border-color .15s;
  appearance: auto;
}
.status-select:focus { border-color: var(--vaimo-yellow); }

/* Metadata table in sidebar */
.meta-table { width: 100%; border-collapse: collapse; }
.meta-table td {
  padding: .32rem 0;
  font-size: .8rem;
  border-bottom: 1px solid var(--c-border);
}
.meta-table td:first-child { color: var(--c-muted); font-weight: 300; width: 45%; }
.meta-table td:last-child  { font-weight: 400; padding-left: .5rem; }
.meta-table tr:last-child td { border-bottom: none; }

/* --------------------------------------------------------------------------
   20. Mountain background (detail page heritage element)
   -------------------------------------------------------------------------- */
.mountain-bg {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 60vw;
  max-width: 800px;
  pointer-events: none;
  z-index: 0;
  opacity: .03;
}

.mountain-bg svg { display: block; width: 100%; }

/* Ensure main content sits above */
.page-wrap { position: relative; z-index: 1; }

/* --------------------------------------------------------------------------
   21. Flag helper
   -------------------------------------------------------------------------- */
.flag { font-size: 1.05rem; line-height: 1; }

/* --------------------------------------------------------------------------
   22. Sync button (nav)
   -------------------------------------------------------------------------- */
.btn--sync {
  font-size: .78rem;
  padding: .38rem .8rem;
  background: transparent;
  border: 1px solid rgba(250,191,43,.4);
  color: var(--vaimo-yellow);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  cursor: pointer;
  transition: background .15s;
}
.btn--sync:hover { background: rgba(250,191,43,.08); }
