:root {
  --primary: #1a365d;
  --secondary: #2c5282;
  --accent: #3182ce;
  --success: #38a169;
  --warning: #d69e2e;
  --danger: #e53e3e;
  --light: #f7fafc;
  --dark: #1a202c;
  --gray: #718096;
  --border: #e2e8f0;
  --header-height: 4.875rem;
  --sticky-gap: 1rem;
  --sticky-top: calc(var(--header-height) + var(--sticky-gap));
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--light);
  color: var(--dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

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

.layout {
  flex: 1;
}

a { color: var(--accent); }

.topbar {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  color: white;
  display: grid;
  gap: 0.5rem 1.25rem;
  grid-template-columns: minmax(260px, 1fr) max-content;
  min-height: var(--header-height);
  padding: 0.75rem 2rem 0.65rem;
  position: sticky;
  top: 0;
  z-index: 500;
}

.topbar-main { align-self: center; }

.topbar h1 {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
}

.topbar p { display: none; }

.header-actions {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  justify-content: flex-end;
  justify-self: end;
  min-width: 0;
}

.system-updated {
  color: rgba(255,255,255,0.82);
  font-size: 0.72rem;
  font-weight: 700;
  margin-right: 0.25rem;
  white-space: nowrap;
}

.header-actions a {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.32);
  border-radius: 999px;
  color: white;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.1;
  padding: 0.32rem 0.62rem;
  text-decoration: none;
  white-space: nowrap;
}

.header-actions a:hover { background: rgba(255,255,255,0.2); }

.header-update-alert {
  align-items: center;
  background: rgba(198,246,213,0.16);
  border: 1px solid rgba(198,246,213,0.65);
  border-radius: 999px;
  color: white;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  gap: 0.35rem;
  line-height: 1.1;
  padding: 0.32rem 0.62rem;
  white-space: nowrap;
}

.header-alert-dot {
  background: var(--success);
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(56,161,105,0.25);
  height: 0.52rem;
  width: 0.52rem;
}

.header-update-alert.is-pending {
  background: rgba(250,240,137,0.16);
  border-color: rgba(250,240,137,0.75);
}

.header-update-alert.is-pending .header-alert-dot {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(214,158,46,0.28);
}

.header-update-alert.is-error {
  background: rgba(254,215,215,0.18);
  border-color: rgba(254,215,215,0.85);
}

.header-update-alert.is-error .header-alert-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(229,62,62,0.28);
}

.header-update-alert.is-legacy {
  background: rgba(144,205,244,0.16);
  border-color: rgba(144,205,244,0.75);
}
.header-update-alert.is-legacy .header-alert-dot {
  background: #4299e1;
  box-shadow: 0 0 0 3px rgba(66,153,225,0.28);
}

.meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.35rem;
  font-size: 0.73rem;
  grid-column: 1 / -1;
  justify-content: flex-start;
  margin: 0;
  padding: 0;
}

.meta-strip span { opacity: 0.92; }

.layout {
  align-items: flex-start;
  display: flex;
  gap: 1.5rem;
  padding: 1rem 0.5rem;
  overflow-y: auto;
  min-height: 0;
  transition: gap 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.layout.sidebar-collapsed {
  gap: 0.5rem;
}

.sidebar {
  flex-shrink: 0;
  align-self: flex-start;
  position: sticky;
  top: 1rem;
  overflow: visible;
  transition: width 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: width;
  width: 200px;
}

.sidebar {
  background: transparent;
}

.sidebar-card,
nav#mainNav {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

nav#mainNav {
  opacity: 1;
  padding: 1.75rem 0.75rem 0.75rem;
  transform: translateX(0);
  transition: opacity 0.14s ease, transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  width: 200px;
}

.sidebar-resizer {
  background: linear-gradient(180deg, #bee3f8 0%, #c6f6d5 100%);
  border: none;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 0.65rem;
  font-weight: 800;
  margin: 0;
  padding: 0;
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  transition: width 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
  z-index: 10;
  opacity: 1;
}

.sidebar-resizer::before {
  content: '‹';
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.sidebar.collapsed .sidebar-resizer::before {
  content: '›';
}

.sidebar-resizer:hover {
  box-shadow: 2px 0 6px rgba(49,130,206,0.35);
}

.sidebar.collapsed {
  width: 8px;
}

.sidebar.collapsed nav#mainNav {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-0.5rem);
}

.sidebar.collapsed .sidebar-resizer {
  left: 0;
  right: auto;
}

.nav-group-title,
.nav-btn {
  margin-left: 0;
  margin-right: 0;
}

.nav-group-title {
  color: var(--secondary);
  font-size: 0.68rem;
  font-weight: 700;
  margin: 0.5rem 0 0.2rem;
  text-transform: uppercase;
}

.nav-group-title:first-child { margin-top: 0; }

.nav-btn {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--gray);
  cursor: pointer;
  align-items: center;
  display: flex;
  justify-content: space-between;
  font: inherit;
  font-size: 0.82rem;
  margin: 0.15rem 0;
  padding: 0.35rem 0.5rem;
  text-align: left;
  transition: all 0.15s;
  width: 100%;
}

.nav-caret::before {
  content: '+';
  font-weight: 700;
}

.nav-btn.active .nav-caret::before { content: '-'; }

.nav-wip {
  background: var(--warning);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  margin-left: 0.35rem;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.nav-subgroup {
  display: none;
  margin: -0.1rem 0 0.35rem;
}

.nav-subgroup.expanded { display: block; }

.nav-btn:hover {
  background: var(--light);
  color: var(--primary);
}

.nav-btn.active {
  background: var(--primary);
  color: white;
}

.nav-sub {
  font-size: 0.8rem;
  padding-left: 1.25rem;
}

.content {
  flex: 1;
  min-width: 0;
  overflow: visible;
  padding-bottom: 2rem;
}

.view { display: none; }
.view.active { display: block; }

.section-title,
.panel {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 1rem;
  padding: 1.25rem;
}

.section-title {
  background: linear-gradient(135deg, #ebf8ff 0%, #f0fff4 100%);
  border: 1px solid #90cdf4;
  box-shadow: none;
  padding: 1.5rem;
}

.section-title.hero-panel { background: linear-gradient(135deg, #ebf8ff 0%, #f0fff4 100%); }

.hero-panel {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.section-title h2,
.hero-panel h2 {
  border-bottom: 0;
  color: var(--primary);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0;
}

.panel h3 {
  color: var(--secondary);
  font-size: 1rem;
  margin: 0;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.panel h2 {
  border-bottom: 2px solid var(--border);
  color: var(--primary);
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
}

.section-title p,
.hero-panel p {
  color: var(--secondary);
  font-size: 0.9rem;
  line-height: 1.7;
}

.muted {
  color: var(--gray);
  font-size: 0.9rem;
}

.eyebrow {
  color: var(--gray);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-actions a,
.secondary-btn,
.pagination button,
.pill {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.6rem 1rem;
  text-decoration: none;
  transition: all 0.2s;
}

.hero-actions a:hover,
.secondary-btn:hover,
.pagination button:hover:not(:disabled),
.pill:hover {
  background: var(--border);
}

.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.app-footer {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: rgba(255,255,255,0.85);
  font-size: 0.72rem;
  padding: 0.6rem 2rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.app-footer a {
  color: white;
  font-weight: 600;
  text-decoration: none;
}

.app-footer a:hover { text-decoration: underline; }

.footer-sep::before {
  content: '|';
  margin: 0 0.35rem;
  opacity: 0.5;
}

.summary-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 1.5rem;
}

.summary-grid.small { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.metric-card {
  background: white;
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 1.25rem;
}

.metric-card:nth-child(2n) { border-left-color: var(--success); }
.metric-card:nth-child(3n) { border-left-color: var(--warning); }
.metric-card:nth-child(4n) { border-left-color: var(--danger); }

.metric-label {
  color: var(--gray);
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.metric-value {
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.metric-note {
  color: var(--gray);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.two-col {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

.qps-subtab { display: none; }
.qps-subtab.active { display: block; }

.qps-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 1.25rem;
}

.qps-card h3,
.qps-card h4 { color: var(--primary); margin: 0 0 0.75rem; }
.qps-card h4 { color: var(--secondary); font-size: 0.9rem; margin-top: 1rem; }

.qps-stats {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.qps-stat {
  background: var(--light);
  border-radius: 8px;
  padding: 0.75rem;
}

.qps-stat .num { color: var(--primary); font-weight: 700; }
.qps-stat .lbl { color: var(--gray); font-size: 0.75rem; text-transform: uppercase; }

.overview-chart-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(520px, 1.45fr) minmax(360px, 0.9fr);
  margin-bottom: 1rem;
}

.toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

#view-department-profile > .toolbar label:first-child {
  flex: 1 1 26rem;
  min-width: min(100%, 22rem);
}

#view-department-profile > .toolbar label:first-child input {
  min-width: 100%;
}

#view-department-profile > .toolbar label:last-child {
  flex: 1 1 32rem;
  min-width: min(100%, 24rem);
}

#view-department-profile > .toolbar label:last-child select {
  min-width: 100%;
}

.compact-toolbar { margin-bottom: 0; }
.section-note { margin-bottom: 1rem; }

.time-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.time-btn {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--dark);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: all 0.2s;
}

.time-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.time-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.chart-box {
  height: 280px;
  min-height: 280px;
  position: relative;
}

.chart-box-large {
  height: 380px;
  min-height: 380px;
}

.chart-legend-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.chart-legend-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: white;
  border-left: 4px solid;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 0.6rem 0.75rem;
  font-size: 0.78rem;
}

.chart-legend-label {
  color: var(--dark);
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-legend-value {
  color: var(--gray);
  font-size: 0.75rem;
  white-space: nowrap;
}

.contractor-chart {
  height: 500px;
  min-height: 500px;
}

.chart-box canvas {
  display: block;
  height: 100% !important;
  width: 100% !important;
}

.chart-box canvas[hidden] {
  display: none !important;
}

.chart-empty-state {
  align-items: center;
  color: var(--gray);
  display: flex;
  font-size: 0.9rem;
  height: 100%;
  inset: 0;
  justify-content: center;
  line-height: 1.5;
  padding: 1rem;
  position: absolute;
  text-align: center;
  width: 100%;
}

label {
  color: var(--secondary);
  display: grid;
  font-size: 0.82rem;
  font-weight: 600;
  gap: 0.25rem;
}

select,
input {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--dark);
  font: inherit;
  font-size: 0.9rem;
  min-width: 200px;
  padding: 0.6rem 1rem;
}

select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49,130,206,0.1);
  outline: none;
}

.table-wrap { overflow: auto; }

.guidance-disclosure {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 1rem;
  overflow: hidden;
}

.guidance-disclosure summary {
  background: var(--light);
  color: var(--primary);
  cursor: pointer;
  font-weight: 700;
  padding: 0.9rem 1rem;
}

.guidance-disclosure-body {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.info-box {
  background: #ebf8ff;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 1rem;
}

.info-box h3 {
  color: var(--primary);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.info-box p {
  color: var(--secondary);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.info-box table {
  font-size: 0.85rem;
}

.info-box th,
.info-box td {
  padding: 0.55rem 0.65rem;
}

.scenario-interpretation td:first-child { white-space: nowrap; }

table {
  border-collapse: collapse;
  font-size: 0.9rem;
  width: 100%;
}

th {
  background: var(--light);
  border-bottom: 2px solid var(--border);
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
  padding: 0.75rem;
  position: sticky;
  text-align: left;
  top: 0;
  user-select: none;
  white-space: nowrap;
  z-index: 100;
}

th:hover { background: #edf2f7; }

td {
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 1rem;
  text-align: left;
  vertical-align: top;
}

tr:hover td { background: #f7fafc; }

.rank {
  color: var(--gray);
  font-weight: 700;
  width: 42px;
}

.bar {
  background: var(--border);
  border-radius: 4px;
  height: 8px;
  margin-top: 0.3rem;
  min-width: 80px;
  overflow: hidden;
}

.bar span {
  background: var(--accent);
  border-radius: 4px;
  display: block;
  height: 100%;
}

.pagination {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.8rem;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.config-list,
.resource-list { display: grid; gap: 0.75rem; }

.config-row,
.resource-link {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}

.config-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.config-row-stacked {
  align-items: flex-start;
  display: grid;
  gap: 0.35rem;
}

.config-row-stacked span {
  color: var(--gray);
  font-size: 0.82rem;
}

.check-list {
  color: var(--gray);
  line-height: 1.9;
  padding-left: 1.2rem;
}

.badge {
  background: #bee3f8;
  border-radius: 20px;
  color: #2a4365;
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
}

.badge-info { background: #bee3f8; color: #2a4365; }
.badge-warning { background: #faf089; color: #744210; }
.badge-danger { background: #fed7d7; color: #742a2a; }
.badge-success { background: #c6f6d5; color: #22543d; }
.badge-neutral { background: #e2e8f0; color: #2d3748; }

.status-badge {
  border-radius: 20px;
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  text-transform: uppercase;
}
.status-badge-active { background: #c6f6d5; color: #22543d; }
.status-badge-removed { background: #fed7d7; color: #742a2a; }
.status-badge-superseded { background: #feebc8; color: #744210; }
.status-reason {
  color: var(--gray);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* Contract Profile change-history: highlight the active version and the opened record */
.chain-active td {
  background: #f0fff4;
}
.chain-current td {
  background: #ebf5ff;
  font-weight: 600;
}
.chain-current td .status-reason {
  font-weight: 400;
}
#view-contract-profile > .toolbar label:first-child {
  flex: 1 1 420px;
}
#contractProfileSearchResults .contractor-search-result {
  text-align: left;
}

.contract-inactive-toggle {
  align-items: center;
  color: var(--dark);
  display: inline-flex;
  font-size: 0.85rem;
  gap: 0.4rem;
  margin-left: 1rem;
}
.contract-inactive-toggle input {
  cursor: pointer;
}

.profile-history-table .status-badge {
  margin-bottom: 0.25rem;
}

.qps-subtab { display: none; }
.qps-subtab.active { display: block; }

.progress-bar {
  background: var(--border);
  border-radius: 4px;
  height: 8px;
  margin-top: 0.3rem;
  min-width: 90px;
  overflow: hidden;
}

.progress-bar .fill {
  border-radius: 4px;
  display: block;
  height: 100%;
}

.progress-bar .fill.high { background: var(--danger); }
.progress-bar .fill.medium { background: var(--warning); }
.progress-bar .fill.low { background: var(--success); }

.contractor-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 220px;
}

.compact-contractor-list {
  gap: 0.2rem;
  margin-top: 0.35rem;
  min-width: 0;
}

.compact-contractor-list .contractor-item {
  font-size: 0.78rem;
  gap: 0.35rem;
}

.contractor-item {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.contractor-item .rank {
  align-items: center;
  background: var(--light);
  border-radius: 50%;
  color: var(--gray);
  display: inline-flex;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  height: 20px;
  justify-content: center;
  width: 20px;
}

.contractor-item .rank.top {
  background: var(--warning);
  color: white;
}

.contractor-item .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contractor-item .share {
  color: var(--primary);
  flex-shrink: 0;
  font-weight: 700;
  white-space: nowrap;
}

.link-btn {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}

.contractor-link {
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

.contractor-link:hover {
  background: rgba(49,130,206,0.05);
  border-bottom: 1px solid var(--secondary);
  border-radius: 3px;
  color: var(--secondary);
  padding: 0 2px;
}

.modal {
  background: rgba(0,0,0,0.6);
  display: none;
  inset: 0;
  overflow-y: auto;
  padding: 2rem 1rem;
  position: fixed;
  z-index: 1000;
}

.modal.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.modal-content {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-height: calc(100vh - 4rem);
  max-width: 900px;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  position: relative;
  width: min(100%, 900px);
}

.modal-content h2 {
  border-bottom: 2px solid var(--border);
  color: var(--primary);
  font-size: 1.3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  padding-right: 3rem;
}

.modal-close {
  align-items: center;
  background: var(--light);
  border: none;
  border-radius: 50%;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  font-size: 1.6rem;
  height: 38px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: 1rem;
  top: 1rem;
  width: 38px;
}

.modal-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.modal-panel { box-shadow: none; }

.modal-grid { margin-bottom: 1rem; }

.contractor-trend-table .value-cell {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
  white-space: nowrap;
}

.contractor-trend-table .zero { color: var(--gray); }
.total-row { background: #edf2f7; font-weight: 600; }
.trend-up { color: var(--success); font-weight: 600; }
.trend-down { color: var(--danger); font-weight: 600; }
.trend-neutral { color: var(--gray); }

.resource-link strong { display: block; margin-bottom: 0.25rem; }
.status-ok { color: var(--success); font-weight: 700; }
.status-warn { color: var(--warning); font-weight: 700; }

.resource-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.resource-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
}

.resource-card h3 { color: var(--primary); margin: 0; }
.resource-card p { color: var(--gray); font-size: 0.9rem; margin: 0; }
.resource-actions { margin-top: auto; }
.resource-actions a {
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--secondary);
  display: inline-block;
  font-weight: 700;
  padding: 0.55rem 0.85rem;
  text-decoration: none;
}
.resource-actions a.primary { background: var(--accent); color: white; }

.dataset-list {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.dataset-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
}
.dataset-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(56, 161, 105, 0.15);
}
.dataset-header {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}
.dataset-label {
  font-size: 1.1rem;
  font-weight: 700;
}
.dataset-badge {
  background: var(--accent);
  border-radius: 999px;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  text-transform: uppercase;
}
.dataset-status {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
}
.dataset-select-btn {
  background: var(--primary);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 0.85rem;
}
.dataset-select-btn:hover { background: var(--secondary); }

.contract-filter-toolbar {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.contract-filter-actions {
  display: flex;
  gap: 0.5rem;
}

.normalization-sections {
  display: grid;
  gap: 1.25rem;
}

.normalization-section .panel {
  margin: 0;
}

.normalization-section h4 {
  color: var(--secondary);
  font-size: 0.95rem;
  margin: 0 0 0.65rem;
}

.normalization-subsection {
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  padding-top: 1rem;
}

.normalization-helper-toolbar {
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: 10px;
  margin-top: -0.35rem;
  padding: 0.75rem;
}

.normalization-helper-toolbar .muted,
.normalization-department-toolbar .muted {
  align-self: flex-end;
  padding-bottom: 0.45rem;
}

.contract-search-label {
  flex: 1 1 520px;
  min-width: min(100%, 320px);
}

.contract-search-label input {
  background: white;
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
  font-size: 0.95rem;
  min-width: 100%;
  padding: 0.7rem 0.85rem;
}

.contract-search-label input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49,130,206,0.16);
  outline: none;
}

.contract-page-size-label {
  flex: 0 0 9.5rem;
}

.contract-page-size-label select {
  min-width: 100%;
}

.contract-nature-summary {
  margin-bottom: 1rem;
}


.pagination-bar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
}

.pagination-bar button {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--secondary);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.42rem 0.7rem;
}

.pagination-bar button.active,
.pagination-bar button:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.pagination-bar button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.pagination-status { color: var(--gray); font-size: 0.85rem; margin-left: auto; }

.contract-scope-note {
  color: var(--secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 0.25rem 0 1rem;
}

.scope-chip {
  background: #d9ecfb;
  border-radius: 4px;
  color: var(--primary);
  font-weight: 800;
  padding: 0.16rem 0.4rem;
}

.contract-filter-actions,
.modal-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.modal-actions { margin-top: 1rem; }
.filter-chip-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.filter-chip {
  background: #e6fffa;
  border: 1px solid #81e6d9;
  border-radius: 999px;
  color: #234e52;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
}

.keyword-chip {
  background: #edf2f7;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--secondary);
  cursor: pointer;
  display: inline-block;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  margin: 0.15rem 0.2rem 0.15rem 0;
  padding: 0.25rem 0.55rem;
}

.nature-breakdown {
  display: grid;
  gap: 0.75rem;
}

.nature-hierarchy {
  gap: 0.5rem;
}

.nature-summary-table th,
.nature-summary-table td,
.nature-category-table th,
.nature-category-table td {
  font-size: 0.84rem;
  vertical-align: top;
}

.nature-summary-table .nature-detail-row td {
  background: #f8fafc;
  padding: 0.9rem;
}

.nature-category-table {
  box-shadow: none;
  margin: 0;
}

.nature-category-table th {
  background: #ebf8ff;
  color: var(--primary);
}

.nature-cards-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

.nature-summary-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: grid;
  gap: 0.5rem;
  text-align: center;
}

.nature-card-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.nature-card-header strong {
  color: var(--dark);
  font-size: 0.85rem;
  text-align: left;
}

.nature-card-badge {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
}

.nature-card-body {
  display: grid;
  gap: 0.15rem;
}

.nature-card-label {
  color: var(--gray);
  font-size: 0.78rem;
}

.nature-card-value {
  color: var(--dark);
  font-size: 0.95rem;
  font-weight: 700;
}

.nature-card-count {
  color: var(--gray);
  font-size: 0.78rem;
}

.concentration-summary-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin: 0.75rem 0 1rem;
}

.concentration-summary-card {
  background: var(--light);
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  border-radius: 10px;
  color: var(--dark);
  display: grid;
  font: inherit;
  gap: 0.25rem;
  min-height: 88px;
  padding: 0.85rem;
  text-align: left;
}

.concentration-summary-card strong {
  color: var(--primary);
  font-size: 1.2rem;
  line-height: 1.2;
}

.concentration-summary-card span { color: var(--gray); font-size: 0.84rem; }
.concentration-summary-card.danger { border-left-color: var(--danger); }
.concentration-summary-card.warning { border-left-color: var(--warning); }
.concentration-summary-card.success { border-left-color: var(--success); }
.concentration-summary-card.link-card { cursor: pointer; }
.concentration-summary-card.link-card:hover { background: #ebf8ff; border-color: #bee3f8; }

.info-callout {
  background: #ebf8ff;
  border: 1px solid #bee3f8;
  border-left: 5px solid var(--accent);
  border-radius: 10px;
  color: #21415f;
  font-size: 0.9rem;
  margin: 0.75rem 0;
  padding: 0.8rem 1rem;
}

.info-callout .focus-note {
  color: var(--primary);
  font-weight: 700;
}

.info-icon-btn {
  align-items: center;
  background: white;
  border: 1px solid #90cdf4;
  border-radius: 999px;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  height: 1.55rem;
  justify-content: center;
  margin: 0 0.35rem;
  padding: 0;
  vertical-align: middle;
  width: 1.55rem;
}

.info-icon-btn svg {
  fill: none;
  height: 1rem;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 1rem;
}

.info-icon-btn:hover { background: #ebf8ff; color: var(--primary); }

.hhi-modal-content { max-width: 820px; }

.hhi-modal-content h2 { color: var(--primary); margin-bottom: 0.35rem; }

.hhi-level-wrap { margin: 1rem 0; }

.hhi-level-table th { background: var(--primary); color: white; }

.hhi-level-table td:first-child { white-space: nowrap; }

.hhi-guide-list {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 1rem;
}

.hhi-guide-list div {
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
}

.hhi-guide-list dt {
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 0.2rem;
}

.hhi-guide-list dd { color: var(--gray); margin: 0; }

tr.focus-row td {
  background: #fffaf0;
  box-shadow: inset 0 1px 0 #f6ad55, inset 0 -1px 0 #f6ad55;
}

tr.focus-row td:first-child { box-shadow: inset 5px 0 0 var(--warning), inset 0 1px 0 #f6ad55, inset 0 -1px 0 #f6ad55; }

.filter-modal-content { max-width: 1100px; }
.normalize-modal-content { max-width: 480px; }
.normalize-form .form-row { margin-bottom: 1rem; }
.normalize-form label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.35rem; }
.normalize-form input { width: 100%; }
.normalize-form input[readonly] { background: var(--light); color: var(--gray); }
.match-score { color: var(--gray); display: block; font-size: 0.85rem; margin-top: 0.25rem; }
.filter-group-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: 1rem 0; }
.filter-group { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.filter-group h3 { background: var(--light); color: var(--primary); font-size: 0.95rem; margin: 0; padding: 0.75rem; }
.filter-options { max-height: 260px; overflow: auto; padding: 0.75rem; }
.filter-option {
  align-items: start;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: auto 1fr;
  margin-bottom: 0.45rem;
}
.filter-option input { min-width: 0; }

.contractor-search-results {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: -0.25rem 0 1rem;
}

.contractor-search-result {
  background: white;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--secondary);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.4rem 0.75rem;
}

.contractor-search-result:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.reload-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
}

.reload-actions,
.update-log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

#csvFileInput {
  height: 1px;
  left: -9999px;
  min-width: 0;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.reload-status,
.reload-source,
.update-log-latest,
.update-log-action-status,
.update-log-empty,
.update-log-more {
  color: var(--gray);
  font-size: 0.9rem;
}

.reload-status.success { color: var(--success); font-weight: 700; }
.reload-status.error { color: var(--danger); font-weight: 700; }

.reload-dropzone {
  align-items: center;
  background: var(--light);
  border: 2px dashed #90cdf4;
  border-radius: 12px;
  color: var(--secondary);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  justify-content: center;
  min-height: 130px;
  padding: 1rem;
  text-align: center;
}

.reload-dropzone.dragover {
  background: #ebf8ff;
  border-color: var(--accent);
}

.update-log-metric-board {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: 1rem;
}

.update-log-metric-group,
.update-log-entry,
.update-log-metric-guide {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 1rem;
  overflow: hidden;
}

.update-log-group-header,
.update-log-entry summary,
.update-log-metric-guide summary,
.update-log-detail-group summary {
  background: var(--light);
  color: var(--primary);
  cursor: pointer;
  font-weight: 700;
  padding: 0.75rem 1rem;
}

.update-log-group-header {
  cursor: default;
  display: grid;
  gap: 0.2rem;
}

.update-log-group-note { color: var(--gray); font-size: 0.78rem; font-weight: 500; }
.update-log-metric-list { display: flex; flex-wrap: wrap; gap: 0.75rem; padding: 1rem; }
.update-log-metric { border-left: 4px solid var(--accent); min-width: 110px; padding-left: 0.75rem; }
.update-log-metric.positive { border-left-color: var(--success); }
.update-log-metric.warning { border-left-color: var(--warning); }
.update-log-metric.danger { border-left-color: var(--danger); }
.update-log-metric .label { color: var(--gray); display: block; font-size: 0.75rem; text-transform: uppercase; }
.update-log-metric .value { color: var(--primary); display: block; font-size: 1.35rem; font-weight: 700; }
.update-log-definition-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding: 1rem; }
.update-log-definition-grid dt { color: var(--primary); font-weight: 700; }
.update-log-definition-grid dd { color: var(--gray); font-size: 0.85rem; }
.update-log-entry-title { display: grid; gap: 0.2rem; }
.update-log-meta { color: var(--gray); font-size: 0.8rem; font-weight: 500; }
.update-log-counts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.update-log-count { background: #e2e8f0; border-radius: 999px; color: #2d3748; display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 0.22rem 0.55rem; }
.update-log-count.success { background: #c6f6d5; color: #22543d; }
.update-log-count.warning { background: #fefcbf; color: #744210; }
.update-log-count.danger { background: #fed7d7; color: #742a2a; }
.update-log-entry-body { display: grid; gap: 0.75rem; padding: 1rem; }
.update-log-detail-grid { display: grid; gap: 0.75rem; }
.update-log-detail-group { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.update-log-detail-table { overflow: auto; }
.update-log-detail-table table { font-size: 0.8rem; min-width: 1100px; }
.update-log-detail-empty,
.update-log-more { padding: 0.75rem 1rem; }

.review-status-banner { margin-bottom: 0.75rem; }
.review-status { display: inline-block; font-weight: 600; padding: 0.4rem 0.75rem; border-radius: 6px; }
.review-status.success { background: #c6f6d5; color: #22543d; }
.review-status.warning { background: #fefcbf; color: #744210; }
.review-actions-bar { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.batch-review-actions { display: inline-flex; align-items: center; gap: 0.5rem; }
.batch-review-actions label { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; color: var(--dark); }
#batchActionStatus { font-size: 0.85rem; }
#selectedDiffCount { font-size: 0.85rem; white-space: nowrap; }
.diff-default-hint {
  color: var(--gray);
  font-size: 0.75rem;
  margin-left: 0.35rem;
}

/* Passcode boot gate (encrypted hosted payload) */
.boot-gate {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7fafc;
}
.boot-gate-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  max-width: 380px;
  padding: 2rem;
  text-align: center;
  width: 90%;
}
.boot-gate-card h1 {
  color: var(--primary);
  font-size: 1.25rem;
  margin: 0 0 0.5rem;
}
.boot-gate-card p {
  color: var(--gray);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}
#bootPasscodeForm {
  display: flex;
  gap: 0.5rem;
}
#bootPasscodeForm input {
  flex: 1;
  min-width: 0;
}
.boot-gate-unlock {
  background: var(--primary);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
}
.boot-gate-unlock:hover { background: var(--secondary); }
.boot-gate-error {
  color: #c53030 !important;
  font-size: 0.85rem !important;
  margin: 0.75rem 0 0 !important;
  min-height: 1.2em;
}

/* Consolidated workflow: diff status badges and sub-status badges */
.diff-status {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.diff-status-new { background: #c6f6d5; color: #22543d; }
.diff-status-changed { background: #fefcbf; color: #744210; }
.diff-status-revised { background: #e0e7ff; color: #3730a3; }
.diff-status-removed { background: #fed7d7; color: #742a2a; }
.diff-status-reinstated { background: #c6f6d5; color: #22543d; }
.diff-status-duplicate { background: #fee2e2; color: #991b1b; }

.diff-sub-status {
  border-radius: 4px;
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  text-transform: uppercase;
  margin-left: 0.3rem;
}

.diff-status-cell {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.diff-status-cell .sub-badge {
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.12rem 0.35rem;
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
}

.diff-sub-status-flagged { background: #fff5f5; color: #c53030; border: 1px solid #feb2b2; }
.diff-sub-status-auto { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }
.diff-sub-status-pending { background: #fffff0; color: #744210; border: 1px solid #f6e05e; }

/* Category-specific action buttons in Review & Confirm table */
.diff-action-btn {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--secondary);
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  transition: all 0.15s;
  white-space: nowrap;
}

.diff-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.diff-action-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.diff-action-btn.primary:hover {
  background: var(--secondary);
}

.diff-action-btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.diff-action-btn.danger:hover {
  background: #c53030;
}

.diff-action-btn.success {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.diff-action-btn.success:hover {
  background: #2f855a;
}

.diff-action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Review action dropdown and normalization controls */
.diff-action-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.diff-action-select {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--secondary);
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.4rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.diff-action-select:focus {
  border-color: var(--accent);
  outline: none;
}

.diff-normalize-wrap {
  line-height: 1.3;
  max-width: 100%;
}

.diff-normalize-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

.diff-normalize-btn:hover {
  color: var(--secondary);
}

/* Improved Review & Confirm table layout */
.diff-table-wrap {
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.diff-review-table {
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 1150px;
  width: 100%;
  table-layout: fixed;
}

.diff-review-table th,
.diff-review-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  text-align: left;
  vertical-align: middle;
}

.diff-review-table th {
  background: var(--primary);
  color: white;
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Column widths for 11-column layout */
.diff-review-table th:nth-child(1),
.diff-review-table td:nth-child(1) { width: 26px; text-align: center; padding-left: 0.2rem; padding-right: 0.2rem; } /* Checkbox */
.diff-review-table th:nth-child(2),
.diff-review-table td:nth-child(2) { width: 80px; white-space: nowrap; }    /* Status */
.diff-review-table th:nth-child(3),
.diff-review-table td:nth-child(3) { width: 75px; }                          /* Date */
.diff-review-table th:nth-child(4),
.diff-review-table td:nth-child(4) { width: 100px; }                         /* QPS */
.diff-review-table th:nth-child(5),
.diff-review-table td:nth-child(5) { width: 260px; }                          /* Title */
.diff-review-table th:nth-child(6),
.diff-review-table td:nth-child(6) { width: 120px; }                         /* Contractor */
.diff-review-table th:nth-child(7),
.diff-review-table td:nth-child(7) { width: 135px; }                         /* Department */
.diff-review-table th:nth-child(8),
.diff-review-table td:nth-child(8) { width: 90px; text-align: right; }       /* Value */
.diff-review-table th:nth-child(9),
.diff-review-table td:nth-child(9) { width: 90px; }                          /* Changed Fields */
.diff-review-table th:nth-child(10),
.diff-review-table td:nth-child(10) { width: 130px; }                        /* Proposed Action */
.diff-review-table th:nth-child(11),
.diff-review-table td:nth-child(11) { width: 110px; white-space: nowrap; }   /* Actions */

.diff-review-table td:nth-child(5) {
  word-break: break-word;
  line-height: 1.4;
}

.diff-review-table th:nth-child(1) input[type="checkbox"] {
  margin: 0;
}

.diff-review-table tr.requires-confirm { background: #fffbeb; }
.diff-review-table tr.requires-confirm:hover { background: #fef3c7; }
.diff-review-table tr.safe { background: #f0fdf4; }
.diff-review-table tr.safe:hover { background: #dcfce7; }
.diff-review-table tr.removed { background: #fef2f2; }
.diff-review-table tr.removed:hover { background: #fee2e2; }

.diff-review-table .diff-row-checkbox,
.diff-review-table #selectAllDiffRows {
  min-width: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
  margin: 0;
  padding: 0;
}

/* Inline before/after diff cells */
.diff-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  line-height: 1.35;
}

.diff-cell .diff-active {
  color: var(--gray);
  font-size: 0.72rem;
  text-decoration: line-through;
}

.diff-cell .diff-staged {
  color: var(--dark);
  font-weight: 600;
}

.diff-cell .diff-staged.changed { color: var(--warning); }
.diff-cell .diff-staged.new { color: var(--success); }
.diff-cell .diff-staged.removed { color: var(--danger); }

.diff-cell .diff-missing {
  color: var(--gray);
  font-style: italic;
}

.diff-action-effect {
  color: var(--gray);
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

.diff-action-effect.success { color: var(--success); }
.diff-action-effect.warning { color: var(--warning); }
.diff-action-effect.muted { color: var(--gray); }
.diff-action-effect.info { color: var(--secondary); }

/* Filter toolbar for review table */
.diff-filter-toolbar {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.diff-filter-toolbar label {
  color: var(--secondary);
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  font-weight: 600;
  gap: 0.25rem;
}

.diff-filter-toolbar .diff-search-label {
  flex: 1 1 260px;
  min-width: min(100%, 220px);
}

.diff-filter-toolbar .diff-search-label input {
  min-width: 100%;
}

.diff-filter-toolbar select,
.diff-filter-toolbar input[type="search"] {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--dark);
  font: inherit;
  font-size: 0.85rem;
  min-width: 8.5rem;
  padding: 0.45rem 0.65rem;
}

.diff-filter-toolbar .diff-review-toggle {
  align-items: center;
  flex-direction: row;
  gap: 0.4rem;
  white-space: nowrap;
}

.diff-filter-toolbar .diff-review-toggle input {
  min-width: 0;
  width: 16px;
  height: 16px;
}

.diff-filter-actions {
  display: flex;
  gap: 0.5rem;
}

.diff-filter-chip-bar {
  margin-bottom: 0.75rem;
}

@media (max-width: 980px) {
  .diff-filter-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .diff-filter-toolbar label,
  .diff-filter-toolbar .diff-search-label,
  .diff-filter-toolbar select,
  .diff-filter-toolbar input[type="search"] {
    width: 100%;
    min-width: 100%;
  }
  .diff-filter-actions {
    width: 100%;
  }
  .diff-filter-actions button {
    flex: 1;
  }
}

/* Save Review Progress button and unsaved-changes indicator */
.review-progress-bar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0;
}

.save-review-btn {
  align-items: center;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  transition: background 0.15s;
}

.save-review-btn:hover {
  background: var(--secondary);
}

.save-review-btn:disabled {
  background: var(--gray);
  cursor: not-allowed;
  opacity: 0.6;
}

.save-review-btn .save-icon::before {
  content: '\1F4BE';
}

.unsaved-indicator {
  align-items: center;
  color: var(--warning);
  display: inline-flex;
  font-size: 0.8rem;
  font-weight: 600;
  gap: 0.35rem;
}

.unsaved-indicator::before {
  content: '\2022';
  font-size: 1.2rem;
  line-height: 1;
}

.unsaved-indicator.saved {
  color: var(--success);
}

.unsaved-indicator.saved::before {
  content: '\2713';
  font-size: 0.9rem;
}

.review-progress-saved-at {
  color: var(--gray);
  font-size: 0.78rem;
  margin-left: auto;
}

/* Review & Confirm panel layout */
.review-confirm-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 1rem;
  overflow: hidden;
}

.review-confirm-header {
  align-items: center;
  background: var(--light);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
}

.review-confirm-header h3 {
  color: var(--primary);
  font-size: 1rem;
  margin: 0;
}

.review-confirm-body {
  padding: 1rem 1.25rem;
}

.review-confirm-footer {
  align-items: center;
  background: var(--light);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 0.75rem 1.25rem;
}

.review-confirm-footer .apply-btn {
  background: var(--success);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1.2rem;
  transition: background 0.15s;
}

.review-confirm-footer .apply-btn:hover {
  background: #2f855a;
}

.review-confirm-footer .apply-btn:disabled {
  background: var(--gray);
  cursor: not-allowed;
  opacity: 0.5;
}

.review-confirm-footer .discard-btn {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--danger);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  transition: all 0.15s;
}

.review-confirm-footer .discard-btn:hover {
  background: #fef2f2;
  border-color: var(--danger);
}

/* Diff summary metrics board */
.diff-summary-board {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin-bottom: 1rem;
}

.diff-summary-metric {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
}

.diff-summary-metric .label {
  color: var(--gray);
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.diff-summary-metric .value {
  color: var(--primary);
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.diff-summary-metric.new .value { color: var(--success); }
.diff-summary-metric.changed .value { color: var(--warning); }
.diff-summary-metric.removed .value { color: var(--danger); }

.diff-note {
  color: var(--gray);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.diff-auto {
  color: var(--gray);
  font-style: italic;
}

@media (max-width: 980px) {
  .topbar { padding: 0.75rem 1rem; }
  .topbar { grid-template-columns: 1fr; }
  .header-actions { flex-wrap: wrap; justify-content: flex-start; justify-self: start; }
  .system-updated { flex-basis: 100%; margin-right: 0; }
  .layout {
    display: block;
    padding: 0.75rem;
  }
  .sidebar {
    max-height: none;
    margin-bottom: 1rem;
    position: relative;
    width: 100%;
  }
  nav#mainNav { margin-top: 0.75rem; width: auto; }
  .sidebar.collapsed nav#mainNav { width: 200px; }
  .hero-panel { display: block; }
  .hero-actions { margin-top: 1rem; }
  .two-col,
  .overview-chart-grid,
  .reload-grid { grid-template-columns: 1fr; }
  .chart-box,
  .chart-box-large {
    height: 320px;
    min-height: 320px;
  }
  .contractor-chart {
    height: 460px;
    min-height: 460px;
  }
  select,
  input { min-width: min(100%, 220px); }
}

.contractor-spotlight-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.contractor-spotlight-layout {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr 1fr;
}

.contractor-spotlight-left {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.contractor-spotlight-right {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.contractor-spotlight-scope-header {
  text-align: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.scope-badge {
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.contractor-spotlight-clients {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-top: 0.15rem;
  border-top: 1px solid var(--border);
  margin-top: 0.15rem;
}

.contractor-spotlight-clients strong {
  margin: 0 0 0.1rem 0;
  padding: 0;
  line-height: 1.2;
  font-size: 0.9rem;
  color: var(--dark);
}

.client-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.contractor-spotlight-identity {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.contractor-spotlight-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.contractor-spotlight-header-row strong {
  color: var(--dark);
  font-size: 1.25rem;
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
}

.contractor-spotlight-rank-badges {
  background: var(--primary);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.contractor-spotlight-meta {
  color: var(--gray);
  font-size: 0.85rem;
}

.contractor-spotlight-coverage {
  color: var(--gray);
  font-size: 0.85rem;
}

.contractor-spotlight-recent {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
}

.contractor-spotlight-recent strong {
  color: var(--dark);
  font-size: 0.9rem;
}

.contractor-spotlight-empty {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--gray);
  display: block;
  font-size: 0.86rem;
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 0.75rem 0.85rem;
}

.recent-contract-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
  align-items: start;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.recent-contract-row:last-child {
  border-bottom: none;
}

.recent-contract-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.recent-contract-title {
  color: var(--dark);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}

.recent-contract-dept {
  color: var(--gray);
  font-size: 0.78rem;
}

.recent-contract-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: flex-end;
  text-align: right;
  white-space: nowrap;
}

.recent-contract-date {
  color: var(--gray);
  font-size: 0.78rem;
}

.recent-contract-value {
  color: var(--dark);
  font-size: 0.85rem;
  font-weight: 700;
}

.contractor-spotlight-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.contractor-spotlight-section + .contractor-spotlight-section {
  margin-top: 0.5rem;
}

.section-title-small {
  color: var(--dark);
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.4rem 0;
  padding: 0;
  line-height: 1.2;
}

.compact-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.compact-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
  cursor: default;
}

.client-card {
  background: #f0f7ff;
  border-color: #cce5ff;
  cursor: pointer;
  transition: background 0.2s;
}

.client-card:hover {
  background: #e0f0ff;
}

.nature-card {
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.nature-card:hover {
  background: #f0f7ff;
  border-color: #cce5ff;
}

.rank-1 {
  border-color: #fbbf24;
  background: #fef3c7;
}

.rank-1:hover {
  background: #fde68a;
}

.compact-card-label {
  color: var(--dark);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.compact-card-value {
  color: var(--dark);
  font-size: 0.9rem;
  font-weight: 700;
}

.compact-card-meta {
  color: var(--gray);
  font-size: 0.75rem;
}

.contractor-spotlight-halves {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.5rem;
}

.contractor-spotlight-half {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.compact-cards-grid.single-col {
  grid-template-columns: 1fr;
}

.dominance-summary {
  margin-bottom: 0.25rem;
}

.dominance-badge {
  display: inline-block;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  color: #92400e;
  font-weight: 600;
}

.top-contract-detail {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.top-contract-title {
  color: var(--dark);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}

.top-contract-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.meta-item {
  font-size: 0.78rem;
  color: var(--gray);
}

.meta-item strong {
  color: var(--dark);
  font-weight: 600;
}

.qps-fy-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.qps-fy-row:last-child {
  border-bottom: none;
}

.qps-fy-name {
  color: var(--dark);
  font-size: 0.85rem;
  font-weight: 600;
}

.qps-fy-value {
  color: var(--dark);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
}

.qps-fy-count {
  color: var(--gray);
  font-size: 0.8rem;
  text-align: right;
}

.fy-breakdown-divider {
  color: var(--gray);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0 0.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.fy-row .qps-fy-name {
  padding-left: 1rem;
}

.contractor-spotlight-nature strong {
  color: var(--dark);
  font-size: 0.9rem;
  margin: 0 0 0.1rem 0;
  padding: 0;
  line-height: 1.2;
}

.nature-dist-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border);
}

.nature-dist-row:last-child {
  border-bottom: none;
}

.nature-dist-name {
  color: var(--dark);
  font-size: 0.85rem;
  font-weight: 600;
}

.nature-dist-count {
  color: var(--gray);
  font-size: 0.8rem;
  text-align: right;
}

.nature-dist-value {
  color: var(--dark);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
  min-width: 6rem;
}

.qps-fy-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.qps-fy-row:last-child {
  border-bottom: none;
}

.qps-fy-name {
  color: var(--dark);
  font-size: 0.85rem;
  font-weight: 600;
}

.qps-fy-value {
  color: var(--dark);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
}

.qps-fy-count {
  color: var(--gray);
  font-size: 0.8rem;
  text-align: right;
}

.fy-breakdown-divider {
  color: var(--gray);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0 0.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.fy-row .qps-fy-name {
  padding-left: 1rem;
}

.client-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f0f7ff;
  border: 1px solid #cce5ff;
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  margin: 0.15rem 0.25rem 0.15rem 0;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}

.client-chip:hover {
  background: #e0f0ff;
}

.client-chip span {
  background: var(--accent);
  color: white;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
}

@media (max-width: 560px) {
  .summary-grid,
  .summary-grid.small { grid-template-columns: 1fr; }
  .section-title,
  .panel,
  .metric-card { padding: 1rem; }
  .modal { padding: 0.75rem; }
  .modal-content { padding: 1rem; max-height: calc(100vh - 1.5rem); }
  .toolbar,
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-actions a,
  .secondary-btn,
  .pagination button,
  .pill,
  select,
  input { width: 100%; }
  .contractor-spotlight-grid { grid-template-columns: 1fr; }
  .contractor-spotlight-layout {
    grid-template-columns: 1fr;
  }
  .recent-contract-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .recent-contract-meta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* Data Cleansing / Settings panel */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.settings-group h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--primary);
}
.settings-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}
.settings-field.inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.settings-field.inline input[type="checkbox"] {
  margin: 0;
}
.settings-field label {
  font-weight: 500;
  margin-bottom: 0.35rem;
}
.settings-field.inline label {
  margin-bottom: 0;
}
.settings-field input[type="number"],
.settings-field textarea {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}
.settings-field textarea {
  font-family: monospace;
  resize: vertical;
}
.field-hint {
  font-size: 0.8rem;
  color: var(--gray);
  margin-top: 0.25rem;
}
.settings-actions {
  margin-top: 1rem;
}
.settings-summary-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
}
.settings-summary-list li {
  margin-bottom: 0.4rem;
}
.settings-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  font-size: 0.9rem;
}
.status-reason {
  color: var(--gray);
  font-size: 0.75rem;
  margin-top: 0.25rem;
  white-space: pre-line;
  line-height: 1.3;
}
