/* Company registry grid + detail drawer.
 *
 * Shares the .glass surface and the navy/orange two-tone with the tender and
 * news cards. A company card is denser than a tender card by design — it is a
 * directory entry, scanned in bulk, not a document you read.
 */

.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.company-card {
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}

.company-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -12px var(--glass-shadow);
}
.company-card:active { transform: translateY(-1px) scale(0.995); }

@media (prefers-reduced-motion: reduce) {
  .company-card:hover, .company-card:active { transform: none; }
}

.co-head { display: flex; gap: 11px; align-items: center; min-width: 0; }

/* --- avatar / logo -------------------------------------------------------
   Same layered approach as .bc-avatar: the logo covers initials that stay in
   the DOM, so a broken image degrades to a correct avatar rather than a
   broken-image glyph. */

.co-avatar, .co-avatar-lg {
  position: relative;
  overflow: hidden;
  flex: none;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  border-radius: 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.co-avatar { width: 46px; height: 46px; font-size: 14.5px; }
.co-avatar-lg { width: 64px; height: 64px; font-size: 20px; border-radius: 17px; }

.co-logo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* contain, not cover — logos are padded artwork and cropping mangles them. */
  object-fit: contain;
  padding: 5px;
  background: #fff;
  z-index: 1;
}

/* White plate so dark marks stay legible: the tinted avatar colour is chosen
   for contrast with white text, not with arbitrary artwork. */
.co-avatar.has-logo, .co-avatar-lg.has-logo {
  background: #fff !important;
  box-shadow: inset 0 0 0 1px var(--stage-border);
}
.co-avatar.has-logo .co-initials,
.co-avatar-lg.has-logo .co-initials { visibility: hidden; }

/* --- card body ------------------------------------------------------------ */

.co-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.co-name {
  font-size: 13.5px;
  font-weight: 750;
  line-height: 1.35;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 5px;
  /* Company names here run long and shouty (ALL CAPS government bodies), so
     clamp rather than ellipsis on one line. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.co-verified { color: var(--ebid-accent); flex: none; }
.co-verified svg { width: 14px; height: 14px; display: block; }

.co-industry {
  font-size: 11px;
  font-weight: 650;
  color: var(--ebid-orange-strong);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.co-location {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-tertiary);
}
.co-location svg { width: 13px; height: 13px; flex: none; }
.co-location span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A checked address links to Maps; an unchecked one is plain text, because a
   pin is a claim and we only make it when somebody has verified the place. */
.co-location-link { color: var(--ebid-accent); text-decoration: none; }
.co-location-link:hover { text-decoration: underline; }
.co-location-unknown { font-style: italic; opacity: 0.85; }

/* .ct-rows takes a card's spare vertical space with margin-top:auto so contact
   cards sit flush at the bottom. On a company card .co-stats already does
   that, and two auto margins split the slack between them — the stats are the
   card's subject, so the contact rows give theirs up. */
.co-contact-rows { margin-top: 0; }
.co-unknown, .co-more { color: var(--text-tertiary); font-size: 11.5px; }

.co-stats {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 3px;
}

.co-stat {
  flex: 1;
  background: var(--stage-0);
  border: 1px solid var(--stage-border);
  border-radius: var(--r-sm);
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.co-stat-num { font-size: 15px; font-weight: 800; color: var(--ebid-primary); line-height: 1.1; }
.co-stat-label { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; }

.co-stats-lg .co-stat-num { font-size: 20px; }

.company-summary {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-tertiary);
  align-self: flex-end;
  padding-bottom: 6px;
}

/* --- detail drawer -------------------------------------------------------- */

.company-drawer { position: fixed; inset: 0; z-index: 120; }

.company-drawer-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(2px);
}

.company-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(460px, 100%);
  overflow-y: auto;
  padding: 22px 22px 40px;
  border-radius: var(--r-lg) 0 0 var(--r-lg);
  animation: drawer-in var(--dur-med) var(--ease-out);
}

@keyframes drawer-in {
  from { transform: translateX(24px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .company-drawer-panel { animation: none; }
}

.company-drawer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--stage-border);
  background: var(--stage-3);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.company-drawer-close svg { width: 15px; height: 15px; }
.company-drawer-close:hover { border-color: var(--stage-border-strong); color: var(--text-primary); }

.co-drawer-head { display: flex; gap: 14px; align-items: center; padding-right: 40px; margin-bottom: 14px; }

.co-drawer-name {
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 3px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.co-drawer-sub { font-size: 12px; color: var(--text-tertiary); }

.co-about { font-size: 12.5px; line-height: 1.65; color: var(--text-secondary); margin: 0 0 14px; }

.co-section {
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin: 20px 0 10px;
}

.co-bids { display: flex; flex-direction: column; gap: 8px; }

.co-bid {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--stage-border);
  background: var(--stage-1);
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.co-bid:hover { border-color: var(--ebid-accent); }

.co-bid-title { font-size: 12.5px; font-weight: 650; color: var(--text-primary); line-height: 1.4; }
.co-bid-meta { font-size: 11px; color: var(--text-tertiary); }

/* The source registry's own counts, shown small and explicitly attributed.
   E-chereta's numbers (live/total bids) are the headline; these are context
   for how much of a company's activity we have actually ingested. */
.co-source-note {
  font-size: 10.5px;
  color: var(--text-tertiary);
  text-align: right;
  margin-top: -4px;
}

.co-source-line {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-tertiary);
  margin: 10px 0 0;
}

/* --- contact rows (Business contacts) ------------------------------------ */

.ct-rows { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding-top: 4px; }

.ct-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 0;
}
.ct-row svg { width: 14px; height: 14px; flex: none; color: var(--ebid-primary); }
.ct-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ct-link { color: var(--ebid-accent); text-decoration: none; }
.ct-link:hover { text-decoration: underline; }

/* Buyer-type badge on contact cards. Government gets the brand navy because
   it's the authoritative case; the others stay quieter. */
.ct-tag {
  align-self: flex-start;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
}
.ct-tag-gov { background: var(--fill-brand-from); color: #fff; }
.ct-tag-ngo {
  background: var(--ebid-orange-soft);
  color: var(--ebid-orange-strong);
  border: 1px solid var(--ebid-orange-border);
}
.ct-tag-private {
  background: var(--stage-0);
  color: var(--text-tertiary);
  border: 1px solid var(--stage-border);
}
