/* TradeBuilders Members v2
   Visual language carried over from the Rebate Tracker so the two screens
   feel like one system: soft grey ground, white cards with a hairline
   shadow, compact typographic scale, and the same type-ahead dropdown. */

:root {
  --tb-ground: #f5f6fa;
  --tb-navy:   #0d47a1;
  --tb-hover:  #e9f1ff;
}

body { background: var(--tb-ground); }

/* --- app chrome ---------------------------------------------------- */
.app-navbar {
  background: var(--tb-navy);
  padding-top: .5rem;
  padding-bottom: .5rem;
}
.app-navbar .navbar-brand,
.app-navbar .navbar-text { color: #fff; }
.app-navbar .navbar-brand { font-weight: 600; font-size: 1.05rem; }

/* --- cards --------------------------------------------------------- */
.section-card {
  background: #fff;
  border-radius: .5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.section-card + .section-card { margin-top: 1rem; }
.section-card .card-heading {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #6c757d;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

/* --- entity bar (mirrors the rebate tracker supplier bar) ----------- */
.entity-bar {
  background: var(--tb-navy);
  color: #fff;
  padding: .6rem 1rem;
  border-radius: .375rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.entity-bar .badge { font-weight: 600; }

/* --- type-ahead ---------------------------------------------------- */
.pos-rel { position: relative; }
.search-dropdown {
  position: absolute;
  z-index: 1050;
  width: 100%;
  background: #fff;
  border: 1px solid #ced4da;
  border-top: none;
  border-radius: 0 0 .375rem .375rem;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.search-dropdown .sd-item {
  padding: .45rem .75rem;
  cursor: pointer;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.search-dropdown .sd-item:hover,
.search-dropdown .sd-item.active { background: var(--tb-hover); }
.sd-item .badge { font-size: .7rem; }
.inactive-label { color: #aaa; font-style: italic; }

/* --- tables -------------------------------------------------------- */
.tb-table th {
  white-space: nowrap;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #6c757d;
  font-weight: 600;
}
.tb-table td { font-size: .875rem; vertical-align: middle; }
.tb-table tbody tr:hover { background: var(--tb-hover); }
.tb-table a.row-link { text-decoration: none; font-weight: 600; }
.tb-table th a { color: inherit; text-decoration: none; }
.tb-table th a:hover { color: var(--tb-navy); }

/* --- forms --------------------------------------------------------- */
.form-label { font-size: .8rem; font-weight: 600; margin-bottom: .2rem; }
.form-text  { font-size: .75rem; }
.readonly-value {
  font-size: .875rem;
  padding: .25rem 0;
  border-bottom: 1px dashed #dee2e6;
  min-height: 1.9rem;
}
.legacy-note {
  font-size: .72rem;
  color: #8a6d3b;
  background: #fcf8e3;
  border: 1px solid #faebcc;
  border-radius: .25rem;
  padding: .3rem .5rem;
}

/* --- status pills -------------------------------------------------- */
.status-active         { background:#198754; }
.status-inactive       { background:#6c757d; }
.status-limbo          { background:#fd7e14; }
.status-subcontracting { background:#0dcaf0; color:#000 !important; }
.status-retired        { background:#495057; }

/* --- contact repeater ---------------------------------------------- */
.contact-card {
  border: 1px solid #e9ecef;
  border-radius: .375rem;
  padding: .75rem;
  margin-bottom: .75rem;
  background: #fcfcfd;
}
.contact-card.is-primary { border-color: var(--tb-navy); background: #f7faff; }
.contact-card .contact-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}

/* --- misc ---------------------------------------------------------- */
.sticky-actions {
  position: sticky;
  bottom: 0;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(4px);
  border-top: 1px solid #dee2e6;
  padding: .75rem 1rem;
  margin: 1rem -1rem -1rem;
  border-radius: 0 0 .5rem .5rem;
  z-index: 20;
}
.audit-list { font-size: .8rem; max-height: 320px; overflow-y: auto; }
.audit-list .audit-row { padding: .4rem 0; border-bottom: 1px solid #f1f3f5; }
@media print {
  .app-navbar, .sticky-actions, .btn { display: none !important; }
  .section-card { box-shadow: none; border: 1px solid #dee2e6; }
}

/* --- staff shell: side menu + content ------------------------------- */
/* The legacy system has a persistent left menu built from MenuData. Same
   shape here, so the two feel like one system during the transition. */
.app-shell {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.app-main { min-width: 0; }   /* lets wide tables scroll instead of pushing the grid */

.app-side {
  position: sticky;
  top: 1rem;
}
.side-section + .side-section { margin-top: 1rem; }
.side-head {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #8a94a6;
  padding: 0 .25rem .3rem;
  border-bottom: 1px solid #e3e7ee;
  margin-bottom: .3rem;
}
.side-list { list-style: none; margin: 0; padding: 0; }
.side-link {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .32rem .5rem;
  font-size: .875rem;
  color: #33415c;
  text-decoration: none;
  border-radius: .25rem;
  border-left: 2px solid transparent;
}
.side-link:hover { background: var(--tb-hover); color: var(--tb-navy); }
.side-link.is-active {
  background: var(--tb-hover);
  border-left-color: var(--tb-navy);
  color: var(--tb-navy);
  font-weight: 600;
}
.side-link.is-legacy { color: #9aa4b4; }
.side-link.is-legacy:hover { color: #6c7a90; background: #f1f3f7; }
.side-ext { font-size: .65rem; margin-left: auto; opacity: .7; }
.side-note {
  font-size: .7rem;
  color: #9aa4b4;
  line-height: 1.45;
  margin: 1rem .25rem 0;
  padding-top: .6rem;
  border-top: 1px solid #e3e7ee;
}

@media (max-width: 991.98px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .app-side { position: static; }
}

/* --- supplier-specific bits ----------------------------------------- */
.status-prospective { background:#6f42c1; }
.rebate-pill {
  font-variant-numeric: tabular-nums;
  background: var(--tb-hover);
  color: var(--tb-navy);
  font-weight: 600;
}
.contact-card.is-inactive { opacity: .62; border-style: dashed; background: #fafbfc; }
.sla-table input { text-align: center; }
