/* Technique CRM — brand-aligned light theme.
   Palette: brand-system.md §1. Typography: Rajdhani headlines, Inter body.
   This is an internal business-document layout (light surface, Blue-Gray logo,
   no Aerospace blueprint aesthetic). */

:root {
  --navy: #0B1726;
  --blue: #0077C0;
  --blue-light: #0091E6;
  --blue-dark: #0055A4;
  --blue-deep: #003D75;
  --logo-gray: #959595;
  --accent-yellow: #F5C518;
  --accent-orange: #E8630A;

  --dark-gray: #2D3039;
  --med-gray: #6B7280;
  --light-gray: #E8EDF2;
  --off-white: #F3F4F6;
  --white: #FFFFFF;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--off-white);
  color: var(--dark-gray);
  font-family: 'Inter', 'Calibri', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, .headline {
  font-family: 'Rajdhani', 'Arial Black', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--navy);
  margin: 0 0 12px;
}
h1 { font-size: 32px; }
h2 { font-size: 22px; letter-spacing: 1px; }

a {
  color: var(--blue);
  text-decoration: none;
}
a:hover { color: var(--blue-light); text-decoration: underline; }

/* Top bar — 4px blue accent stripe over a white header, per the light-theme layout pattern */
.topbar-accent {
  height: 4px;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue), var(--blue-light));
}

header.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--light-gray);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

header.site-header .brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

header.site-header .brand img {
  height: 44px;
  width: auto;
  display: block;
}

header.site-header .brand .app-name {
  font-family: 'Rajdhani', 'Arial Black', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--blue-dark);
  font-size: 22px;
  border-left: 1px solid var(--light-gray);
  padding-left: 16px;
}

header.site-header nav {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

header.site-header nav .user {
  color: var(--med-gray);
  font-size: 13px;
}

header.site-header nav .nav-link {
  font-family: 'Rajdhani', 'Arial Black', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  font-size: 16px;
  color: var(--blue-dark);
  padding: 6px 6px;
  /* Reserve the 3px the active-state border occupies so switching
     between active/inactive doesn't nudge the nav-row baseline. */
  border-bottom: 3px solid transparent;
}
header.site-header nav .nav-link:hover {
  color: var(--blue);
  text-decoration: none;
}
header.site-header nav .nav-link-active {
  font-weight: 700;
  color: var(--blue);
  border-bottom-color: var(--blue);
}

main {
  flex: 1;
  max-width: min(1600px, 95vw);
  width: 100%;
  margin: 0 auto;
  padding: 40px 32px;
}

.card {
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: 6px;
  padding: 28px 32px;
  box-shadow: 0 1px 2px rgba(11, 23, 38, 0.04);
}

.card + .card { margin-top: 20px; }

.subhead {
  font-family: 'Inter', 'Calibri', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  color: var(--blue);
  margin-bottom: 6px;
}

.muted { color: var(--med-gray); }

.btn {
  display: inline-block;
  background: var(--blue);
  color: var(--white);
  padding: 10px 22px;
  border-radius: 4px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
  border: none;
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.btn:hover {
  background: var(--blue-light);
  color: var(--white);
  text-decoration: none;
}
.btn-secondary {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--blue);
}
.btn-secondary:hover {
  background: var(--blue);
  color: var(--white);
}

.alert {
  background: rgba(232, 99, 10, 0.08);
  border-left: 3px solid var(--accent-orange);
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--dark-gray);
  margin-bottom: 20px;
}

.milestone-pill {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid rgba(0, 119, 192, 0.3);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--blue);
  text-transform: uppercase;
}

/* ------------------------------------------------------------------
   Quotes list view
   ------------------------------------------------------------------ */

.quotes-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.quotes-header h1 {
  margin: 6px 0 4px;
}

.quotes-header-meta {
  text-align: right;
  min-width: 180px;
}
.quotes-header-meta .subhead { margin-bottom: 2px; }
.quotes-header-meta .last-sync {
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--dark-gray);
  font-variant-numeric: tabular-nums;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  letter-spacing: 0.4px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--light-gray);
  border-bottom: 1px solid var(--light-gray);
  font-size: 13px;
}

.quotes-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

.quotes-table {
  /* width: max-content (NOT auto) is required for table-layout: fixed
     to take effect. Per CSS 2.1 §17.5.2.1, fixed layout silently falls
     back to automatic layout when width is auto, which makes <col>
     widths advisory and breaks drag-to-resize. max-content sizes the
     table to the sum of <col> widths so each column is independent. */
  width: max-content;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  table-layout: fixed;
}

.quotes-table th,
.quotes-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.quotes-table thead th {
  background: var(--off-white);
  color: var(--med-gray);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 11px;
  font-weight: 600;
  border-bottom: 1px solid var(--light-gray);
  white-space: nowrap;
}

/* With border-collapse: separate the bottom border must sit on the cells,
   not the row, otherwise the sticky col-num loses its divider. */
.quotes-table tbody td {
  border-bottom: 1px solid var(--light-gray);
}
.quotes-table tbody tr:hover td {
  background: var(--off-white);
}

.quotes-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* PP# column sticks to the left edge when the table scrolls horizontally.
   This is the primary row identifier and must always be readable. */
.quotes-table .col-num {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  position: sticky;
  left: 0;
  background: var(--white);
  z-index: 1;
  border-right: 1px solid var(--light-gray);
}
.quotes-table thead th.col-num {
  background: var(--off-white);
  z-index: 2;
}
.quotes-table tbody tr:hover .col-num {
  background: var(--off-white);
}
.quotes-table .row-archived .col-num {
  background: #f6f6f6;
}

.quotes-table .pp-number {
  font-weight: 600;
  color: var(--dark-gray);
}
.quotes-table .pp-rev {
  color: var(--med-gray);
  font-size: 11px;
  margin-left: 4px;
}

.quotes-table .col-customer {
  font-weight: 500;
  max-width: 260px;
}
.quotes-table .col-contact {
  max-width: 220px;
}
.quotes-table .contact-email {
  display: block;
  font-size: 12px;
  margin-top: 2px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quotes-table .col-synced,
.quotes-table .col-created,
.quotes-table .col-sent {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.row-archived td {
  color: var(--med-gray);
  background: rgba(149, 149, 149, 0.04);
}

/* Sortable column headers */
.sort-link {
  color: var(--med-gray);
  text-transform: inherit;
  letter-spacing: inherit;
  font-weight: inherit;
  text-decoration: none;
}
.sort-link:hover {
  color: var(--blue);
  text-decoration: none;
}
.sort-link.sort-active {
  color: var(--blue);
}
.sort-arrow {
  font-size: 9px;
  margin-left: 3px;
  vertical-align: 1px;
}

/* Status pills. Neutral by default; a few status-specific colorways for
   the statuses that carry sales-pipeline signal. */
.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border: 1px solid var(--light-gray);
  color: var(--med-gray);
  background: var(--white);
  white-space: nowrap;
}
.status-pill + .status-pill { margin-left: 4px; }

.status-pill.status-outstanding {
  color: var(--blue);
  border-color: rgba(0, 119, 192, 0.35);
  background: rgba(0, 119, 192, 0.06);
}
.status-pill.status-accepted {
  color: #1f7a3a;
  border-color: rgba(31, 122, 58, 0.35);
  background: rgba(31, 122, 58, 0.06);
}
.status-pill.status-lost {
  color: var(--accent-orange);
  border-color: rgba(232, 99, 10, 0.35);
  background: rgba(232, 99, 10, 0.06);
}
.status-pill.status-archived {
  color: var(--logo-gray);
  border-color: var(--logo-gray);
  background: rgba(149, 149, 149, 0.08);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 20px 0 4px;
  font-size: 13px;
}

.page-link {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--light-gray);
  border-radius: 3px;
  color: var(--blue);
  background: var(--white);
  min-width: 70px;
  text-align: center;
}
.page-link:hover {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
  text-decoration: none;
}
.page-link.disabled {
  color: var(--light-gray);
  cursor: not-allowed;
  pointer-events: none;
}
.pagination-position {
  color: var(--med-gray);
  margin: 0 8px;
  font-variant-numeric: tabular-nums;
}

/* Empty state */
.empty-state {
  padding: 40px 20px;
  text-align: center;
}

footer.site-footer {
  border-top: 1px solid var(--light-gray);
  background: var(--white);
  padding: 20px 32px;
  color: var(--med-gray);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
footer.site-footer .tagline {
  font-family: 'Rajdhani', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
  color: var(--blue);
}

/* ------------------------------------------------------------------
   M3 — App-wide triage banner (under the site header)
   ------------------------------------------------------------------ */

.triage-banner {
  background: rgba(245, 197, 24, 0.18);
  border-bottom: 1px solid rgba(245, 197, 24, 0.5);
  padding: 8px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}
.triage-banner-label {
  font-family: 'Rajdhani', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: #8a6500;
  font-size: 11px;
}
.triage-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--white);
  border: 1px solid rgba(245, 197, 24, 0.6);
  border-radius: 999px;
  color: var(--dark-gray);
  text-decoration: none;
}
.triage-pill:hover {
  background: var(--accent-yellow);
  color: var(--navy);
  text-decoration: none;
}
.triage-pill strong { color: var(--accent-orange); }

/* ------------------------------------------------------------------
   M3 — List-view filter bar
   ------------------------------------------------------------------ */

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--light-gray);
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--light-gray);
  border-radius: 999px;
  font-size: 13px;
  color: var(--med-gray);
  background: var(--white);
  text-decoration: none;
}
.filter-pill:hover {
  border-color: var(--blue);
  color: var(--blue);
  text-decoration: none;
}
.filter-pill-active {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}
.filter-pill-active:hover {
  background: var(--blue-dark);
  color: var(--white);
}
.filter-pill-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--accent-orange);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 18px;
}

.filter-toggles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
}
.toggle-link {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--light-gray);
  border-radius: 3px;
  color: var(--med-gray);
  background: var(--white);
  text-decoration: none;
  font-size: 12px;
}
.toggle-link:hover {
  border-color: var(--blue);
  color: var(--blue);
  text-decoration: none;
}
.toggle-on {
  background: rgba(0, 119, 192, 0.08);
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 600;
}

/* ------------------------------------------------------------------
   M3 — Pipeline stage pills (CRM-side, distinct from Paperless status)
   ------------------------------------------------------------------ */

.stage-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid var(--light-gray);
  color: var(--dark-gray);
  background: var(--white);
  white-space: nowrap;
}
.stage-pill + .stage-pill { margin-left: 4px; }

.stage-pill.stage-sent {
  color: var(--blue);
  border-color: rgba(0, 119, 192, 0.35);
  background: rgba(0, 119, 192, 0.06);
}
.stage-pill.stage-follow-up,
.stage-pill.stage-negotiating,
.stage-pill.stage-decision-pending {
  color: #8a5a00;
  border-color: rgba(245, 197, 24, 0.5);
  background: rgba(245, 197, 24, 0.1);
}
.stage-pill.stage-won {
  color: #1f7a3a;
  border-color: rgba(31, 122, 58, 0.4);
  background: rgba(31, 122, 58, 0.08);
}
.stage-pill.stage-lost {
  color: var(--accent-orange);
  border-color: rgba(232, 99, 10, 0.4);
  background: rgba(232, 99, 10, 0.08);
}
.stage-pill.stage-excluded {
  color: var(--logo-gray);
  border-color: var(--logo-gray);
  background: rgba(149, 149, 149, 0.08);
}

.status-pill.status-excluded {
  color: var(--logo-gray);
  border-color: var(--logo-gray);
  background: rgba(149, 149, 149, 0.08);
}

.auto-set-badge {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--logo-gray);
}

/* Make the table rows feel clickable. The whole cell is wrapped so the
   click target is generous; the underlying anchor handles navigation. */
.quotes-table .col-stage {
  white-space: nowrap;
}
a.row-link {
  color: inherit;
  text-decoration: none;
  display: block;
}
a.row-link:hover {
  color: var(--blue);
  text-decoration: none;
}

/* ------------------------------------------------------------------
   M3 — Quote detail page
   ------------------------------------------------------------------ */

.quote-detail {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.quote-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.quote-detail-titles {
  flex: 1;
  min-width: 0;
}
.quote-detail-titles h1 {
  margin: 4px 0 6px;
  font-size: 28px;
}
.quote-detail-titles .pp-number {
  color: var(--navy);
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.5px;
}
.quote-detail-titles .pp-rev {
  color: var(--med-gray);
  font-size: 18px;
  margin-left: 4px;
  font-family: 'Rajdhani', sans-serif;
}
.quote-customer-line {
  margin: 0;
  font-size: 14px;
}
.back-link {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.quote-detail-status {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 32px;
}
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.detail-section-heading {
  font-family: 'Rajdhani', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--blue);
  font-size: 14px;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--light-gray);
}

.detail-subheading {
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 11px;
  color: var(--med-gray);
  margin: 16px 0 4px;
  font-weight: 600;
}

.detail-dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 16px;
  margin: 0 0 12px;
  font-size: 13px;
}
.detail-dl dt {
  color: var(--med-gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
  font-weight: 600;
  align-self: center;
}
.detail-dl dd {
  margin: 0;
  color: var(--dark-gray);
  word-break: break-word;
}

.paperless-notes {
  background: var(--off-white);
  border-left: 3px solid var(--light-gray);
  padding: 10px 14px;
  margin: 4px 0 12px;
  font-size: 13px;
  white-space: pre-wrap;
  border-radius: 3px;
}

.detail-crm-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.crm-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.crm-field label,
.crm-field legend {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  color: var(--med-gray);
}
.crm-field select,
.crm-field input[type="text"],
.crm-field input[type="number"] {
  padding: 8px 10px;
  border: 1px solid var(--light-gray);
  border-radius: 3px;
  font-family: inherit;
  font-size: 14px;
  color: var(--dark-gray);
  background: var(--white);
}
.crm-field select:focus,
.crm-field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 119, 192, 0.12);
}

.crm-value-basis {
  border: 1px solid var(--light-gray);
  border-radius: 3px;
  padding: 10px 12px;
  margin: 0;
}
.crm-value-basis legend {
  padding: 0 6px;
}
.value-basis-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  margin: 4px 0 8px;
}
.value-basis-options label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.value-custom-input {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin: 4px 0 8px;
}
.value-custom-input input {
  width: 120px;
}
.value-display {
  margin: 4px 0 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.crm-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.updated-line {
  font-size: 11px;
  margin: 8px 0 0;
}

.nag-banner {
  background: rgba(245, 197, 24, 0.15);
  border-left: 3px solid var(--accent-yellow);
  padding: 10px 14px;
  border-radius: 3px;
  font-size: 13px;
  color: var(--dark-gray);
  margin-bottom: 8px;
}

/* M3.5 conflict banner — red, action-required */
.conflict-banner {
  background: rgba(232, 99, 10, 0.08);
  border-left: 3px solid var(--accent-orange);
  padding: 12px 14px;
  border-radius: 3px;
  font-size: 13px;
  color: var(--dark-gray);
  margin-bottom: 10px;
}
.conflict-banner-head {
  margin-bottom: 6px;
  color: var(--accent-orange);
}
.conflict-banner-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 10px;
  margin: 0 0 10px;
  font-size: 12px;
}
.conflict-banner-dl dt {
  color: var(--med-gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
}
.conflict-banner-dl dd { margin: 0; }
.conflict-banner-actions {
  display: flex;
  gap: 8px;
}

/* M5 column resize handle. Sits on the right edge of every <th>;
   drag adjusts the matching <col> width via list_columns.js.
   top/bottom instead of height:100% — percentage heights don't resolve
   on absolute children of auto-height cells. */
.quotes-table th { position: relative; }
.col-resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  right: -4px;
  width: 9px;
  cursor: col-resize;
  user-select: none;
  z-index: 5;
  /* A subtle 1px line centered in the hit-box so the grab target is
     discoverable without a hover. Stronger on hover. */
  background: linear-gradient(
    to right,
    transparent 0,
    transparent 4px,
    var(--light-gray) 4px,
    var(--light-gray) 5px,
    transparent 5px,
    transparent 100%
  );
}
.col-resize-handle:hover {
  background: linear-gradient(
    to right,
    transparent 0,
    transparent 3px,
    var(--blue) 3px,
    var(--blue) 6px,
    transparent 6px,
    transparent 100%
  );
}

/* Reset column widths link in the column picker. Inline with the
   close-out style of the picker; the link-button class strips default
   button chrome. */
.column-picker-reset {
  display: block;
  width: 100%;
  text-align: left;
  margin-top: 8px;
  padding: 6px 4px;
  border-top: 1px solid var(--light-gray);
  font-size: 12px;
  color: var(--blue);
  cursor: pointer;
}
.column-picker-reset:hover {
  color: var(--blue-light);
  text-decoration: underline;
}

/* M4 per-column filter popover */
.filter-pop {
  display: inline-block;
  position: relative;
  margin-left: 4px;
}
.filter-pop > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--med-gray);
  background: transparent;
}
.filter-pop > summary::-webkit-details-marker { display: none; }
.filter-pop > summary:hover {
  background: var(--light-gray);
  color: var(--navy);
}
.filter-icon-active {
  background: var(--navy) !important;
  color: var(--white) !important;
}
.filter-icon-sorted {
  background: var(--accent-orange) !important;
  color: var(--white) !important;
}
.filter-pop-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  min-width: 240px;
  max-width: 320px;
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(11, 23, 38, 0.18);
  padding: 12px;
  z-index: 50;
  text-align: left;
  font-weight: normal;
}
.filter-pop-form { display: block; }
.filter-pop-heading {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 6px;
}
.filter-pop-hint {
  font-size: 11px;
  margin: 4px 0 0;
}
.filter-pop-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: 8px;
}
.filter-pop-checkboxes label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: normal;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 2px;
}
.filter-pop-checkboxes label:hover { background: rgba(11, 23, 38, 0.04); }
.filter-pop-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--light-gray);
  border-radius: 3px;
  font-size: 13px;
  margin-bottom: 8px;
}
.filter-pop-input-num { width: 100%; }
.date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.date-preset {
  padding: 4px 10px;
  font-size: 11px;
  border: 1px solid var(--light-gray);
  background: var(--white);
  color: var(--dark-gray);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
}
.date-preset:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.filter-pop-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.filter-pop-row label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--med-gray);
}
.filter-pop-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.filter-pop-sort {
  margin-top: 12px;
  border: 1px solid var(--light-gray);
  border-radius: 3px;
  padding: 8px;
}
.filter-pop-sort legend {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--med-gray);
  padding: 0 4px;
}
.sort-action {
  display: block;
  padding: 4px 6px;
  font-size: 13px;
  color: var(--dark-gray);
  text-decoration: none;
  border-radius: 2px;
}
.sort-action:hover { background: rgba(11, 23, 38, 0.04); }
.sort-action-active {
  background: var(--navy) !important;
  color: var(--white) !important;
}
.sort-action-clear {
  margin-top: 4px;
  border-top: 1px solid var(--light-gray);
  padding-top: 6px;
  font-size: 12px;
  color: var(--med-gray);
}
.clear-filters-link {
  color: var(--accent-orange);
  text-decoration: none;
  font-size: 12px;
}
.clear-filters-link:hover { text-decoration: underline; }
.th-label { vertical-align: middle; }

/* M4 Pipeline Board */
.pipeline-board-card { /* container styles below */ }
.pipeline-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.pipeline-board-column {
  background: rgba(11, 23, 38, 0.03);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  min-height: 240px;
}
.pipeline-board-column-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--light-gray);
  background: var(--white);
  border-radius: 4px 4px 0 0;
}
.pipeline-board-column-head h2 {
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
  color: var(--navy);
}
.pipeline-board-column-head p { margin: 2px 0 0; font-size: 12px; }
.pipeline-board-column-head .pipeline-board-column-window {
  font-size: 11px;
  font-style: italic;
  color: var(--med-gray);
}
.pipeline-board-column-won  .pipeline-board-column-head { border-bottom-color: #2e8b57; }
.pipeline-board-column-lost .pipeline-board-column-head { border-bottom-color: var(--accent-orange); }

.pipeline-board-cards {
  list-style: none;
  margin: 0;
  padding: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 80px;
}
.pipeline-board-card {
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: 3px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: grab;
  position: relative;
}
.pipeline-board-card:hover { border-color: var(--navy); }
.pipeline-board-card-ghost { opacity: 0.4; }
.pipeline-board-card-flags {
  position: absolute;
  top: 4px;
  right: 6px;
  display: inline-flex;
  gap: 2px;
}
.pipeline-board-card-line1 {
  display: block;
  font-weight: 600;
  color: var(--dark-gray);
  text-decoration: none;
  margin-bottom: 2px;
}
.pipeline-board-card-line1:hover { color: var(--navy); text-decoration: underline; }
.pipeline-board-card-line2 { color: var(--dark-gray); margin-bottom: 2px; }
.pipeline-board-card-line3 { font-size: 11px; }
.pipeline-board-card-tooltip {
  margin-top: 4px;
  font-size: 11px;
  color: var(--med-gray);
  font-style: italic;
}
.pipeline-board-truncated {
  padding: 6px 10px;
  font-size: 11px;
}

/* Salesperson chip row */
.chip-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0 12px;
}
.chip-row-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.chip input[type=checkbox] { display: none; }
/* Chip-on state is driven by :has() so the visual flip lands the
   instant the user clicks, not when the POST round-trips. .chip-on
   is kept as a fallback for any code path that still sets it. */
.chip:has(input[type=checkbox]:checked),
.chip-on {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

/* Modal (used for the Pipeline Board Lost picker) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 23, 38, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--white);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  padding: 24px;
  min-width: 360px;
  max-width: 480px;
}
.modal h3 {
  margin: 0 0 16px;
  font-family: 'Rajdhani', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--navy);
}
.modal label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 8px 0 4px;
  color: var(--med-gray);
}
.modal select, .modal textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--light-gray);
  border-radius: 3px;
  font-size: 14px;
}

/* M4 saved views dropdown */
.saved-views {
  position: relative;
  display: inline-block;
}
.saved-views > summary {
  list-style: none;
  cursor: pointer;
}
.saved-views > summary::-webkit-details-marker { display: none; }
.saved-views-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 280px;
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(11, 23, 38, 0.18);
  padding: 12px;
  z-index: 50;
  text-align: left;
}
.saved-views-heading {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 6px;
}
.saved-views-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.saved-views-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 2px;
  font-size: 13px;
}
.saved-views-item:hover { background: rgba(11, 23, 38, 0.04); }
.saved-views-item-active { background: rgba(11, 23, 38, 0.06); font-weight: 600; }
.saved-views-item a { flex: 1; text-decoration: none; color: var(--dark-gray); }
.saved-views-row-actions {
  display: inline-flex;
  gap: 4px;
}
.link-button {
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--med-gray);
  font-size: 14px;
  padding: 0 4px;
}
.link-button:hover { color: var(--accent-orange); }
.saved-views-save-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.saved-views-save-form input[type=text] {
  padding: 6px 8px;
  border: 1px solid var(--light-gray);
  border-radius: 3px;
  font-size: 13px;
}

/* M4 column picker */
.column-picker {
  position: relative;
  display: inline-block;
}
.column-picker > summary {
  list-style: none;
  cursor: pointer;
}
.column-picker > summary::-webkit-details-marker { display: none; }
.column-picker-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 240px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(11, 23, 38, 0.12);
  padding: 12px;
  z-index: 50;
}
.column-picker-heading {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 8px;
}
.column-picker-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.column-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 3px;
}
.column-picker-item:hover { background: rgba(11, 23, 38, 0.04); }

.toolbar-pageinfo { margin-left: 16px; font-size: 12px; }
.toolbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* M4 row flags (compact icon-ish badges in the Flags column) */
.row-flag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
  margin-right: 3px;
  letter-spacing: 0.5px;
}
.row-flag-expired  { background: rgba(245, 197, 24, 0.25); color: #8a6500; }
.row-flag-conflict { background: rgba(232, 99, 10, 0.18); color: var(--accent-orange); font-size: 12px; padding: 0 5px; }
.row-flag-nag      { background: rgba(245, 197, 24, 0.18); color: #8a6500; font-size: 12px; padding: 0 5px; }
.row-flag-archived { background: rgba(107, 114, 128, 0.2); color: var(--med-gray); }

/* M4 three-button value selector */
.value-basis-buttons {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.value-basis-btn {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--light-gray);
  background: var(--white);
  color: var(--dark-gray);
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.1s;
}
.value-basis-btn:hover {
  border-color: var(--navy);
  color: var(--navy);
}
.value-basis-btn-active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}
.value-basis-btn-active:hover {
  color: var(--white);
}

/* M3.5 expired-nag banner — yellow, soft ask */
.expired-nag-banner {
  background: rgba(245, 197, 24, 0.15);
  border-left: 3px solid var(--accent-yellow);
  padding: 10px 14px;
  border-radius: 3px;
  font-size: 13px;
  color: var(--dark-gray);
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.expired-nag-actions {
  display: flex;
  gap: 8px;
}

/* Mark Lost inline form */
.mark-lost-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mark-lost-form label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  color: var(--med-gray);
}
.mark-lost-form select {
  padding: 8px 10px;
  border: 1px solid var(--light-gray);
  border-radius: 3px;
  font-size: 14px;
}
.form-actions {
  display: flex;
  gap: 8px;
}

/* Activity feed */
.detail-activity {
  margin-top: 16px;
}
.note-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: flex-end;
}
.note-form textarea {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--light-gray);
  border-radius: 3px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 38px;
}
.note-form textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 119, 192, 0.12);
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.activity-entry {
  border-left: 2px solid var(--light-gray);
  padding: 6px 12px;
  background: var(--off-white);
  border-radius: 0 3px 3px 0;
  font-size: 13px;
}
.activity-entry.activity-note { border-left-color: var(--blue); }
.activity-entry.activity-manual_edit { border-left-color: var(--accent-yellow); }
.activity-entry.activity-mark_won { border-left-color: #1f7a3a; }
.activity-entry.activity-mark_lost { border-left-color: var(--accent-orange); }
.activity-entry.activity-sync_status_change,
.activity-entry.activity-classifier_initial { border-left-color: var(--logo-gray); }

.activity-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 11px;
  margin-bottom: 4px;
}
.activity-kind {
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  color: var(--blue);
}
.activity-when, .activity-who { font-size: 11px; }
.activity-body {
  margin: 4px 0 0;
  font-size: 13px;
  white-space: pre-wrap;
}
.activity-details code {
  background: var(--white);
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 12px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ------------------------------------------------------------------
   M5 — Dashboards
   ------------------------------------------------------------------ */

/* Page header — just the title now; the date picker lives inside the
   Closed Quote Analysis section header so it's spatially obvious that
   it scopes to that section only. */
.dashboards-page-header { margin-bottom: 16px; }
.dashboards-page-header h1 { margin: 6px 0 0; }

/* Section primitive: header bar with thin blue underline + a grid of
   cards. The underline is the same brand blue used for the section
   title; no new colors introduced. */
.dashboard-section { margin-top: 20px; }
.dashboard-section:first-of-type { margin-top: 0; }

.dashboard-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid var(--blue);
  margin-bottom: 12px;
  padding-bottom: 6px;
}
.dashboard-section-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--blue);
  margin: 0;
}
/* Inline window-label next to the section title — tells the user which
   window the section's data is bound to without forcing a glance at the
   picker. Re-overrides the Rajdhani caps the title sets. */
.dashboard-section-window-label {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  margin-left: 6px;
}

/* Card grid: 3 across at desktop (≥1280), 2 across mid, 1 below. The
   `-4` modifier opts a section into 4-across (used by Closed Quote
   Analysis so all four cards line up on one row at desktop widths). */
.dashboard-section-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.dashboard-section-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1279px) {
  .dashboard-section-grid,
  .dashboard-section-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 767px) {
  .dashboard-section-grid,
  .dashboard-section-grid-4 {
    grid-template-columns: 1fr;
  }
}

.dashboard-card {
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: 6px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(11, 23, 38, 0.04);
  display: flex;
  flex-direction: column;
}
.dashboard-card-full { grid-column: 1 / -1; }

.dashboard-card-header { margin-bottom: 8px; }
.dashboard-card-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--navy);
  margin: 0;
}
.dashboard-card-subtitle {
  font-size: 11px;
  margin: 2px 0 0;
}

.dashboard-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dashboard-chart-wrap {
  position: relative;
  width: 100%;
  height: 240px;
}

/* Stat (big-number) card: number is the hero. Targets ~120px total
   card height by dropping the body min-height and tightening padding
   around the number. Caption is suppressed by the template for stat
   cards so this stays compact. */
.dashboard-card-stat .dashboard-card-body {
  justify-content: flex-end;
  padding-top: 4px;
}
.dashboard-card-stat .dashboard-big-number {
  font-size: 48px;
}

.dashboard-big-number {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 42px;
  line-height: 1.1;
  color: var(--blue-dark);
  font-variant-numeric: tabular-nums;
}
.dashboard-big-number-trend {
  font-size: 11px;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.dashboard-card-caption {
  font-size: 11px;
  margin: 8px 0 0;
}

/* Stale-quote chart cold-start: shown in place of the line chart until
   enough daily snapshots have accumulated for a meaningful trend. */
.dashboard-cold-start {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 8px 16px;
}
.dashboard-cold-start-number {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 36px;
  line-height: 1;
  color: var(--blue-dark);
  font-variant-numeric: tabular-nums;
}
.dashboard-cold-start-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 2px;
}
.dashboard-cold-start-msg {
  font-size: 12px;
  margin-top: 12px;
  max-width: 320px;
  line-height: 1.4;
}

/* Date window picker (reusable partial) */
.date-window-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.date-window-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
}
.date-window-pill {
  display: inline-block;
  padding: 5px 12px;
  font-size: 12px;
  border: 1px solid var(--light-gray);
  border-radius: 14px;
  color: var(--dark-gray);
  background: var(--white);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.date-window-pill:hover {
  border-color: var(--blue);
  color: var(--blue);
  text-decoration: none;
}
.date-window-pill-active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}
.date-window-pill-active:hover {
  background: var(--navy);
  color: var(--white);
}

.date-window-custom {
  position: relative;
  display: inline-block;
}
.date-window-custom > summary {
  list-style: none;
}
.date-window-custom > summary::-webkit-details-marker { display: none; }

.date-window-custom-form {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(11, 23, 38, 0.18);
  padding: 12px;
  z-index: 50;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  white-space: nowrap;
}
.date-window-custom-form label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--med-gray);
  font-weight: 600;
}
.date-window-custom-form input[type=date] {
  padding: 6px 8px;
  border: 1px solid var(--light-gray);
  border-radius: 3px;
  font-size: 13px;
  font-family: inherit;
}
