/* Typhon Cath CRM — Global Styles */

* { box-sizing: border-box; }

:root{
  --tc-success: #198754;
  --tc-success-bg: #e8f6ef;
  --tc-warning: #b7791f;
--primary-blue: #1a56db;
--primary-yellow: #f8c725;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  background: #f5f5f5;
  color: #111;
}

a { color: var(--primary-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { color: #111; font-weight: 700; }

/* ── App Shell ───────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: var(--primary-blue);
  color: #fff;
  overflow: hidden;
  transition: width 0.22s ease, flex-basis 0.22s ease;
}

/* Desktop collapse: fully hidden */
.app-sidebar.collapsed {
  width: 0;
  flex-basis: 0;
}

.app-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0 0.5rem 0 0;
  min-height: 56px;
  white-space: nowrap;
}

.app-brand {
  padding: 1.25rem;
  font-size: 1.1rem;
  font-weight: 700;
}

/* Close button inside the sidebar */
.sidebar-toggle {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  opacity: 0.8;
  transition: transform 0.22s ease, opacity 0.1s;
  transform: rotate(0deg); /* ‹ points left on desktop */
}

.sidebar-toggle:hover { opacity: 1; background: rgba(255,255,255,0.12); }

/* Open button — fixed to viewport, visible only when desktop sidebar is collapsed */
.sidebar-open-btn {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  background: var(--primary-blue);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.35rem 0.65rem;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.sidebar-open-btn:hover { background: #1648c0; }

.app-nav {
  padding: 1rem 0.75rem;
  white-space: nowrap;
}

.app-nav a {
  display: block;
  padding: 0.65rem 0.9rem;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  text-decoration: none;
}

.app-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  text-decoration: none;
}

.app-nav-sub {
  font-size: 0.82rem !important;
  font-weight: 400 !important;
  padding-left: 1.75rem !important;
  opacity: 0.8;
}

/* Logout is a CSRF-protected POST form, not a link — style its button to match
   the surrounding nav items so the change is invisible to the user. */
.app-nav-logout {
  margin: 0;
}

.app-nav-logout-btn {
  display: block;
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 0;
  border-radius: 4px;
  background: none;
  color: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.app-nav-logout-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.app-main {
  flex: 1;
  padding: 2rem;
  min-width: 0;
}

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-shell { flex-direction: column; }

  /* Collapse upward with max-height — overrides desktop width behaviour */
  .app-sidebar,
  .app-sidebar.collapsed {
    width: 100%;
    flex-basis: auto;
    transition: max-height 0.22s ease;
  }

  .app-sidebar           { max-height: 400px; }
  .app-sidebar.collapsed { max-height: 56px;  }

  /* ∧ when expanded, ∨ when collapsed */
  .sidebar-toggle                        { transform: rotate(-90deg); }
  .app-sidebar.collapsed .sidebar-toggle { transform: rotate(90deg);  }

  /* Open button not needed — sidebar top bar always visible */
  .sidebar-open-btn { display: none !important; }
}

/* ── Cards ───────────────────────────────────────────── */
.card, .metric-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1.25rem;
}

/* ── Login ───────────────────────────────────────────── */
.login-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f5f5f5;
}

.login-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
}

/* ── Alerts ──────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  border: 1px solid transparent;
  margin-bottom: 1rem;
}

.alert-danger  { background: #fde8e8; color: #b91c1c; border-color: #fca5a5; }
.alert-success { background: #e8f5e9; color: #166534; border-color: #a7f3d0; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: var(--primary-yellow); }

/* ── Forms ───────────────────────────────────────────── */
label { display: block; font-weight: 600; margin-bottom: 0.25rem; }

.form-control {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font-size: 1rem;
  margin-bottom: 1rem;
  background: #fff;
  color: #111;
}

.form-control:focus {
  border-color: var(--primary-blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

/* ── Buttons ─────────────────────────────────────────── */
/* .btn is the canonical class; .button is a neutral alias so any module can use
   either name. Variants follow the same pairing (.btn-x / .button-x). */
.btn, .button {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary, .button-primary { background: var(--primary-blue); color: #fff; border-color: var(--primary-blue); }
.btn-primary:hover, .button-primary:hover { background: #1648c0; border-color: #1648c0; color: #fff; }

.btn-secondary, .button-secondary { color: #666; border-color: #ccc; background: #fff; font-size: 0.9rem; padding: 0.4rem 0.75rem; }
.btn-secondary:hover, .button-secondary:hover { background: #f5f5f5; }

.btn-danger, .button-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover, .button-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

/* Ghost / clear button — quiet secondary action (e.g. "Clear filters"). */
.btn-ghost, .rfq-list-clear-btn { color: #666; border-color: #ccc; background: #fff; font-size: 0.9rem; padding: 0.4rem 0.75rem; }
.btn-ghost:hover, .rfq-list-clear-btn:hover { background: #f5f5f5; }

/* ── Module Layout ───────────────────────────────────── */
/* Neutral aliases (.page-header, .form, .toolbar…) let Customer/Campaign/RFQ
   share one component vocabulary. The RFQ-named classes remain grouped in so
   existing markup keeps working. */
.module-header, .page-header, .rfq-board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.module-header h1, .module-header h2,
.page-header h1, .page-header h2,
.rfq-board-header h1, .rfq-board-header h2 { margin: 0; }

.module-form, .form, .rfq-form {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.form-row, .rfq-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group, .rfq-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label, .rfq-form-label { font-weight: 600; font-size: 0.9rem; }

.form-required, .rfq-form-required { color: #b91c1c; }

.form-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-input-row .form-control { flex: 1; }

.field-hint {
  font-size: 0.8rem;
  font-weight: 500;
  color: #6b7280;
  letter-spacing: 0.02em;
  user-select: none;
}

.section-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1rem;
}

.form-actions, .rfq-form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding-top: 0.5rem;
}

.form-errors, .rfq-form-errors {
  background: #fde8e8;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-errors p, .rfq-form-errors p { margin: 0; color: #b91c1c; font-size: 0.9rem; }

.header-actions { display: flex; gap: 8px; align-items: center; }

.table-footer-label { text-align: right; padding-top: 10px; color: #6b7280; font-size: 0.85rem; }
.table-footer-value { padding-top: 10px; }

@media (max-width: 560px) {
  .form-row, .rfq-form-row { grid-template-columns: 1fr; }
}

/* ── Tables ──────────────────────────────────────────── */
.table, .data-table { width: 100%; border-collapse: collapse; }
.table th, .data-table th {
  background: #f5f5f5;
  font-weight: 700;
  text-align: left;
  padding: 0.75rem;
  border-bottom: 2px solid #e0e0e0;
}
.table td, .data-table td { padding: 0.75rem; border-bottom: 1px solid #e0e0e0; }
.table tr:hover td, .data-table tr:hover td { background: #fafafa; }

/* ── Utilities ───────────────────────────────────────── */
.text-muted { color: #666; }
.w-100 { width: 100%; }
.mt-3 { margin-top: 1rem; }

/* ── Print ───────────────────────────────────────────── */
@media print {
  .app-sidebar { display: none; }
  body { background: #fff; }
  .app-main { padding: 0; }
}

/* ── Campaign Module ─────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.metric-card-inner { padding: 0.25rem 0; }

.metric-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin: 0;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: #111;
  margin: 0.2rem 0 0;
  line-height: 1;
}

.metric-sub {
  font-size: 0.8rem;
  color: #666;
  margin: 0.25rem 0 0;
}

/* ── Dashboard sections ───────────────────────────────── */
/* Each domain (RFQ / Campaigns / Customers / Inventory) is a self-contained
   section with a labelled divider, so multi-role users can tell where one
   module's cards end and the next begins. */
.dash-section { margin-top: 1.75rem; }
.dash-section:first-of-type { margin-top: 1rem; }

.dash-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin: 0 0 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid #e5e7eb;
}

.dash-section .dash-grid { margin-top: 0.75rem; }

/* ── Dashboard cards ──────────────────────────────────── */
/* Cards scaled ~1.01× (25% then a further 10% down from the earlier 1.5×). The
   grid caps at 5 columns: each column is at least 1/5 of the row width (minus the
   4 gaps), so a 6th column can never fit; the 243px floor lets it wrap down to
   fewer, larger columns on narrower screens for visibility. */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(max(243px, calc((100% - 4.05rem) / 5)), 1fr));
  gap: 1.01rem;
  margin-top: 1.01rem;
}

.dash-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.12rem 1.29rem;
  display: flex;
  flex-direction: column;
}

.dash-card-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin: 0 0 0.61rem;
}

.dash-stat {
  font-size: 2.28rem;
  font-weight: 700;
  color: #111;
  line-height: 1;
  margin: 0;
}

.dash-stat-sub { font-size: 0.81rem; margin: 0.41rem 0 0; }

.dash-list { list-style: none; margin: 0; padding: 0; }

.dash-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.76rem;
  align-items: center;
  padding: 0.41rem 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.88rem;
}

.dash-list-row:last-child { border-bottom: none; }

.dash-list-label {
  min-width: 0;
  font-weight: 500;
  color: #374151;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-list-meta {
  max-width: 122px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-list-date {
  display: block;
  font-size: 0.76rem;
  color: #888;
  margin-top: 2px;
}

.dash-empty { font-size: 0.88rem; margin: 0.27rem 0; }

.dash-card-link {
  margin-top: auto;
  padding-top: 0.71rem;
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--primary-blue);
  text-decoration: none;
}

.dash-card-link:hover { text-decoration: underline; }

/* Table cards (e.g. Heavily Reserved) and their badges scale with the rest. */
.dash-card .table { font-size: 0.77rem; }
.dash-card .rfq-badge { font-size: 0.68rem; }

.audience-preview {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-top: 0.5rem;
}

.audience-preview-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-blue);
}

/* ── Shared: round add (+) button ────────────────────── */
.rfq-create-btn, .add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  text-decoration: none;
  flex-shrink: 0;
}

.rfq-create-btn:hover, .add-btn:hover { background: #1648c0; }

/* RFQ searchable dropdown */
.rfq-search-dropdown {
  flex: 1;
}

.rfq-search-results {
  width: calc(100% - 44px);
  max-height: 240px;
  overflow-y: auto;
  margin-top: 0.25rem;

  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.12);

  z-index: 20;
}

.rfq-search-option {
  padding: 0.65rem 0.8rem;
  font-size: 0.92rem;
  color: #111827;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  background: #fff;
  transition: background-color 0.12s ease, color 0.12s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Audience selection reuses .rfq-search-* as a multi-select: a check column on
   the left of each option, plus removable chips for the current selection.
   (Previously duplicated as inline <style> in audience_selection.php.) */
.rfq-search-option--checked { background: #f0f9ff; font-weight: 500; }

.rfq-option-check {
  width: 1rem;
  text-align: center;
  color: var(--primary-blue);
  font-weight: bold;
  flex-shrink: 0;
}

.audience-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.audience-chip {
  background: #e0f0ff;
  color: var(--primary-blue);
  border: 1px solid var(--primary-blue);
  border-radius: 4px;
  padding: 2px 6px 2px 8px;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.audience-chip-remove {
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--primary-blue);
  border: none;
  background: none;
  padding: 0;
  opacity: 0.7;
}

.audience-chip-remove:hover { opacity: 1; }

.rfq-search-option:last-child {
  border-bottom: none;
}

.rfq-search-option:hover,
.rfq-search-option:focus,
.rfq-search-option--focused {
  background: var(--primary-blue);
  color: #fff;
  outline: none;
}

.rfq-search-option:active {
  background: #1648c0;
  color: #fff;
}

.rfq-search-option--empty {
  padding: 0.65rem 0.8rem;
  color: #6b7280;
  background: #fff;
  font-size: 0.9rem;
  font-style: italic;
  cursor: default;
}

.rfq-search-input--selected {
  background: #f0f7ff;
  border-color: var(--primary-blue) !important;
}

.rfq-main-view {
  display: grid;
  grid-template-columns: repeat(6, minmax(180px, 1fr));
  gap: 1rem;
  width: 100%;
  min-height: 60vh;
  overflow-x: auto;
}

.rfq-item {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rfq-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e0e0e0;
}

.rfq-count {
  background: #e0e0e0;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
}

.rfq-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 0.6rem 0.75rem;
}

.rfq-card-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: #111;
}

.rfq-card-meta {
  font-size: 0.78rem;
  color: #666;
  margin-top: 0.2rem;
}

.rfq-data-tables {
  display: grid;
  width: 100%;
  gap: 1rem;
  grid-template-columns: repeat(3, 1fr);
}

.rfq-data-item {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.75rem;
  overflow-x: auto;
}

.rfq-data-item h3 {
  font-size: 0.8rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e0e0e0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #444;
}

/* Stage filter buttons (Table 2) */
.stage-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.stage-filter-btn {
  padding: 0.18rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid #d0d0d0;
  border-radius: 999px;
  background: #f5f5f5;
  color: #333;
  cursor: pointer;
}

.stage-filter-btn.active {
  background: var(--primary-blue);
  color: #fff;
  border-color: var(--primary-blue);
}

/* Inline status badges — .badge is the neutral alias for .rfq-badge. */
.rfq-badge, .badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.rfq-badge-success, .badge-success { background: #e8f5e9; color: #166534; }
.rfq-badge-warning, .badge-warning { background: #fffbeb; color: #92400e; }
.rfq-badge-danger,  .badge-danger  { background: #fde8e8; color: #b91c1c; }
.rfq-badge-neutral, .badge-neutral { background: #f0f0f0; color: #374151; }
.rfq-badge-info,    .badge-info    { background: #eff6ff; color: #1e40af; }
.rfq-badge-quoted,  .badge-quoted  { background: #f5f3ff; color: #6d28d9; }

/* Inventory stock-status badges — distinct yellow/red so low vs. out of
   stock reads at a glance in the products table. */
.rfq-badge-low-stock    { background: #fde047; color: #713f12; }
.rfq-badge-out-of-stock { background: #fecaca; color: #7f1d1d; }

/* ── RFQ Reservation row elements ────────────────────── */
.res-desc { font-size: 0.78rem; display: block; margin-top: 3px; }
.res-avail-hint { display: none; margin-top: 2px; }
.res-sku, .res-price { font-size: 0.85rem; }
.rfq-badge-pct { opacity: 0.7; font-size: 0.75em; }
.rfq-res-remove-btn {
  background: none;
  border: none;
  color: #b91c1c;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.rfq-res-remove-btn:hover { background: #fde8e8; }
.rfq-res-add-row { margin-top: 4px; }

.res-product-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: -4px;
  margin-bottom: 16px;
}

.res-product-card-row {
  display: flex;
  gap: 24px;
  align-items: baseline;
  flex-wrap: wrap;
}

.res-product-card-field-label { font-size: 0.8rem; }

.res-product-card-desc { margin: 6px 0 0; font-size: 0.85rem; }

.res-qty-sm { max-width: 160px; }

.res-total-line { margin-top: 6px; font-size: 0.9rem; }

/* ── Flash Banner ────────────────────────────────────── */
.flash-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  opacity: 1;
  transition: opacity 0.4s ease;
}

.flash-banner--hiding { opacity: 0; pointer-events: none; }

.flash-banner--success { background: #166534; color: #fff; }
.flash-banner--error   { background: #b91c1c; color: #fff; }

.flash-banner-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  padding: 0;
  flex-shrink: 0;
}

.flash-banner-close:hover { opacity: 1; }

/* ── RFQ Detail Page ─────────────────────────────────── */
.rfq-detail-title-row, .detail-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.rfq-detail-title-row h1, .detail-title-row h1 { margin: 0; }

.rfq-detail-stage, .detail-stage {
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
}

.rfq-stage-form { display: inline-flex; }
.rfq-stage-select {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
}

/* Detail grid + sections — .detail-* are the neutral aliases. */
.rfq-detail-grid, .detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.rfq-detail-section, .detail-section { min-width: 0; }

.rfq-detail-section-title, .detail-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin: 0 0 0.35rem;
}

.rfq-detail-value, .detail-value {
  font-weight: 600;
  margin: 0 0 0.2rem;
}

.rfq-detail-meta, .detail-meta {
  font-size: 0.85rem;
  color: #666;
  margin: 0;
}

.rfq-detail-description {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e0e0e0;
}

.rfq-detail-description p {
  margin: 0.35rem 0 0;
  line-height: 1.6;
  color: #374151;
}

.rfq-detail-card-title, .detail-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.rfq-form-stage-select { max-width: 220px; }

.rfq-create-btn--wip {
  background: #9ca3af;
  cursor: not-allowed;
  opacity: 0.7;
}

.rfq-create-btn--wip:hover { background: #9ca3af; }

/* ── Shared list toolbar ─────────────────────────────── */
.rfq-list-toolbar, .toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.rfq-list-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.rfq-list-search-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  flex-wrap: wrap;
}

.rfq-list-search-form .rfq-list-search-input {
  flex: 1;
  min-width: 120px;
}

.rfq-list-id-input {
  width: 80px;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
}

.rfq-list-search-input {
  min-width: 200px;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
}

.rfq-list-perpage-select {
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.rfq-stage-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.rfq-stage-check {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  color: #374151;
  background: #fff;
}

.rfq-stage-check input[type="checkbox"] { display: none; }

.rfq-stage-check:hover { border-color: #9ca3af; background: #f9fafb; }

.rfq-stage-check:has(input:checked) { background: var(--primary-blue); color: #fff; border-color: var(--primary-blue); }

/* Per-stage accent colors when unchecked */
.rfq-stage-check--new          { border-color: #9ca3af; }
.rfq-stage-check--in-review    { border-color: #93c5fd; }
.rfq-stage-check--quoted       { border-color: #c4b5fd; }
.rfq-stage-check--negotiation  { border-color: #fcd34d; }
.rfq-stage-check--won          { border-color: #86efac; }
.rfq-stage-check--lost         { border-color: #fca5a5; }

.rfq-list-table th { white-space: nowrap; }

.rfq-sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.rfq-sort-link:hover { color: var(--primary-blue); }

.rfq-sort-icon { font-size: 0.7rem; }
.rfq-sort-idle { color: #bbb; }
.rfq-sort-asc,
.rfq-sort-desc { color: var(--primary-blue); }

.rfq-list-id   { color: #888; font-size: 0.85rem; white-space: nowrap; }
.rfq-list-date { font-size: 0.85rem; white-space: nowrap; }
.rfq-list-link { color: var(--primary-blue); text-decoration: none; font-weight: 500; }
.rfq-list-link:hover { text-decoration: underline; }

.rfq-list-empty {
  text-align: center;
  padding: 2rem;
  font-style: italic;
}

.rfq-list-footer {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: #888;
  text-align: right;
}

/* ── RFQ Pagination ──────────────────────────────────── */
.rfq-pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.rfq-page-btn {
  display: inline-block;
  min-width: 2rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 0.85rem;
  text-align: center;
  text-decoration: none;
  color: #374151;
  background: #fff;
  cursor: pointer;
  line-height: 1.2;
}

.rfq-page-btn:hover          { background: #f5f5f5; border-color: #bbb; }
.rfq-page-active             { background: var(--primary-blue); color: #fff; border-color: var(--primary-blue); font-weight: 700; }
.rfq-page-active:hover       { background: #1648c0; }
.rfq-page-disabled           { color: #bbb; cursor: default; border-color: #f0f0f0; background: #fafafa; }
.rfq-page-ellipsis           { padding: 0.35rem 0.25rem; font-size: 0.85rem; color: #888; }
.rfq-pagination-nav          { padding: 0.35rem 0.75rem; }

/* ── Admin Module ────────────────────────────────────── */

.perm-matrix-scroll {
  overflow-x: auto;
}

.perm-matrix-table {
  min-width: 700px;
  border-collapse: collapse;
}

.perm-label-col {
  min-width: 220px;
  vertical-align: middle;
}

.perm-role-col {
  width: 110px;
  text-align: center;
  font-size: 0.82rem;
  vertical-align: middle;
  white-space: nowrap;
}

.perm-check-col {
  text-align: center;
  vertical-align: middle;
}

.perm-check {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.perm-check:disabled {
  cursor: default;
  opacity: 0.55;
}

.perm-module-row td {
  background: var(--primary-blue);
  color: #f8f9fb;
  padding: 0.4rem 0.75rem;
  border-top: 2px solid #e2e4e9;
}

.perm-label-text {
  display: block;
  font-size: 0.88rem;
}

.perm-key {
  display: block;
  font-size: 0.73rem;
  color: #888;
  font-family: monospace;
  margin-top: 1px;
}

.perm-role-note {
  font-weight: 400;
  font-size: 0.72rem;
  color: #888;
}

/* ── Campaign Dashboard ───────────────────────────────────────────────────── */

.camp-stat-cards {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.camp-stat-card {
  flex: 1 1 140px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.camp-stat-label {
  font-size: 0.78rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.camp-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #111;
  line-height: 1;
}

.camp-stat-scheduled { color: #1a56db; }
.camp-stat-sent      { color: #198754; }

/* Crossfilter dual-row controls */
.camp-crossfilter-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.camp-filter-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.camp-filter-label {
  font-size: 0.8rem;
  color: #6b7280;
  white-space: nowrap;
  min-width: 88px;
}

.camp-crossfilter-count {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: #6b7280;
}

/* Inline rate bar for top performers */
.camp-rate-bar-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  min-width: 80px;
}

.camp-rate-bar {
  display: inline-block;
  height: 6px;
  border-radius: 3px;
  min-width: 2px;
  flex-shrink: 0;
}

.camp-rate-val {
  font-size: 0.82rem;
  white-space: nowrap;
  color: #374151;
}

/* Small description text under a table heading */
.camp-data-desc {
  font-size: 0.82rem;
  margin: 0 0 0.75rem;
  line-height: 1.4;
}

/* Momentum chart filter bar */
.camp-momentum-filters {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem 0 0.5rem;
  border-top: 1px solid #f0f0f0;
  margin-top: 0.25rem;
}

.camp-date-input {
  padding: 0.25rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #374151;
  background: #fff;
  height: 30px;
}

/* ── Customer Module ─────────────────────────────────── */
/* Moved out of inline <style> in create_account.php / account_detail.php so all
   component styling lives in one stylesheet. */
.entity-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card-box {
  border: 1px solid #e0e0e0;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  border-radius: 6px;
}

.inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 0.6rem;
}