/*
 * RFQMS Admin Panel — light theme
 * Plain hand-written CSS, no build step. Loaded directly via <link>.
 * Layers on top of Bootstrap 5 (CDN) for grid/forms/components.
 */

:root {
  --rfq-bg: #f4f6fb;
  --rfq-surface: #ffffff;
  --rfq-border: #e6e9f2;
  --rfq-text: #1f2430;
  --rfq-text-muted: #6b7280;
  --rfq-primary: #4f6df5;
  --rfq-primary-dark: #3b53d1;
  --rfq-primary-soft: #eef1fe;
  --rfq-sidebar-bg: #ffffff;
  --rfq-sidebar-active: #eef1fe;
  --rfq-danger: #e5484d;
  --rfq-success: #1a9c6a;
  --rfq-radius: 0.55rem;
  --rfq-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  background-color: var(--rfq-bg);
  color: var(--rfq-text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.825rem;
}

a {
  color: var(--rfq-primary);
  text-decoration: none;
}

a:hover {
  color: var(--rfq-primary-dark);
}

/* ---------- Compact type scale ---------- */
/* Bootstrap's default heading sizes assume a 16px body; dial them back to
   match our smaller base so the admin panel reads as dense, not just narrow. */

h1, .h1 { font-size: 1.3rem; }
h2, .h2 { font-size: 1.1rem; }
h3, .h3 { font-size: 1rem; }
h4, .h4 { font-size: 0.95rem; }
h5, .h5 { font-size: 0.9rem; }
h6, .h6 { font-size: 0.85rem; }

.form-label {
  font-weight: 600;
  font-size: 0.78rem;
  margin-bottom: 0.3rem;
}

.form-control,
.form-select {
  font-size: 0.82rem;
}

.form-control {
  padding: 0.32rem 0.65rem;
}

.form-select {
  padding-top: 0.32rem;
  padding-bottom: 0.32rem;
}

.form-text {
  font-size: 0.72rem;
}

.btn {
  font-size: 0.82rem;
  padding: 0.35rem 0.8rem;
}

.btn-sm {
  font-size: 0.74rem;
  padding: 0.22rem 0.55rem;
}

.dropdown-menu {
  font-size: 0.82rem;
}

.alert {
  padding: 0.65rem 0.9rem;
  font-size: 0.82rem;
}

/* ---------- App shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--rfq-sidebar-bg);
  border-right: 1px solid var(--rfq-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.1rem;
  border-bottom: 1px solid var(--rfq-border);
}

.sidebar-logo {
  max-width: 100%;
  height: auto;
  display: block;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--rfq-primary), #7c8cf8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
}

.sidebar-nav {
  flex: 1;
  padding: 0.7rem;
}

.sidebar-section-title {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rfq-text-muted);
  padding: 0.65rem 0.65rem 0.3rem;
  font-weight: 700;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.42rem 0.65rem;
  border-radius: var(--rfq-radius);
  color: var(--rfq-text);
  font-weight: 500;
  font-size: 0.82rem;
  margin-bottom: 0.1rem;
}

.sidebar-nav .nav-link i {
  font-size: 0.95rem;
  color: var(--rfq-text-muted);
  width: 1.1rem;
  text-align: center;
}

.nav-link-label {
  flex: 1;
}

.nav-link-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.sidebar-nav .nav-link:hover {
  background: var(--rfq-bg);
}

.sidebar-nav .nav-link.active {
  background: var(--rfq-sidebar-active);
  color: var(--rfq-primary-dark);
}

.sidebar-nav .nav-link.active i {
  color: var(--rfq-primary-dark);
}

.sidebar-footer {
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--rfq-border);
  font-size: 0.7rem;
  color: var(--rfq-text-muted);
}

/* ---------- Main column ---------- */

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--rfq-surface);
  border-bottom: 1px solid var(--rfq-border);
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
}

.topbar .breadcrumb {
  margin: 0;
  font-size: 0.74rem;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: transparent;
  border: 1px solid var(--rfq-border);
  border-radius: 999px;
  padding: 0.25rem 0.75rem 0.25rem 0.25rem;
  color: var(--rfq-text);
  font-size: 0.8rem;
}

.user-avatar {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--rfq-primary-soft);
  color: var(--rfq-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
}

.page-body {
  padding: 1.1rem;
  flex: 1;
}

/* ---------- Cards / surfaces ---------- */

.card {
  border: 1px solid var(--rfq-border);
  border-radius: var(--rfq-radius);
  box-shadow: var(--rfq-shadow);
}

.card-body {
  padding: 0.9rem 1rem;
}

.card-header,
.card-footer {
  padding: 0.55rem 1rem;
  background: var(--rfq-surface);
  border-color: var(--rfq-border);
  font-weight: 600;
  font-size: 0.85rem;
}

.stat-card {
  background: var(--rfq-surface);
  border: 1px solid var(--rfq-border);
  border-radius: var(--rfq-radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--rfq-shadow);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.stat-card:hover {
  box-shadow: 0 6px 18px rgba(31, 41, 55, 0.08);
  transform: translateY(-1px);
}

.stat-card .stat-label {
  font-size: 0.72rem;
  color: var(--rfq-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 0.1rem;
}

.stat-card .stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rfq-primary-soft);
  color: var(--rfq-primary-dark);
  font-size: 1rem;
}

.stat-card .stat-icon.stat-icon-warning {
  background: #fef3e2;
  color: #b45309;
}

.stat-card .stat-icon.stat-icon-success {
  background: #e6f7ee;
  color: #157347;
}

.stat-card .stat-icon.stat-icon-violet {
  background: #f0ebfc;
  color: #6f42c1;
}

.stat-card .stat-icon.stat-icon-teal {
  background: #e6f6f4;
  color: #0f766e;
}

/* ---------- Dashboard header ---------- */

.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.dashboard-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--rfq-text-muted);
  margin-bottom: 0.2rem;
}

.dashboard-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
}

.dashboard-subtitle {
  color: var(--rfq-text-muted);
  font-size: 0.85rem;
}

/* ---------- Dashboard notifications panel ---------- */

.dashboard-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.7rem;
  border-radius: var(--rfq-radius);
  border: 1px solid var(--rfq-border);
  margin-bottom: 0.6rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dashboard-notice:last-child {
  margin-bottom: 0;
}

.dashboard-notice:hover {
  background: var(--rfq-bg);
  color: inherit;
}

.dashboard-notice-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.95rem;
}

.dashboard-notice-title {
  display: block;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--rfq-text);
}

.dashboard-notice-desc {
  display: block;
  font-size: 0.74rem;
  color: var(--rfq-text-muted);
  margin-top: 0.1rem;
}

.dashboard-notice-danger .dashboard-notice-icon {
  background: #fde8e8;
  color: #c81e1e;
}

.dashboard-notice-warning .dashboard-notice-icon {
  background: #fef3e2;
  color: #b45309;
}

.dashboard-notice-primary .dashboard-notice-icon {
  background: var(--rfq-primary-soft);
  color: var(--rfq-primary-dark);
}

.dashboard-notice-success .dashboard-notice-icon {
  background: #e6f7ee;
  color: #157347;
}

.dashboard-notice-empty {
  text-align: center;
  padding: 1.5rem 0.5rem;
  color: var(--rfq-text);
}

.dashboard-notice-empty i {
  font-size: 1.75rem;
  color: #157347;
  margin-bottom: 0.5rem;
  display: inline-block;
}

/* ---------- Tables ---------- */

.table {
  --bs-table-bg: var(--rfq-surface);
  font-size: 0.8rem;
}

.table thead th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rfq-text-muted);
  border-bottom-width: 1px;
  font-weight: 700;
  background: var(--rfq-bg);
}

.table td, .table th {
  vertical-align: middle;
  padding: 0.55rem 0.85rem;
}

/* ---------- Buttons ---------- */

.btn-primary {
  background-color: var(--rfq-primary);
  border-color: var(--rfq-primary);
}

.btn-primary:hover, .btn-primary:focus {
  background-color: var(--rfq-primary-dark);
  border-color: var(--rfq-primary-dark);
}

.btn-outline-primary {
  color: var(--rfq-primary);
  border-color: var(--rfq-primary);
}

.btn-outline-primary:hover {
  background-color: var(--rfq-primary);
  border-color: var(--rfq-primary);
}

/* ---------- Switches ---------- */

.form-check-input:checked {
  background-color: var(--rfq-primary);
  border-color: var(--rfq-primary);
}

.form-check-input:focus {
  border-color: var(--rfq-primary);
  box-shadow: 0 0 0 0.2rem rgba(79, 109, 245, 0.15);
}

.form-switch .form-check-input {
  width: 2.1em;
  cursor: pointer;
}

.role-card {
  transition: box-shadow 0.15s ease;
}

.role-card:hover {
  box-shadow: 0 4px 14px rgba(31, 41, 55, 0.08);
}

/* ---------- Misc ---------- */

.badge-soft-primary {
  background: var(--rfq-primary-soft);
  color: var(--rfq-primary-dark);
  font-weight: 600;
  padding: 0.3em 0.6em;
  font-size: 0.72rem;
}

.badge-soft-secondary {
  background: #f1f2f6;
  color: var(--rfq-text-muted);
  font-weight: 600;
  padding: 0.3em 0.6em;
  font-size: 0.72rem;
}

.badge-soft-warning {
  background: #fef3e2;
  color: #b45309;
  font-weight: 600;
  padding: 0.3em 0.6em;
  font-size: 0.72rem;
}

.badge-soft-success {
  background: #e6f7ee;
  color: #157347;
  font-weight: 600;
  padding: 0.3em 0.6em;
  font-size: 0.72rem;
}

.badge-soft-danger {
  background: #fde8e8;
  color: #c81e1e;
  font-weight: 600;
  padding: 0.3em 0.6em;
  font-size: 0.72rem;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f4f6fb 0%, #eceffb 100%);
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--rfq-surface);
  border: 1px solid var(--rfq-border);
  border-radius: 0.8rem;
  box-shadow: 0 10px 30px rgba(31, 41, 55, 0.08);
  padding: 1.9rem 1.75rem;
}

.text-muted-soft {
  color: var(--rfq-text-muted);
}

.role-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
}

.role-pick-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border: 1px solid var(--rfq-border);
  border-radius: var(--rfq-radius);
  padding: 0.55rem 1.3rem 0.55rem 0.7rem;
  background: var(--rfq-surface);
  cursor: pointer;
  margin-bottom: 0;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.role-pick-card:hover {
  border-color: var(--rfq-primary);
}

.role-pick-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.role-pick-check {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  color: var(--rfq-border);
  font-size: 0.9rem;
  line-height: 1;
  transition: color 0.15s ease;
}

.role-pick-name {
  font-weight: 600;
  font-size: 0.8rem;
}

.role-pick-desc {
  font-size: 0.68rem;
  color: var(--rfq-text-muted);
  line-height: 1.3;
}

.role-pick-inactive {
  align-self: flex-start;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #b45309;
  background: #fef3e2;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  margin-top: 0.1rem;
}

.role-pick-card.selected,
.role-pick-card:has(.role-pick-input:checked) {
  border-color: var(--rfq-primary);
  background: var(--rfq-primary-soft);
}

.role-pick-card.selected .role-pick-check,
.role-pick-card:has(.role-pick-input:checked) .role-pick-check {
  color: var(--rfq-primary);
}

.assignee-cluster {
  display: inline-flex;
  align-items: center;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.assignee-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--rfq-primary-soft);
  color: var(--rfq-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  border: 2px solid var(--rfq-surface);
  margin-left: -8px;
  flex-shrink: 0;
}

.assignee-avatar:first-child {
  margin-left: 0;
}

.assignee-avatar-more {
  background: #f1f2f6;
  color: var(--rfq-text-muted);
}

.assignee-email {
  font-size: 0.7rem;
}

/* ---------- Ready for Data Entry — "By Sourcing" rows ---------- */

.js-de-sourcing-row {
  cursor: pointer;
}

.js-de-sourcing-row:hover {
  background: var(--rfq-bg);
}

.rfq-de-sourcing-rows {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rfq-de-sourcing-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--rfq-text-muted);
  background: #fff;
  border: 1px solid var(--rfq-border);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
}

.rfq-de-sourcing-row i {
  font-size: 0.85rem;
  flex-shrink: 0;
}

.rfq-de-sourcing-row-name {
  flex: 1;
  color: var(--rfq-text);
}

.rfq-de-sourcing-row-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--rfq-primary-dark);
  background: var(--rfq-bg);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.rfq-de-sourcing-row.is-completed .rfq-de-sourcing-row-number {
  color: #157347;
  background: #fff;
}

.rfq-de-sourcing-row.is-completed {
  color: #157347;
  background: #e6f7ee;
  border-color: transparent;
}

.rfq-de-sourcing-row.is-completed .rfq-de-sourcing-row-name,
.rfq-de-sourcing-row.is-completed i {
  color: #157347;
}

.rfq-de-sourcing-row-status {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--rfq-text-muted);
  flex-shrink: 0;
}

.rfq-de-sourcing-row.is-completed .rfq-de-sourcing-row-status {
  color: #157347;
}

.rfq-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.rfq-detail-grid dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rfq-text-muted);
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.rfq-detail-grid dd {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0;
}

/* ---------- RFQ comments ---------- */

.rfq-comment {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--rfq-border);
}

.rfq-comment:first-child {
  padding-top: 0;
}

.rfq-comment:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.rfq-comment-body {
  flex: 1;
  min-width: 0;
}

.rfq-comment-meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
}

.rfq-comment-reply-toggle {
  font-size: 0.75rem;
  color: var(--rfq-text-muted);
  text-decoration: none;
}

.rfq-comment-reply-toggle:hover {
  color: var(--rfq-primary);
}

.rfq-comment-replies {
  margin-top: 0.6rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--rfq-border);
  display: flex;
  flex-direction: column;
}

.rfq-comment-replies .rfq-comment {
  padding: 0.6rem 0;
}

.rfq-comment-replies .rfq-comment:first-child {
  padding-top: 0;
}

.rfq-comment-reply-form textarea {
  font-size: 0.85rem;
  resize: vertical;
}

.rfq-list-subnote {
  margin-top: 0.2rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: #157347;
}

.rfq-list-subnote i {
  margin-right: 0.15rem;
}

.rfq-list-subnote-returned {
  color: #b02a37;
}

.mention-highlight {
  color: var(--rfq-primary-dark);
  background: var(--rfq-primary-soft);
  border-radius: 4px;
  padding: 0 0.2rem;
  font-weight: 600;
}

.mention-dropdown {
  position: absolute;
  z-index: 1080;
  background: #fff;
  border: 1px solid var(--rfq-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  padding: 0.3rem;
  max-height: 220px;
  overflow-y: auto;
}

.mention-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.35rem 0.6rem;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--rfq-text);
}

.mention-dropdown-item.is-active,
.mention-dropdown-item:hover {
  background: var(--rfq-primary-soft);
  color: var(--rfq-primary-dark);
}

/* ---------- List/detail view toggle (Ready for Data Entry) ---------- */

.rfq-view-toggle {
  gap: 0.4rem;
}

.rfq-view-toggle .nav-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--rfq-text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--rfq-border);
}

.rfq-view-toggle .nav-link.active {
  color: #fff;
  background: var(--rfq-primary);
  border-color: var(--rfq-primary);
}

/* ---------- Role-restricted (blurred) content ---------- */
/* Some roles can see that a feature exists without being able to read or
   use it — the content stays present but blurred + inert, with a small
   lock badge explaining why, rather than vanishing outright. */

.rfq-blurred {
  filter: blur(4px);
  opacity: 0.65;
  pointer-events: none;
  user-select: none;
}

.rfq-locked-panel {
  position: relative;
}

.rfq-locked-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  z-index: 2;
  text-align: center;
  padding: 1rem;
  pointer-events: none;
}

.rfq-locked-overlay i {
  font-size: 1.3rem;
  color: var(--rfq-text-muted);
}

.rfq-locked-overlay span {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--rfq-text-muted);
}

/* ---------- RFQ progress flow chart ---------- */

.rfq-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.rfq-flow-node {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  background: var(--rfq-surface);
  border: 1px solid var(--rfq-border);
  border-radius: var(--rfq-radius);
  padding: 0.7rem 0.9rem;
  min-width: 210px;
}

.rfq-flow-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rfq-primary-soft);
  color: var(--rfq-primary-dark);
  flex-shrink: 0;
  font-size: 0.95rem;
}

.rfq-flow-node-assigned .rfq-flow-icon {
  background: #e6f7ee;
  color: #157347;
}

.rfq-flow-node-operations .rfq-flow-icon {
  background: #f0ebfc;
  color: #6f42c1;
}

.rfq-flow-node-pending {
  border-style: dashed;
}

.rfq-flow-node-pending .rfq-flow-icon {
  background: #f1f2f6;
  color: var(--rfq-text-muted);
}

.rfq-flow-title {
  font-weight: 700;
  font-size: 0.8rem;
}

.rfq-flow-meta {
  font-size: 0.72rem;
  color: var(--rfq-text-muted);
  line-height: 1.5;
}

.rfq-flow-meta-done {
  color: #157347;
  font-weight: 700;
}

.rfq-flow-connector {
  width: 28px;
  height: 2px;
  background: var(--rfq-border);
  flex-shrink: 0;
}

.rfq-flow-branches {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
  padding-left: 28px;
}

.rfq-flow-branches::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20px;
  bottom: 20px;
  width: 2px;
  background: var(--rfq-border);
}

.rfq-flow-branches:has(.rfq-flow-branch:only-child)::before {
  top: 50%;
  bottom: 50%;
}

.rfq-flow-branch {
  position: relative;
}

.rfq-flow-branch::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 50%;
  width: 28px;
  height: 2px;
  background: var(--rfq-border);
}

@media (max-width: 767.98px) {
  .rfq-flow {
    flex-direction: column;
    align-items: stretch;
  }

  .rfq-flow-connector {
    width: 2px;
    height: 20px;
    margin-left: 20px;
  }

  .rfq-flow-branches {
    padding-left: 0;
    padding-top: 0;
  }

  .rfq-flow-branches::before,
  .rfq-flow-branch::before {
    display: none;
  }
}

/* ---------- RFQ activity timeline ---------- */
/* Every lifecycle event (created, assigned, completed, returned, handed
   off, closed) plus every comment/reply, one flat vertical list ordered
   oldest-first — see Rfq::activityTimeline(). Comment entries reuse the
   .rfq-comment markup inside the timeline content column, with the
   surrounding border/padding suppressed so the timeline connector reads
   as the only separator. */

.rfq-timeline {
  display: flex;
  flex-direction: column;
}

.rfq-timeline-item {
  display: flex;
  gap: 0.85rem;
  position: relative;
  padding-bottom: 1.25rem;
}

.rfq-timeline-item:last-child {
  padding-bottom: 0;
}

.rfq-timeline-item::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 0;
  width: 2px;
  background: var(--rfq-border);
}

.rfq-timeline-item:last-child::before {
  display: none;
}

.rfq-timeline-marker {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f2f6;
  color: var(--rfq-text-muted);
  flex-shrink: 0;
  font-size: 0.9rem;
  z-index: 1;
}

.rfq-timeline-item-primary .rfq-timeline-marker {
  background: var(--rfq-primary-soft);
  color: var(--rfq-primary-dark);
}

.rfq-timeline-item-secondary .rfq-timeline-marker {
  background: #f0ebfc;
  color: #6f42c1;
}

.rfq-timeline-item-success .rfq-timeline-marker {
  background: #e6f7ee;
  color: #157347;
}

.rfq-timeline-item-danger .rfq-timeline-marker {
  background: #fbe7e8;
  color: var(--rfq-danger);
}

.rfq-timeline-item-info .rfq-timeline-marker {
  background: #e7f1fb;
  color: #1970b8;
}

.rfq-timeline-content {
  flex: 1;
  min-width: 0;
  padding-top: 0.3rem;
}

.rfq-timeline-title {
  font-weight: 700;
  font-size: 0.82rem;
}

.rfq-timeline-meta {
  font-size: 0.76rem;
  color: var(--rfq-text-muted);
  margin-top: 0.1rem;
}

.rfq-timeline-detail {
  font-size: 0.76rem;
  margin-top: 0.2rem;
}

.rfq-timeline-item-comment .rfq-timeline-content {
  padding-top: 0;
}

.rfq-timeline-item-comment .rfq-comment {
  border-bottom: none;
  padding: 0;
}

.permission-group {
  border: 1px solid var(--rfq-border);
  border-radius: var(--rfq-radius);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.6rem;
  background: var(--rfq-bg);
}

.permission-group .group-title {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: capitalize;
  margin-bottom: 0.4rem;
  color: var(--rfq-text-muted);
}

.modal-header,
.modal-footer {
  padding: 0.7rem 1rem;
}

.modal-body {
  padding: 1rem;
}

.modal-title {
  font-size: 0.95rem;
  font-weight: 700;
}

/* ---------- Time-range filter bar ---------- */

.range-filter {
  display: inline-flex;
  gap: 2px;
  border: 1px solid var(--rfq-border);
  border-radius: 999px;
  padding: 2px;
  background: var(--rfq-surface);
}

.range-filter-btn {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--rfq-text-muted);
  white-space: nowrap;
}

.range-filter-btn:hover {
  background: var(--rfq-bg);
  color: var(--rfq-text);
}

.range-filter-btn.active {
  background: var(--rfq-primary);
  color: #fff;
}

/* ---------- RFQ activity chart ---------- */
/* Colors are validated for CVD-safe adjacent separation — see
   scripts/validate_palette.js in the dataviz skill ("#3b53d1,#157347" passes
   all checks against a white surface). Pending = blue, Completed = green,
   matching the badge-soft-* colors used for RFQ status elsewhere. */

.rfq-chart {
  position: relative;
}

.rfq-chart-empty {
  padding: 2.5rem 0;
  text-align: center;
}

.rfq-chart-wrap {
  position: relative;
}

.rfq-chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.rfq-chart-gridline {
  stroke: var(--rfq-border);
  stroke-width: 1;
}

.rfq-chart-tick {
  font-size: 10px;
  fill: var(--rfq-text-muted);
}

.rfq-chart-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: opacity 0.15s ease;
}

.rfq-chart-enddot {
  stroke: var(--rfq-surface);
  stroke-width: 2;
  transition: opacity 0.15s ease;
}

.rfq-chart-endlabel {
  font-size: 10px;
  font-weight: 700;
  fill: var(--rfq-text);
}

.rfq-chart-crosshair {
  stroke: var(--rfq-text-muted);
  stroke-width: 1;
  opacity: 0;
  pointer-events: none;
}

.rfq-chart-overlay {
  fill: transparent;
  cursor: crosshair;
}

.rfq-chart-tooltip {
  position: absolute;
  top: 6%;
  min-width: 140px;
  background: var(--rfq-text);
  color: #fff;
  border-radius: 0.45rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.72rem;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.18);
  z-index: 5;
}

.rfq-chart-tooltip-heading {
  font-weight: 700;
  margin-bottom: 0.3rem;
  opacity: 0.85;
}

.rfq-chart-tooltip-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.1rem 0;
}

.rfq-chart-tooltip-key {
  width: 10px;
  height: 2px;
  border-radius: 1px;
  flex-shrink: 0;
}

.rfq-chart-tooltip-name {
  flex: 1;
  opacity: 0.85;
}

.rfq-chart-tooltip-value {
  font-weight: 700;
}

.rfq-chart-legend {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.rfq-chart-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--rfq-text);
  padding: 0.15rem 0.3rem;
  border-radius: 0.35rem;
}

.rfq-chart-legend-item:hover {
  background: var(--rfq-bg);
}

.rfq-chart-legend-item.is-hidden {
  color: var(--rfq-text-muted);
}

.rfq-chart-legend-swatch {
  width: 14px;
  height: 2px;
  border-radius: 1px;
}

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 1040;
    box-shadow: 0 0 0 100vw rgba(0,0,0,0);
  }

  .sidebar.show {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0,0,0,0.25);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1030;
  }

  .sidebar-backdrop.show {
    display: block;
  }
}
