/*
 * Shared component styles — agent baseball-card drawer, compliance chip,
 * and other cross-page surfaces introduced by the dashboard upgrade.
 * Depends on tokens.css for CSS custom properties.
 */

/* ── Baseball-card drawer ─────────────────────────────────────────────── */

.drawer-overlay {
  position: fixed; inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  z-index: var(--z-overlay);
  animation: drawer-fade var(--duration-base) var(--ease-standard);
}

.drawer-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(480px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border-bright);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-drawer);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: drawer-slide-in var(--duration-slow) var(--ease-emphasized);
}

@keyframes drawer-slide-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@keyframes drawer-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.drawer-content {
  height: 100%;
  overflow-y: auto;
  padding: 0;
}

.drawer-header {
  position: sticky; top: 0;
  display: flex; align-items: flex-start; gap: var(--space-4);
  padding: var(--space-6) var(--space-6) var(--space-4);
  background: linear-gradient(180deg, var(--surface2), var(--surface));
  border-bottom: 1px solid var(--border);
}

.drawer-avatar {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 16px; font-weight: 600;
  flex-shrink: 0;
}

.drawer-ident { flex: 1; min-width: 0; }

.drawer-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-1);
  word-break: break-word;
}

.drawer-agency {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: var(--space-2);
  word-break: break-word;
}

.drawer-meta {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  align-items: center;
  font-size: 11px; color: var(--muted);
}

.drawer-chip {
  background: var(--surface3);
  border: 1px solid var(--border-bright);
  color: var(--text-dim);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.drawer-chip--tenure {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.3);
  color: var(--purple);
}

.drawer-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  width: 28px; height: 28px;
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--duration-fast) var(--ease-standard);
  flex-shrink: 0;
}

.drawer-close:hover,
.drawer-close:focus-visible {
  color: var(--text);
  border-color: var(--border-bright);
  background: var(--surface3);
  outline: none;
}

.drawer-body {
  padding: var(--space-5) var(--space-6) var(--space-8);
  display: flex; flex-direction: column; gap: var(--space-6);
}

.drawer-section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: var(--space-3);
}

.drawer-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: var(--space-3);
}

.drawer-hint {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.drawer-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.drawer-stat-label {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.drawer-score-row {
  display: flex; align-items: center; gap: var(--space-2);
}

.drawer-score-track {
  flex: 1;
  height: 5px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.drawer-score-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width var(--duration-slow) var(--ease-emphasized);
}

.drawer-score-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  min-width: 26px;
  text-align: right;
}

.drawer-kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  row-gap: var(--space-3);
  column-gap: var(--space-4);
  align-items: center;
}

.drawer-kv-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.drawer-kv-value {
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.drawer-kv-value.mono,
.drawer-kv-value .mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.drawer-muted { color: var(--muted); font-style: italic; }

.drawer-validity {
  display: inline-flex; align-items: center;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
}

.drawer-validity--ok {
  color: var(--green);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.drawer-validity--bad {
  color: var(--red);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.drawer-copy {
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-xs);
  padding: 2px 8px;
  font-size: 10px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
}

.drawer-copy:hover { color: var(--text); border-color: var(--border-bright); }

.drawer-address {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}

.drawer-similar {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.drawer-similar-strip {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-top: var(--space-2);
  scrollbar-width: thin;
}
.drawer-similar-card {
  flex: 0 0 180px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  display: flex;
  gap: var(--space-2);
  align-items: center;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
  color: inherit;
  font: inherit;
}
.drawer-similar-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-1px);
}
.drawer-similar-avatar {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}
.drawer-similar-body {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.drawer-similar-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-similar-sub {
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-similar-meta {
  display: flex;
  gap: var(--space-1);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 2px;
}
.drawer-similar-reason { color: var(--purple); }
.drawer-similar-score { color: var(--green); }

.drawer-pipeline {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.drawer-pipeline-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-2);
}
.drawer-pipeline-stage {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  font-family: var(--font-sans);
  flex: 1;
}
.drawer-pipeline-stage:focus { outline: none; border-color: var(--purple); }
.drawer-pipeline-add {
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: filter var(--duration-fast) var(--ease-standard);
}
.drawer-pipeline-add:hover { filter: brightness(1.1); }
.drawer-pipeline-add:disabled { opacity: 0.5; cursor: not-allowed; }
.drawer-pipeline-status {
  margin-top: var(--space-2);
  font-size: 11px;
  color: var(--text-dim);
  min-height: 14px;
}

.drawer-compliance {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-dim);
}

.drawer-compliance strong { color: var(--text); font-weight: 600; }
.drawer-compliance a { color: var(--blue); text-decoration: none; margin-left: var(--space-1); }
.drawer-compliance a:hover { text-decoration: underline; }

.drawer-empty {
  padding: var(--space-10) var(--space-6);
  text-align: center;
  color: var(--muted);
}

.drawer-empty-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; margin-bottom: var(--space-2); color: var(--text); }
.drawer-empty-sub { font-size: 12px; }

/* Row click hint — only applies to dashboards that opt in via class */
.row-clickable { cursor: pointer; }
.row-clickable:hover td { background: rgba(255, 255, 255, 0.03); }
.row-clickable:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

body.drawer-open { overflow: hidden; }

/* ── Compliance chrome badge (header-friendly) ────────────────────────── */

.compliance-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface2);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-standard);
}

.compliance-chip:hover,
.compliance-chip:focus-visible {
  color: var(--text);
  border-color: var(--border-bright);
  outline: none;
}

.compliance-chip::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
  flex-shrink: 0;
}

/* ── Hot Right Now ribbon ────────────────────────────────────────────── */

.hot-ribbon {
  padding: var(--space-4) var(--space-6) var(--space-3);
  background: linear-gradient(
    180deg,
    rgba(245, 158, 11, 0.05) 0%,
    var(--surface) 100%
  );
  border-bottom: 1px solid var(--border);
}

.hot-ribbon-head {
  display: flex; align-items: baseline; gap: var(--space-4);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.hot-ribbon-title {
  display: flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.hot-ribbon-flame { font-size: 16px; filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.35)); }

.hot-ribbon-label { letter-spacing: 0.02em; }

.hot-ribbon-sub {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.hot-ribbon-scroll {
  display: flex; gap: var(--space-3);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scroll-snap-type: x proximity;
}

.hot-ribbon-scroll::-webkit-scrollbar { height: 4px; }
.hot-ribbon-scroll::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: var(--radius-pill); }

.hot-card {
  flex: 0 0 auto;
  width: 240px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  scroll-snap-align: start;
  transition: all var(--duration-fast) var(--ease-standard);
  display: flex; flex-direction: column; gap: var(--space-2);
}

.hot-card:hover,
.hot-card:focus-visible {
  border-color: rgba(245, 158, 11, 0.35);
  background: var(--surface3);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  outline: none;
}

.hot-card-top {
  display: flex; align-items: center; gap: var(--space-3);
}

.hot-card-avatar {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.hot-card-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hot-card-agency {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hot-card-meta {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.hot-card-pill {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--amber);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.hot-card-pill--green {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--green);
}

/* ── Command palette (⌘K) ────────────────────────────────────────────── */

.palette-overlay {
  position: fixed; inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(6px);
  z-index: var(--z-palette);
  animation: drawer-fade var(--duration-base) var(--ease-standard);
}

.palette-panel {
  position: fixed;
  top: 14vh; left: 50%;
  transform: translateX(-50%);
  width: min(640px, calc(100% - var(--space-8)));
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  z-index: calc(var(--z-palette) + 1);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: palette-pop var(--duration-base) var(--ease-emphasized);
}

@keyframes palette-pop {
  from { opacity: 0; transform: translate(-50%, -8px) scale(0.98); }
  to   { opacity: 1; transform: translate(-50%, 0)    scale(1); }
}

.palette-search-wrap {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.palette-search-kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.05em;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  flex-shrink: 0;
}

.palette-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  padding: var(--space-2) 0;
}

.palette-input::placeholder { color: var(--muted); }

.palette-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 10px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
}
.palette-close:hover { color: var(--text); border-color: var(--border-bright); }

.palette-results {
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-2) 0 var(--space-3);
}

.palette-group + .palette-group { border-top: 1px solid var(--border); }

.palette-group-title {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: var(--space-3) var(--space-5) var(--space-1);
}

.palette-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard);
}

.palette-item:hover,
.palette-item.is-active {
  background: rgba(59, 130, 246, 0.08);
}

.palette-item.is-active {
  box-shadow: inset 3px 0 0 var(--blue);
}

.palette-item-label {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.palette-item-label mark {
  background: transparent;
  color: var(--blue);
  font-weight: 700;
}

.palette-item-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.palette-empty {
  padding: var(--space-8) var(--space-5);
  text-align: center;
  color: var(--muted);
}

.palette-empty-title { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: var(--space-1); }
.palette-empty-sub   { font-size: 12px; }

.palette-footer {
  display: flex; gap: var(--space-4);
  padding: var(--space-2) var(--space-5);
  background: var(--surface2);
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--muted);
}

.palette-footer kbd {
  font-family: var(--font-mono);
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 1px 4px;
  margin-right: var(--space-1);
  color: var(--text-dim);
}

/* ── Pipeline kanban ─────────────────────────────────────────────────── */

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(220px, 1fr));
  gap: var(--space-4);
  padding: var(--space-6);
  overflow-x: auto;
  align-items: start;
}
@media (max-width: 1280px) {
  .pipeline-board { grid-template-columns: repeat(3, minmax(220px, 1fr)); }
}
@media (max-width: 720px) {
  .pipeline-board { grid-template-columns: 1fr; }
}

.pipeline-column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  min-height: 240px;
}
.pipeline-col-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.pipeline-col-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.pipeline-col-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}
.pipeline-col-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--surface2);
  border-radius: var(--radius-pill, 999px);
  padding: 2px 8px;
  flex-shrink: 0;
}
.pipeline-col-body {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 160px;
  transition: background var(--duration-fast) var(--ease-standard);
}
.pipeline-col-body.is-drop-target {
  background: color-mix(in srgb, var(--purple) 8%, transparent);
  outline: 1px dashed var(--purple);
  outline-offset: -6px;
}
.pipeline-empty-col {
  font-size: 12px;
  color: var(--muted);
  padding: var(--space-3);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  line-height: 1.5;
}

.pipeline-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  cursor: grab;
  transition: border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard),
              transform var(--duration-fast) var(--ease-standard);
}
.pipeline-card:hover {
  border-color: var(--border-bright);
  box-shadow: var(--shadow-sm);
}
.pipeline-card.is-dragging {
  opacity: 0.6;
  cursor: grabbing;
  transform: rotate(-1deg);
}
.pipeline-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}
.pipeline-card-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.25;
  word-break: break-word;
}
.pipeline-card-business {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.pipeline-card-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}
.pipeline-card-remove:hover { color: var(--red); background: var(--surface3); }
.pipeline-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  gap: var(--space-2);
}
.pipeline-card-updated { font-family: var(--font-mono); }
.pipeline-card-stats {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}
.pipeline-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface3);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.pipeline-chip.ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, var(--border)); }
.pipeline-chip.bad { color: var(--muted); }
.pipeline-chip.green { color: var(--green); }
.pipeline-chip.amber { color: var(--amber); }

.pipeline-empty {
  grid-column: 1 / -1;
}
