/* =============================================================
   CoreIQ Office — Suppliers module styles
   Builds on tokens.css + styles.css + office.css. Prefix: .sup-
   ============================================================= */

/* -------------------------------------------------------------
   DIRECTORY
   ------------------------------------------------------------- */
.sup-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.sup-toolbar-spacer { flex: 1; }
.sup-tool-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-subtle); font-weight: 600; }

/* type filter pills */
.sup-typefilter { display: inline-flex; gap: 6px; }
.sup-typepill {
  font: inherit; font-size: 12.5px; font-weight: 500;
  padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
}
.sup-typepill:hover { border-color: var(--text-subtle); color: var(--text); }
.sup-typepill--active { border-color: var(--brand); background: var(--brand-bg); color: var(--brand); }
.sup-typepill-dot { width: 8px; height: 8px; border-radius: 3px; }

.sup-period {
  display: inline-flex; background: var(--bg-muted); border-radius: 9px; padding: 3px; gap: 2px;
}
.sup-period-btn {
  font: inherit; font-size: 12.5px; font-weight: 500;
  padding: 5px 12px; border-radius: 7px; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer; white-space: nowrap;
}
.sup-period-btn--active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* KPI strip atop the directory */
.sup-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.sup-kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
}
.sup-kpi-l { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-subtle); font-weight: 600; }
.sup-kpi-v { font-size: 25px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 3px; }
.sup-kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 5px; }

/* directory table */
.sup-table {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.sup-row {
  display: grid;
  grid-template-columns: 104px 2fr 118px minmax(120px, 1.4fr) 92px 92px 60px 34px;
  align-items: center; gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.sup-row:last-child { border-bottom: none; }
.sup-row--head {
  background: var(--bg-subtle);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-subtle); font-weight: 600;
  padding-top: 10px; padding-bottom: 10px;
}
.sup-row--head button {
  font: inherit; background: none; border: none; cursor: pointer; color: inherit;
  text-transform: inherit; letter-spacing: inherit; font-weight: inherit;
  display: inline-flex; align-items: center; gap: 4px; padding: 0;
}
.sup-row--head button:hover { color: var(--text); }
.sup-row--head .sup-sort-ic { opacity: 0.5; }
.sup-row--body { cursor: pointer; transition: background var(--dur-fast) var(--ease-out); }
.sup-row--body:hover { background: var(--bg-subtle); }

.sup-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sup-logo {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700; color: #fff;
  letter-spacing: -0.02em;
}
.sup-id-meta { min-width: 0; }
.sup-id-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.sup-id-name-star { color: var(--hold); display: inline-flex; }
.sup-id-name-star svg { width: 13px; height: 13px; }
.sup-id-sub { font-size: 11.5px; color: var(--text-subtle); font-family: var(--font-mono); margin-top: 1px; }

.sup-type-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 99px;
  border: 1px solid var(--border);
}
.sup-type-dot { width: 7px; height: 7px; border-radius: 2px; }

/* order-line cell */
.sup-line { display: flex; align-items: center; gap: 6px; }
.sup-line-badge {
  font-size: 11px; font-weight: 600; white-space: nowrap;
  padding: 3px 8px; border-radius: 7px;
  border: 1px solid transparent;
}
.sup-line-badge--n1 { background: var(--brand-bg); color: var(--brand); border-color: var(--brand-border); }
.sup-line-badge--n2 { background: var(--hold-bg); color: var(--hold-text); border-color: var(--hold-border); }
.sup-line-badge--n3 { background: color-mix(in srgb, var(--text-subtle) 16%, transparent); color: var(--text-muted); }
.sup-line-badge--nx { background: var(--bg-muted); color: var(--text-muted); }
.sup-line-badge--direct { background: color-mix(in srgb, #7A5AF8 14%, transparent); color: #6645e0; }
.sup-line-badge--program { background: color-mix(in srgb, #1F8A5B 14%, transparent); color: #16774c; }
.sup-line-moves { display: flex; flex-direction: column; gap: 1px; opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); }
.sup-row--body:hover .sup-line-moves { opacity: 1; }
.sup-line-move {
  width: 16px; height: 13px; padding: 0; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); cursor: pointer;
  border-radius: 4px; display: grid; place-items: center;
}
.sup-line-move:hover { border-color: var(--brand); color: var(--brand); }
.sup-line-move:disabled { opacity: 0.3; cursor: default; }
.sup-line-move svg { width: 9px; height: 9px; }

/* line badge inline (profile hero) */
.sup-hero-line {
  font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 7px;
  background: var(--brand-bg); color: var(--brand);
}

/* -------------------------------------------------------------
   NEW SUPPLIER MODAL
   ------------------------------------------------------------- */
.sup-modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8, 17, 30, 0.55); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
}
.sup-modal {
  width: 540px; max-width: 100%;
  background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow-lg, 0 40px 80px -20px rgba(0,0,0,0.5));
  max-height: 90vh; display: flex; flex-direction: column;
}
.sup-modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border-subtle); }
.sup-modal-head-ic { width: 36px; height: 36px; border-radius: 9px; background: var(--brand-bg); color: var(--brand); display: grid; place-items: center; flex-shrink: 0; }
.sup-modal-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.sup-modal-sub { font-size: 12px; color: var(--text-muted); }
.sup-modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.sup-modal-foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border-subtle); }
.sup-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sup-form-grid .sup-form-full { grid-column: 1 / -1; }
.sup-field-label { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 5px; display: block; }
.sup-line-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.sup-line-opt {
  font: inherit; font-size: 12.5px; font-weight: 500;
  padding: 7px 11px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
}
.sup-line-opt--active { border-color: var(--brand); background: var(--brand-bg); color: var(--brand); }
.sup-modal-hint { font-size: 12px; color: var(--text-subtle); line-height: 1.5; }

/* spend cell with mini share bar */
.sup-spend { min-width: 0; }
.sup-spend-v { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.sup-spend-bar { height: 5px; border-radius: 99px; background: var(--bg-muted); overflow: hidden; margin-top: 5px; }
.sup-spend-bar > i { display: block; height: 100%; border-radius: 99px; }
.sup-spend-share { font-size: 11px; color: var(--text-subtle); margin-top: 3px; }

.sup-metric-cell { font-variant-numeric: tabular-nums; }
.sup-metric-v { font-weight: 600; font-size: 14px; }
.sup-metric-sub { font-size: 11px; color: var(--text-subtle); margin-top: 1px; }

/* perf chip (on-time / difot) */
.sup-perf {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.sup-perf-dot { width: 8px; height: 8px; border-radius: 99px; }
.sup-perf--good .sup-perf-dot { background: var(--paid); }
.sup-perf--mid .sup-perf-dot { background: var(--hold); }
.sup-perf--bad .sup-perf-dot { background: var(--void); }
.sup-perf--bad { color: var(--void); }

/* -------------------------------------------------------------
   CARD GRID (tweak alt layout)
   ------------------------------------------------------------- */
.sup-cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.sup-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.sup-card:hover { border-color: var(--text-subtle); box-shadow: var(--shadow-sm); }
.sup-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sup-card-logo { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.sup-card-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 6px; }
.sup-card-sub { font-size: 12px; color: var(--text-subtle); margin-top: 1px; }
.sup-card-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding-top: 14px; border-top: 1px solid var(--border-subtle); }
.sup-card-kpi-l { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-subtle); font-weight: 600; }
.sup-card-kpi-v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 1px; }

/* -------------------------------------------------------------
   PROFILE PAGE
   ------------------------------------------------------------- */
.sup-profile { display: flex; flex-direction: column; gap: 0; }

.sup-back {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 12.5px; font-weight: 500; color: var(--text-muted);
  background: none; border: none; cursor: pointer; padding: 0; margin-bottom: 10px;
}
.sup-back:hover { color: var(--text); }
.sup-back svg { width: 13px; height: 13px; }

.sup-hero {
  display: flex; align-items: flex-start; gap: 16px;
  padding-bottom: 16px;
}
.sup-hero-logo {
  width: 60px; height: 60px; border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 21px;
  letter-spacing: -0.02em;
}
.sup-hero-meta { flex: 1; min-width: 0; }
.sup-hero-name { font-size: 23px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; display: flex; align-items: center; gap: 10px; }
.sup-hero-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; color: var(--text-muted); }
.sup-hero-sub .is-mono { font-family: var(--font-mono); font-size: 12px; }
.sup-hero-dot { color: var(--text-subtle); }
.sup-hero-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* tab bar */
.sup-tabs {
  display: flex; gap: 2px; align-items: center;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
}
.sup-tab {
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 11px 14px; border: none; background: none; cursor: pointer;
  color: var(--text-muted); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 7px;
}
.sup-tab:hover { color: var(--text); }
.sup-tab--active { color: var(--brand); border-bottom-color: var(--brand); }
.sup-tab-count {
  font-size: 11px; font-variant-numeric: tabular-nums;
  background: var(--bg-muted); color: var(--text-muted);
  border-radius: 99px; padding: 0 6px; font-weight: 600;
}
.sup-tab--active .sup-tab-count { background: var(--brand-bg); color: var(--brand); }

/* generic section card */
.sup-sec {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.sup-sec + .sup-sec { margin-top: 14px; }
.sup-sec-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-bottom: 1px solid var(--border-subtle);
}
.sup-sec-title { font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.sup-sec-head .sup-sec-action { margin-left: auto; }
.sup-sec-body { padding: 16px 18px; }

.sup-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .sup-cols { grid-template-columns: 1fr; } }

/* overview KPI tiles */
.sup-ov-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
@media (max-width: 760px) { .sup-ov-kpis { grid-template-columns: repeat(2, 1fr); } }

/* key-value rows */
.sup-kv { display: flex; flex-direction: column; }
.sup-kv-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--border-subtle); font-size: 13px;
}
.sup-kv-row:last-child { border-bottom: none; }
.sup-kv-k { color: var(--text-muted); }
.sup-kv-v { font-weight: 500; text-align: right; }
.sup-kv-v.is-mono { font-family: var(--font-mono); font-size: 12px; font-weight: 400; }

/* spend trend bars */
.sup-trend { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 8px; }
.sup-trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.sup-trend-bar { width: 100%; max-width: 26px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 3px; transition: height var(--dur-base) var(--ease-out); }
.sup-trend-bar--dim { background: var(--brand-bg-strong, color-mix(in srgb, var(--brand) 30%, transparent)); }
.sup-trend-x { font-size: 9.5px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }

/* performance bars */
.sup-perfbar { margin-bottom: 14px; }
.sup-perfbar:last-child { margin-bottom: 0; }
.sup-perfbar-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.sup-perfbar-l { font-size: 13px; font-weight: 500; }
.sup-perfbar-v { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sup-perfbar-track { height: 8px; border-radius: 99px; background: var(--bg-muted); overflow: hidden; }
.sup-perfbar-track > i { display: block; height: 100%; border-radius: 99px; }
.sup-perfbar-sub { font-size: 11.5px; color: var(--text-subtle); margin-top: 4px; }

/* generic grid table inside tabs */
.sup-grid { width: 100%; }
.sup-grid-row {
  display: grid; align-items: center; gap: 12px;
  padding: 11px 18px; border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.sup-grid-row:last-child { border-bottom: none; }
.sup-grid-row--head {
  background: var(--bg-subtle);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-subtle); font-weight: 600;
}
.sup-grid-row--body { cursor: default; }
.sup-grid-strong { font-weight: 500; }
.sup-grid-mono { font-family: var(--font-mono); font-size: 12px; }
.sup-grid-num { font-variant-numeric: tabular-nums; text-align: right; }
.sup-grid-muted { color: var(--text-subtle); }

/* accounts list */
.sup-acct {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border-subtle);
}
.sup-acct:last-child { border-bottom: none; }
.sup-acct-av {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: var(--navy-800); color: var(--teal-300);
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.sup-acct-meta { flex: 1; min-width: 0; }
.sup-acct-store { font-weight: 500; font-size: 13.5px; }
.sup-acct-num { font-size: 12px; color: var(--text-subtle); font-family: var(--font-mono); margin-top: 1px; }

/* documents */
.sup-doc {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border-subtle);
}
.sup-doc:last-child { border-bottom: none; }
.sup-doc-ic {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: var(--bg-muted); color: var(--text-muted);
  display: grid; place-items: center;
}
.sup-doc-ic svg { width: 16px; height: 16px; }
.sup-doc-meta { flex: 1; min-width: 0; }
.sup-doc-name { font-weight: 500; font-size: 13.5px; }
.sup-doc-sub { font-size: 11.5px; color: var(--text-subtle); margin-top: 1px; }

/* rep contact block */
.sup-rep { display: flex; align-items: center; gap: 12px; }
.sup-rep-av {
  width: 44px; height: 44px; border-radius: 99px; flex-shrink: 0;
  background: var(--brand-bg); color: var(--brand);
  display: grid; place-items: center; font-size: 15px; font-weight: 600;
}
.sup-rep-name { font-weight: 600; font-size: 14px; }
.sup-rep-title { font-size: 12px; color: var(--text-muted); }
.sup-rep-contacts { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.sup-rep-contact { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.sup-rep-contact svg { width: 14px; height: 14px; color: var(--text-subtle); flex-shrink: 0; }
.sup-rep-contact a { color: var(--brand); text-decoration: none; }
.sup-rep-contact a:hover { text-decoration: underline; }

/* status pills reuse badge; helper tints */
.sup-mini-bar { display: flex; gap: 7px; align-items: center; }

/* alert banner inside profile */
.sup-alert {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 10px; font-size: 13px;
  background: var(--hold-bg); color: var(--hold-text); border: 1px solid var(--hold-border);
  margin-bottom: 14px;
}
.sup-alert svg { width: 16px; height: 16px; flex-shrink: 0; }
.sup-alert--bad { background: var(--void-bg); color: var(--void-text); border-color: var(--void-border); }

/* density tweak */
.office-shell[data-density="compact"] .sup-row { padding-top: 9px; padding-bottom: 9px; }
.office-shell[data-density="compact"] .sup-sec-body { padding-top: 12px; padding-bottom: 12px; }
.office-shell[data-density="compact"] .sup-grid-row { padding-top: 8px; padding-bottom: 8px; }

@media (max-width: 920px) {
  .sup-row { grid-template-columns: 96px 1.8fr 1fr 84px 34px; }
  .sup-row .sup-col-hide { display: none; }
  .sup-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .sup-ov-kpis { grid-template-columns: repeat(2, 1fr); }
}
