/* ============================================================
   B2B admin redesign — component classes
   Loaded after main.css; reuses its token system.
   Source: .claude/skills/sketch-findings-med-rep-pro/
   ============================================================ */

/* ─────────  Page header + segmented Triage/Config control  ───────── */
.b2b-page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}
.b2b-page-head h2 { margin: 0; font-family: var(--font-display); font-size: 26px; letter-spacing: -0.01em; }

.b2b-segment {
  display: inline-flex; padding: 4px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 9999px;
  backdrop-filter: blur(10px);
}
.b2b-seg-btn {
  padding: 7px 18px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  border: 0; background: transparent;
  color: var(--text-2); border-radius: 9999px;
  cursor: pointer; transition: all 0.18s ease;
}
.b2b-seg-btn:hover { color: var(--text-1); }
.b2b-seg-btn.active {
  background: var(--accent); color: #021a14;
  box-shadow: 0 2px 12px var(--glow);
}
.b2b-seg-btn .count {
  display: inline-block;
  margin-inline-start: 6px; padding: 0 7px;
  background: rgba(0,0,0,0.18); border-radius: 9999px;
  font-size: 11px;
}
.b2b-seg-btn:not(.active) .count {
  background: rgba(44,194,149,0.18); color: var(--accent);
}

/* ─────────  Underline sub-tabs  ───────── */
.b2b-subtabs {
  display: flex; gap: 4px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.b2b-subtab {
  padding: 9px 16px;
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  background: transparent; color: var(--text-2);
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer; transition: all 0.15s ease;
  margin-bottom: -1px;
}
.b2b-subtab:hover { color: var(--text-1); }
.b2b-subtab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.b2b-subtab .count {
  margin-inline-start: 6px; font-size: 11px;
  padding: 1px 7px;
  background: rgba(44,194,149,0.18); color: var(--accent);
  border-radius: 9999px;
  font-weight: 700;
}

/* ─────────  Master-detail layout  ───────── */
.b2b-md {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.95fr);
  gap: 16px;
  align-items: start;
  min-height: 540px;
}
@media (max-width: 920px) {
  .b2b-md { grid-template-columns: 1fr; }
}

/* List card + header */
.b2b-listcard { overflow: hidden; padding: 0; }
.b2b-listhead {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--card-strong, rgba(3,98,76,0.30));
  flex-wrap: wrap;
}
.b2b-listhead .h-search {
  flex: 1 1 200px; position: relative;
}
.b2b-listhead .h-search::before {
  content: '⌕';
  position: absolute; left: 10px; top: 4px;
  color: var(--text-3); font-size: 14px;
  pointer-events: none;
}
.b2b-listhead input[type=search].b2b-filt-search {
  width: 100%;
  background: var(--field-bg); border: 1px solid var(--border);
  color: var(--text-1); border-radius: var(--r-sm);
  padding: 6px 10px 6px 32px;
  font-family: var(--font-body); font-size: 12.5px;
}
.b2b-listhead .b2b-filt {
  background: var(--field-bg); border: 1px solid var(--border);
  color: var(--text-1); border-radius: var(--r-sm);
  padding: 5px 10px;
  font-family: var(--font-body); font-size: 12.5px;
}

/* Keyboard hint bar */
.b2b-kbar {
  display: flex; align-items: center; gap: 14px;
  padding: 6px 14px;
  font-family: var(--font-body); font-size: 11.5px; color: var(--text-3);
  background: var(--bg-2, rgba(0,0,0,0.18));
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.b2b-kbar .item { display: inline-flex; align-items: center; gap: 4px; }
.b2b-kbd {
  display: inline-block; padding: 1px 6px;
  font-family: var(--font-mono, ui-monospace, monospace); font-size: 10.5px;
  background: var(--field-bg); border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px; color: var(--text-2);
  margin-inline-start: 4px;
}

/* List body + items */
.b2b-list {
  max-height: 540px; overflow-y: auto;
}
.b2b-list-empty {
  padding: 40px 20px; text-align: center; color: var(--text-3);
  font-size: 13px;
}
.b2b-list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px 14px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.12s ease;
  border-inline-start: 3px solid transparent;
}
.b2b-list-item:hover { background: var(--row-hover, rgba(44,194,149,0.10)); }
.b2b-list-item.sel {
  background: var(--row-sel, rgba(44,194,149,0.20));
  border-inline-start-color: var(--accent);
}
.b2b-list-item .phone {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11.5px; color: var(--text-2);
}
.b2b-list-item .who { color: var(--text-1); font-weight: 500; font-size: 13px; }
.b2b-list-item .meta {
  color: var(--text-3); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 260px;
}
.b2b-list-item .right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  font-size: 11px; color: var(--text-3);
}

/* Claim-type pill */
.claim-type-pill {
  display: inline-flex; padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  background: rgba(0,219,241,0.16); color: var(--accent2, #00DBF1);
}
.claim-type-pill.new {
  background: rgba(255,186,64,0.18); color: var(--amber, #ffba40);
}

/* Detail pane */
.b2b-detail {
  position: sticky; top: 14px;
  max-height: calc(100vh - 30px);
  overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 0;
}
.b2b-detail-empty {
  color: var(--text-3); font-size: 13px;
  padding: 24px;
}
.b2b-d-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.b2b-d-head .who-name {
  font-family: var(--font-display); font-weight: 600;
  font-size: 17px; margin-bottom: 4px;
}
.b2b-d-head .who-phone {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12.5px; color: var(--text-2);
}
.b2b-d-body { padding: 14px 20px; flex: 1; }
.b2b-d-row {
  display: flex; gap: 14px; padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.b2b-d-row .k {
  width: 130px; flex-shrink: 0;
  color: var(--text-3); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding-top: 2px;
}
.b2b-d-row .v {
  flex: 1; color: var(--text-1); font-size: 13px;
  word-break: break-word;
}
.b2b-d-row .v.mono { font-family: var(--font-mono, ui-monospace, monospace); }

/* Form fields inside the detail body (for new-pharmacy claims) */
.b2b-d-field {
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px 0;
}
.b2b-d-field .k {
  color: var(--text-3); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.b2b-d-field input,
.b2b-d-field select,
.b2b-d-field textarea {
  background: var(--field-bg); border: 1px solid var(--border);
  color: var(--text-1); border-radius: var(--r-sm);
  padding: 7px 10px;
  font-family: var(--font-body); font-size: 13px;
  width: 100%;
}

/* Sticky action footer */
.b2b-d-actions {
  display: flex; gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--card-strong, rgba(3,98,76,0.30));
  position: sticky; bottom: 0;
  flex-wrap: wrap;
}
.b2b-d-actions .spacer { flex: 1; }
.btn .b2b-kbd { background: rgba(0,0,0,0.15); color: inherit; border-color: rgba(0,0,0,0.15); }

/* ─────────  Verification document gallery  ───────── */
.b2b-d-docs {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.b2b-d-docs h4 {
  font-family: var(--font-display);
  font-size: 12px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.1em;
  font-weight: 600; margin: 0 0 10px;
  display: flex; align-items: center; gap: 6px;
}
.b2b-d-docs h4 .count {
  font-size: 11px; color: var(--accent);
  background: rgba(44,194,149,0.18);
  padding: 1px 8px; border-radius: 9999px;
  font-family: var(--font-body); letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
}
.b2b-doc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 480px) {
  .b2b-doc-grid { grid-template-columns: repeat(2, 1fr); }
}
.b2b-doc {
  position: relative;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-2, rgba(0,0,0,0.20));
  border: 1px solid var(--border);
  aspect-ratio: 3 / 4;
  cursor: zoom-in;
  transition: all 0.18s ease;
  padding: 0;
  display: block;
  font-family: var(--font-body);
}
.b2b-doc:hover {
  border-color: var(--border-acc);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}
.b2b-doc img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.b2b-doc .pdf-icon {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-size: 36px; color: var(--text-3);
  background: linear-gradient(135deg, rgba(0,0,0,0.10), transparent);
}
.b2b-doc-meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 7px 9px;
  background: linear-gradient(0deg, rgba(0,0,0,0.78), rgba(0,0,0,0));
  color: #fff;
  font-size: 11px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px;
}
.b2b-doc-meta .kind {
  font-weight: 600; letter-spacing: 0.02em;
  text-transform: lowercase;
}
.b2b-doc-meta .size {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px; opacity: 0.85;
}
.b2b-doc-badge {
  position: absolute; top: 6px; inset-inline-start: 6px;
  padding: 1px 7px; border-radius: 9999px;
  font-size: 10px; font-weight: 600;
  background: var(--accent); color: #021a14;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.b2b-doc-badge.opt {
  background: rgba(0,0,0,0.55); color: #fff;
}
.b2b-doc-zoom {
  position: absolute; top: 6px; inset-inline-end: 6px;
  width: 22px; height: 22px;
  background: rgba(0,0,0,0.5); color: #fff;
  border-radius: 4px;
  display: grid; place-items: center;
  font-size: 12px;
  opacity: 0; transition: opacity 0.15s ease;
}
.b2b-doc:hover .b2b-doc-zoom { opacity: 1; }
.b2b-doc.missing {
  cursor: default;
  border-style: dashed; opacity: 0.6;
  display: grid; place-items: center;
  color: var(--text-3); font-size: 11.5px; text-align: center;
  padding: 12px;
}
.b2b-doc.missing:hover { transform: none; box-shadow: none; }
.b2b-doc-empty {
  font-size: 12.5px; color: var(--text-3);
  padding: 4px 0;
}

/* ─────────  Lightbox  ───────── */
.b2b-lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 10001;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 24px;
  animation: b2bLbFade 0.18s ease;
}
@keyframes b2bLbFade { from { opacity: 0; } to { opacity: 1; } }
.b2b-lightbox-head {
  display: flex; align-items: center; gap: 14px;
  color: #f1f7f6;
  font-family: var(--font-body); font-size: 13px;
  flex-wrap: wrap;
}
.b2b-lightbox-head .kind {
  padding: 3px 10px;
  background: var(--accent); color: #021a14;
  border-radius: 9999px; font-weight: 600;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
}
.b2b-lightbox-head .file {
  opacity: 0.85;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
}
.b2b-lightbox-head .size { opacity: 0.6; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; }
.b2b-lightbox-head .spacer { flex: 1; }
.b2b-lightbox-close {
  background: rgba(255,255,255,0.12); color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px; padding: 5px 12px;
  cursor: pointer;
  font-family: var(--font-body); font-size: 12px;
}
.b2b-lightbox-close:hover { background: rgba(255,255,255,0.22); }
.b2b-lightbox-body {
  display: grid; place-items: center;
  overflow: auto;
  padding: 14px 0;
}
.b2b-lightbox-body img {
  max-width: min(94vw, 1100px);
  max-height: 84vh;
  object-fit: contain;
  border-radius: var(--r-md);
  background: #f5f5f5;
}
.b2b-lightbox-body .pdf-stub {
  color: rgba(255,255,255,0.75);
  font-family: var(--font-body); font-size: 14px;
  background: rgba(255,255,255,0.05);
  padding: 32px 40px; border-radius: var(--r-md);
  text-align: center;
}
.b2b-lightbox-body .pdf-stub a {
  display: inline-block; margin-top: 14px;
  padding: 8px 16px;
  background: var(--accent); color: #021a14;
  border-radius: var(--r-sm); text-decoration: none;
  font-weight: 600;
}
