/* =============================================================================
   KCAS TK Proposal Portal — Main Stylesheet
   Design: "Precision Instrument" — Clinical confidence meets modern sophistication
   Co-branded: KCAS Bio + Momentum Metrix
   ============================================================================= */

/* ---------------------------------------------------------------------------
   1. Design Tokens
   --------------------------------------------------------------------------- */
:root {
  /* MM Brand (authoritative hex from brand.yaml) */
  --mm-red: #DE3F2A;
  --mm-red-hover: #B73323;
  --mm-black: #272F2E;
  /* KCAS Brand (secondary in MM-forward co-branding) */
  --kcas-blue: #2563eb;
  --kcas-orange: #f56b00;
  --kcas-light-blue: #e3eaf3;
  /* Shared */
  --text-primary: #272F2E;
  --text-secondary: #5c5e5e;
  --text-muted: #8c8c8a;
  --bg: #ffffff;
  --bg-secondary: #f7f7f6;
  --border: #e4e4e4;
  --border-light: #E0E3E3;
  --shadow: rgba(39, 47, 46, 0.04);
  --shadow-hover: rgba(39, 47, 46, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --success: #00A86B;
  --danger: #CC3333;
  --purple: #939bc9;
  /* Typography — MM brand uses Instrument Sans for body + headings,
     Pasajero reserved for the MM wordmark only (.mm-wordmark) */
  --font-heading: 'Instrument Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-body: 'Instrument Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  /* Layout */
  --sidebar-width: 220px;
  --topbar-height: 96px;
}

/* MM wordmark font — use only for the .mm-wordmark class, never body text */
@font-face {
  font-family: 'Pasajero';
  src: url('../assets/fonts/Pasajero.otf') format('opentype');
  font-display: swap;
}
/* Mixed-case form (e.g. "momEntum mEtrix") — lowercase keys render as plain
   capitals, uppercase keys render with the distinctive Pasajero forms (≡ E, etc.).
   Do NOT add text-transform: uppercase here — it would force all letters into
   the distinctive style and break the intended mixed-case effect. */
.mm-wordmark {
  font-family: 'Pasajero', sans-serif;
  letter-spacing: 0.06em;
  color: var(--mm-black);
}
/* Full-lockup form — every letter in the distinctive Pasajero style. */
.mm-wordmark--lockup {
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ---------------------------------------------------------------------------
   2. Base Reset & Typography
   --------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-secondary);
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

p { margin-bottom: 0.75rem; }

a {
  color: var(--mm-red);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------------------------------
   3. Topbar
   --------------------------------------------------------------------------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--mm-black);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-height);
  padding: 0 24px;
}

.topbar-title {
  color: #ffffff;
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.logo {
  height: 60px;
  width: auto;
  object-fit: contain;
}

/* MM takes primary position — bigger; KCAS secondary */
.logo-mm {
  max-width: 220px;
}

.logo-kcas {
  max-width: 160px;
  opacity: 0.95;
}

/* Topbar right cluster: KCAS logo + sign-out */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-signout {
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.topbar-signout:hover {
  background: var(--mm-red);
  border-color: var(--mm-red);
  text-decoration: none;
}

/* Solid MM red accent line (MM-forward, no KCAS gradient) */
.accent-line {
  height: 3px;
  background: var(--mm-red);
}

/* ---------------------------------------------------------------------------
   4. Sidebar
   --------------------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: calc(var(--topbar-height) + 3px);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: #1e1e2e;
  display: flex;
  flex-direction: column;
  z-index: 90;
  overflow-y: auto;
  transition: transform 0.2s ease;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: #a0a0b0;
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.sidebar-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-item.active {
  color: #ffffff;
  background: rgba(222, 63, 42, 0.12);
  border-left-color: var(--mm-red);
}

.sidebar-item-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
  color: #a0a0b0;
  font-size: 0.8125rem;
  font-family: var(--font-body);
}

/* Sidebar hidden (external clients or mobile) */
.sidebar-hidden {
  transform: translateX(-100%);
}

/* ---------------------------------------------------------------------------
   5. Main Content
   --------------------------------------------------------------------------- */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: calc(var(--topbar-height) + 3px);
  padding: 32px;
  min-height: calc(100vh - var(--topbar-height) - 3px);
  transition: margin-left 0.2s ease;
}

.main-content-full {
  margin-left: 0;
}

.main-content .content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
}

/* Wide variant for data-dense tables (All Submissions) that need
   horizontal room. Overrides the base max-width without affecting
   reading-width tabs like New Proposal. */
.main-content .content-wrapper.content-wrapper-wide {
  max-width: 1500px;
}

/* ---------------------------------------------------------------------------
   6. Tab Panels
   --------------------------------------------------------------------------- */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ---------------------------------------------------------------------------
   7. Upload Drop Zone
   --------------------------------------------------------------------------- */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  border: 2px dashed var(--kcas-blue);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.drop-zone:hover {
  background: var(--kcas-light-blue);
}

.drop-zone.dragover {
  border-color: var(--mm-red);
  background: rgba(222, 63, 42, 0.06);
}

.drop-zone-icon {
  font-size: 2.5rem;
  color: var(--kcas-blue);
  margin-bottom: 12px;
}

.drop-zone-text {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.drop-zone-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------------
   8. Form Inputs
   --------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--kcas-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235c5e5e' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--kcas-blue);
}

.form-checkbox label {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
}

/* ---------------------------------------------------------------------------
   9. Buttons
   --------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  text-decoration: none;
  line-height: 1.4;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--mm-red);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--mm-red-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--kcas-blue);
  border: 1.5px solid var(--kcas-blue);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.06);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background: #b02828;
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-success:hover:not(:disabled) {
  background: #008c59;
}

.btn-warning {
  background: #f59e0b;
  color: #ffffff;
}

.btn-warning:hover:not(:disabled) {
  background: #d97706;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8125rem;
}

.btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------------
   10. Tables
   --------------------------------------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: var(--bg);
}

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

thead th {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody tr:nth-child(even) {
  background: var(--bg-secondary);
}

tbody tr:hover {
  background: var(--kcas-light-blue);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ---------------------------------------------------------------------------
   11. Status Badges
   --------------------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-proposal_generated {
  background: rgba(37, 99, 235, 0.1);
  color: var(--kcas-blue);
}

.badge-client_approved {
  background: rgba(245, 107, 0, 0.1);
  color: var(--kcas-orange);
}

.badge-mm_approved {
  background: rgba(0, 168, 107, 0.1);
  color: var(--success);
}

.badge-revision_requested {
  background: rgba(204, 51, 51, 0.1);
  color: var(--danger);
}

.badge-price_revision {
  background: rgba(245, 107, 0, 0.12);
  color: #b45309;
}

.badge-proposal_dead {
  background: rgba(140, 140, 138, 0.12);
  color: var(--text-muted);
}

.badge-contract_ready {
  background: rgba(147, 155, 201, 0.15);
  color: var(--purple);
}

.badge-client_revision_requested {
  background: rgba(245, 107, 0, 0.12);
  color: #b45309;
}

.badge-proposal_cancelled {
  background: rgba(140, 140, 138, 0.12);
  color: var(--text-muted);
  text-decoration: line-through;
}

/* ---------------------------------------------------------------------------
   12. Cards
   --------------------------------------------------------------------------- */
.card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 3px var(--shadow);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 2px 8px var(--shadow-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Stat cards for analytics */
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---------------------------------------------------------------------------
   13. Modal Overlay
   --------------------------------------------------------------------------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible {
  display: flex;
}

.modal-content {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 560px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ---------------------------------------------------------------------------
   14. Spinner / Loading
   --------------------------------------------------------------------------- */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--kcas-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  gap: 12px;
}

/* ---------------------------------------------------------------------------
   15. Empty State
   --------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.empty-state-text {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 500;
}

/* ---------------------------------------------------------------------------
   16. Section Headers
   --------------------------------------------------------------------------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------------------------------------------------------------------------
   17. Toast / Notifications
   --------------------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--mm-black);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  z-index: 300;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  animation: toast-in 0.3s ease;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------------------
   18. Responsive — Mobile
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  .topbar-inner {
    padding: 0 16px;
  }

  .topbar-title {
    font-size: 0.875rem;
  }

  .logo {
    height: 48px;
  }

  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    width: 95%;
    padding: 20px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* ---------------------------------------------------------------------------
   19. Utility Classes
   --------------------------------------------------------------------------- */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.hidden { display: none !important; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   20. Queue Tab — Review Cards
   --------------------------------------------------------------------------- */
.queue-cards {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.queue-review-card {
  padding: 28px;
}

.queue-dates {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.queue-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.queue-section-title {
  font-family: var(--font-heading);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.queue-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 24px;
}

.queue-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.queue-info-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-family: var(--font-heading);
}

.queue-info-value {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.queue-timepoints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.queue-timepoint-pill {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-family: var(--font-heading);
  font-weight: 500;
  background: var(--kcas-light-blue);
  color: var(--kcas-blue);
  border-radius: 999px;
}

.queue-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.queue-total-label {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.queue-total-value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--mm-red);
}

/* Complexity badge */
.card-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.complexity-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}

.complexity-score {
  font-weight: 700;
  font-size: 1rem;
}

.complexity-divider {
  opacity: 0.4;
  margin: 0 2px;
}

.complexity-fte {
  font-weight: 600;
}

.complexity-green {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.complexity-amber {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.complexity-red {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Complexity key legend */
.complexity-key {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.complexity-key-title {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.complexity-key-items {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.complexity-key-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.complexity-key-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.complexity-key-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 10px;
  margin-bottom: 0;
}

.queue-tam {
  margin-top: 8px;
  padding: 0 4px;
}

.queue-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .queue-info-grid {
    grid-template-columns: 1fr 1fr;
  }

  .queue-total {
    flex-direction: column;
    text-align: center;
    gap: 4px;
  }
}

/* ---------------------------------------------------------------------------
   21. Submissions Tab — Admin Table Controls & Expandable Rows
   --------------------------------------------------------------------------- */
.sub-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sub-controls-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.sub-controls-right {
  flex-shrink: 0;
}

.sub-search {
  max-width: 320px;
  min-width: 180px;
}

.sub-status-filter {
  max-width: 220px;
  min-width: 160px;
}

/* Sortable column headers */
.sub-sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.sub-sortable:hover {
  color: var(--kcas-blue);
}

.sub-sort-active {
  color: var(--kcas-blue);
}

/* Clickable rows */
.sub-row {
  cursor: pointer;
}

.sub-row-expanded {
  background: var(--kcas-light-blue) !important;
}

/* Expandable detail row */
.sub-detail-row td {
  padding: 0;
  border-bottom: 2px solid var(--kcas-blue);
}

.sub-detail-row:not(.hidden) td {
  padding: 16px 20px;
}

.sub-detail-content {
  padding: 4px 0;
}

.sub-detail-budget {
  margin-top: 12px;
}

.sub-detail-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  margin-top: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 0.875rem;
}

.sub-detail-total strong {
  color: var(--mm-red);
  font-size: 1.125rem;
}

@media (max-width: 768px) {
  .sub-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .sub-controls-left {
    flex-direction: column;
  }

  .sub-search,
  .sub-status-filter {
    max-width: none;
    width: 100%;
  }
}

/* ---------------------------------------------------------------------------
   22. Analytics Tab — Stat Cards, Bar Chart, Legend
   --------------------------------------------------------------------------- */

/* Responsive grids for stat cards */
.analytics-grid {
  display: grid;
  gap: 16px;
}

.analytics-grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

.analytics-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.analytics-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.analytics-stat-sublabel {
  margin-top: 4px;
  font-size: 0.6875rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* Stat card */
.analytics-stat-card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  box-shadow: 0 1px 3px var(--shadow);
  transition: box-shadow 0.2s;
}

.analytics-stat-card:hover {
  box-shadow: 0 2px 8px var(--shadow-hover);
}

/* Amber accent for Pending Approval */
.analytics-stat-amber .analytics-stat-value {
  color: var(--kcas-orange);
}

.analytics-stat-amber {
  border-left: 3px solid var(--kcas-orange);
}

.analytics-stat-icon {
  font-size: 1.25rem;
  margin-bottom: 6px;
}

.analytics-stat-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.analytics-stat-currency {
  font-size: 1.5rem;
}

.analytics-stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: var(--font-heading);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Stacked bar chart */
.analytics-bar-wrapper {
  padding: 0 4px;
}

.analytics-bar {
  display: flex;
  height: 32px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-secondary);
}

.analytics-bar-segment {
  transition: width 0.3s ease;
  min-width: 2px;
}

.analytics-bar-segment:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.analytics-bar-segment:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.analytics-bar-segment:only-child {
  border-radius: var(--radius-sm);
}

/* Legend */
.analytics-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-top: 16px;
  padding: 0 4px;
}

.analytics-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
}

.analytics-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.analytics-legend-label {
  color: var(--text-secondary);
}

.analytics-legend-count {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-primary);
}

/* Responsive: analytics grids */
@media (max-width: 1024px) {
  .analytics-grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .analytics-grid-5 {
    grid-template-columns: repeat(2, 1fr);
  }

  .analytics-grid-3 {
    grid-template-columns: 1fr;
  }

  .analytics-stat-value {
    font-size: 1.5rem;
  }

  .analytics-stat-currency {
    font-size: 1.25rem;
  }

  .analytics-legend {
    gap: 10px 16px;
  }
}

/* ---------------------------------------------------------------------------
   23. Pricing Config Tab — Parameter Editor
   --------------------------------------------------------------------------- */
.pricing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.pricing-label {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0;
  min-width: 0;
  padding-right: 16px;
}

.pricing-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  width: 180px;
  position: relative;
}

.pricing-input {
  width: 100% !important;
  text-align: right;
  padding-right: 12px;
  -moz-appearance: textfield;
}

.pricing-input::-webkit-inner-spin-button,
.pricing-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pricing-input-prefix {
  position: absolute;
  left: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.pricing-input-prefix + .pricing-input {
  padding-left: 28px;
  text-align: right;
}

.pricing-input-suffix {
  position: absolute;
  right: 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.pricing-input-wrapper:has(.pricing-input-suffix) .pricing-input {
  padding-right: 48px;
}

/* Save bar at bottom */
.pricing-save-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

/* Change confirmation list in modal */
.pricing-change-list {
  margin: 12px 0;
  padding-left: 20px;
  font-size: 0.875rem;
  color: var(--text-primary);
  list-style: disc;
}

.pricing-change-list li {
  padding: 4px 0;
}

@media (max-width: 768px) {
  .pricing-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .pricing-label {
    padding-right: 0;
  }

  .pricing-input-wrapper {
    width: 100%;
  }
}

/* ---------------------------------------------------------------------------
   24. Batch Upload — File Queue, Progress, Results
   --------------------------------------------------------------------------- */

/* Button row inside drop zone */
.batch-btn-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* File queue card */
.batch-queue {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-top: 16px;
  box-shadow: 0 1px 3px var(--shadow);
}

.batch-queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.batch-queue-footer {
  text-align: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

/* File list */
.batch-file-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.batch-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
}

.batch-file-item:last-child {
  border-bottom: none;
}

.batch-file-item:nth-child(even) {
  background: var(--bg-secondary);
}

.batch-file-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.batch-file-name {
  flex: 1;
  min-width: 0;
}

.batch-file-size {
  flex-shrink: 0;
  min-width: 60px;
  text-align: right;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.btn-icon:hover {
  color: var(--danger);
  background: rgba(204, 51, 51, 0.08);
}

/* Progress section */
.batch-progress {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 16px;
  box-shadow: 0 1px 3px var(--shadow);
}

.batch-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.batch-progress-bar-wrapper {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.batch-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--kcas-blue), var(--mm-red));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.batch-progress-log {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.batch-log-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.8125rem;
}

.batch-log-entry:last-child {
  border-bottom: none;
}

.batch-log-status {
  margin-left: auto;
  flex-shrink: 0;
  font-weight: 500;
}

.batch-log-icon-ok {
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
}

.batch-log-icon-fail {
  color: var(--danger);
  font-weight: 700;
  flex-shrink: 0;
}

.batch-log-icon-skip {
  color: var(--text-secondary);
  font-weight: 700;
  flex-shrink: 0;
}

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

.batch-log-error {
  background: rgba(204, 51, 51, 0.03);
}

.batch-log-detail {
  padding: 6px 12px 10px 36px;
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--danger);
  background: rgba(204, 51, 51, 0.04);
  border-bottom: 1px solid var(--border-light);
  word-break: break-all;
  white-space: pre-wrap;
}

/* Batch results */
.batch-results-section {
  margin-top: 12px;
}

.batch-results-list {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  max-height: 400px;
  overflow-y: auto;
}

.batch-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
}

.batch-result-item:last-child {
  border-bottom: none;
}

.batch-result-ok:nth-child(even) {
  background: var(--bg-secondary);
}

.batch-result-fail {
  background: rgba(204, 51, 51, 0.03);
}

.batch-result-skip {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

/* ===== 25. Table Checkboxes ===== */
.th-checkbox,
.td-checkbox {
  width: 36px;
  text-align: center;
  padding: 6px 8px !important;
}

.th-checkbox input[type="checkbox"],
.td-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--mm-red);
}

@media (max-width: 768px) {
  .batch-queue-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .batch-btn-row {
    flex-direction: column;
    width: 100%;
  }

  .batch-btn-row .btn {
    width: 100%;
  }
}

/* ---------------------------------------------------------------------------
   26. Revise Price Modal — Milestone Editor
   --------------------------------------------------------------------------- */
.revise-milestone-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.revise-milestone-row:last-child {
  border-bottom: none;
}

.revise-milestone-label {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.revise-milestone-input {
  width: 140px;
  text-align: right;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  -moz-appearance: textfield;
}

.revise-milestone-input::-webkit-inner-spin-button,
.revise-milestone-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.revise-milestone-input:focus {
  border-color: var(--kcas-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.revise-total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.revise-total-label {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.revise-total-value {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--mm-red);
}

.text-warning {
  color: #b45309;
}

/* ---------------------------------------------------------------------------
   25. Admin Tab — Card Grid Dashboard & Section Views
   --------------------------------------------------------------------------- */

/* Card grid */
.admin-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 900px;
}

.admin-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 2px 8px var(--shadow);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s;
}

.admin-card:hover {
  box-shadow: 0 4px 16px var(--shadow-hover);
  transform: translateY(-2px);
}

.admin-card-blue {
  border-left: 4px solid var(--kcas-blue);
}

.admin-card-red {
  border-left: 4px solid var(--mm-red);
}

.admin-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.admin-card-header h3 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.admin-card-icon {
  font-size: 28px;
}

.admin-card-desc {
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-body);
  margin: 0 0 16px 0;
}

.admin-card-stats {
  display: flex;
  gap: 20px;
}

.admin-stat {
  text-align: center;
}

.admin-stat-value {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-heading);
}

.admin-card-blue .admin-stat-value {
  color: var(--kcas-blue);
}

.admin-card-red .admin-stat-value {
  color: var(--mm-red);
}

.admin-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-heading);
  margin-top: 2px;
}

/* Loading state */
.admin-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  gap: 12px;
  color: var(--text-muted);
}

/* Info grid (system settings) */
.admin-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 900px;
}

.admin-info-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 8px var(--shadow);
}

.admin-info-card h3 {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.admin-info-card:first-child {
  grid-column: 1 / -1;
}

/* Audit filters */
.admin-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.form-input-sm {
  padding: 6px 10px;
  font-size: 13px;
  max-width: 200px;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-card-grid {
    grid-template-columns: 1fr;
  }
  .admin-info-grid {
    grid-template-columns: 1fr;
  }
  .admin-filters {
    flex-direction: column;
  }
  .form-input-sm {
    max-width: 100%;
  }
}

/* ---------------------------------------------------------------------------
   Welcome / Landing page (public, pre-auth)
   --------------------------------------------------------------------------- */
.welcome-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
}

.welcome-main {
  flex: 1;
  padding-top: calc(var(--topbar-height) + 3px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.welcome-hero {
  max-width: 760px;
  width: 100%;
  text-align: center;
  padding: 72px 24px 40px;
}

.welcome-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.welcome-eyebrow .mm-wordmark {
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--mm-black);
  text-transform: none;
}

.welcome-eyebrow-sep {
  color: var(--mm-red);
  font-weight: 400;
}

.welcome-title {
  font-family: var(--font-heading);
  font-size: 2.75rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

.welcome-sub {
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 36px;
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}

.btn-welcome-cta {
  display: inline-block;
  padding: 14px 36px;
  background: var(--mm-red);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s, transform 0.08s;
  box-shadow: 0 2px 8px rgba(222, 63, 42, 0.18);
}

.btn-welcome-cta:hover {
  background: var(--mm-red-hover);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-welcome-cta:active {
  transform: translateY(0);
}

.welcome-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 20px;
}

.welcome-how {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 1040px;
  width: 100%;
  padding: 24px 24px 72px;
}

.welcome-step {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: 0 1px 2px var(--shadow);
  transition: box-shadow 0.15s, transform 0.08s;
}

.welcome-step:hover {
  box-shadow: 0 4px 16px var(--shadow-hover);
  transform: translateY(-1px);
}

.welcome-step-num {
  width: 32px;
  height: 32px;
  background: var(--mm-red);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.welcome-step-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.welcome-step-body {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

.welcome-footer {
  padding: 20px 24px;
  text-align: center;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.welcome-footer-wordmark {
  font-size: 0.9375rem;
  color: var(--mm-black);
  letter-spacing: 0.04em;
}

.welcome-footer-sep {
  color: var(--text-muted);
}

.welcome-footer-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .welcome-title { font-size: 2rem; }
  .welcome-sub { font-size: 1rem; }
  .welcome-how { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------------
   Access-denied screen (signed in, not on the portal allowlist)
   --------------------------------------------------------------------------- */
.access-denied {
  max-width: 560px;
  margin: 80px auto;
  padding: 48px 32px;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px var(--shadow);
}
.access-denied-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}
.access-denied-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.access-denied-body {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.55;
  margin-bottom: 24px;
}

/* ---------------------------------------------------------------------------
   Clinical NCA tab — intake form extras + results table
   --------------------------------------------------------------------------- */
.tier-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.tier-radio-group label {
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.tier-radio-group label:has(input:checked) {
  border-color: var(--mm-red);
  background: rgba(222, 63, 42, 0.04);
}
.treatment-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  align-items: center;
}
.treatment-row .treatment-label { flex: 2; }
.treatment-row .treatment-n     { flex: 1; }

/* Range results table */
.estimate-range-table {
  width: 100%;
  border-collapse: collapse;
}
.estimate-range-table th,
.estimate-range-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
}
.estimate-range-table thead th {
  font-weight: 600;
  text-align: left;
  border-bottom: 2px solid var(--mm-black);
}
.estimate-range-table .grand-total-row td {
  border-top: 2px solid var(--mm-black);
  border-bottom: none;
  font-size: 1rem;
}

/* Callout (info variant) */
.callout {
  margin: 24px 0;
  padding: 16px 20px;
  border-left: 3px solid var(--mm-red);
  background: #fcf2f0;
  border-radius: 6px;
  font-size: 14.5px;
  line-height: 1.5;
}
.callout-info strong {
  color: var(--mm-red);
  margin-right: 6px;
}

/* Section divider between drop zone and manual form */
.section-divider {
  text-align: center;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Pricing-config boolean (checkbox) input */
.pricing-input-bool {
  padding: 4px 0;
}
.pricing-bool-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9375rem;
  color: var(--text-primary);
}
.pricing-bool-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--mm-red);
}
.pricing-bool-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Demo role badge — shown in the topbar title next to "TK Proposal Pipeline"
   when an admin has toggled a demo role via the MM/KCAS logos. */
.demo-role-badge {
  display: inline-block;
  margin-left: 14px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}
.demo-role-badge.demo-role-mm {
  background: rgba(222, 63, 42, 0.15);
  color: #ffcfc5;
  border: 1px solid rgba(222, 63, 42, 0.5);
}
.demo-role-badge.demo-role-client {
  background: rgba(245, 107, 0, 0.18);
  color: #ffd4a8;
  border: 1px solid rgba(245, 107, 0, 0.55);
}

/* ---------------------------------------------------------------------------
   In-app User Guide — polished, inline, role-aware
   --------------------------------------------------------------------------- */
.guide-root {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.guide-toc {
  position: sticky;
  top: calc(var(--topbar-height) + 24px);
  align-self: start;
}
.guide-toc-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 12px;
}
.guide-toc nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.guide-toc nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.guide-toc nav a:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  text-decoration: none;
}
.guide-toc nav a.active {
  background: rgba(222, 63, 42, 0.06);
  border-left-color: var(--mm-red);
  color: var(--mm-red);
  font-weight: 600;
}

.guide-body {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 40px 48px 48px;
  box-shadow: 0 1px 2px var(--shadow);
  max-width: 900px;
  line-height: 1.6;
}
.guide-hero {
  padding-bottom: 24px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border-light);
}
.guide-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mm-red);
  margin: 0 0 8px;
}
.guide-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  color: var(--text-primary);
}
.guide-sub {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  margin: 0;
}

.guide-body h2.guide-section-title {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 40px 0 14px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  color: var(--text-primary);
  scroll-margin-top: calc(var(--topbar-height) + 16px);
}
.guide-body section:first-of-type h2.guide-section-title {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.guide-body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 24px 0 10px;
  color: var(--text-primary);
}
.guide-body p {
  margin: 0 0 12px;
  color: var(--text-secondary);
}

.guide-list { margin: 0 0 14px 20px; color: var(--text-secondary); }
.guide-list li { margin-bottom: 6px; }
.guide-list-ordered { list-style: decimal; padding-left: 20px; }

.guide-body code {
  font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
  font-size: 0.875em;
  background: var(--bg-subtle);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-primary);
}

/* "At a glance" numbered cards */
.guide-quickstart { margin: 24px 0 32px; }
.guide-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.guide-card {
  position: relative;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 20px;
  transition: border-color 0.12s, transform 0.08s;
}
.guide-card:hover {
  border-color: var(--mm-red);
  transform: translateY(-1px);
}
.guide-card-num {
  width: 28px;
  height: 28px;
  background: var(--mm-red);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 12px;
}
.guide-card h3 {
  font-size: 0.9375rem;
  margin: 0 0 6px;
  color: var(--text-primary);
}
.guide-card p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Two-column option layouts (Upload vs Manual) */
.guide-twocol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 14px 0 18px;
}
.guide-option {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px 18px;
}
.guide-option h4 {
  margin: 0 0 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}
.guide-option p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
}

/* Tables inside the guide */
.guide-table-wrap { overflow-x: auto; margin: 12px 0 20px; }
.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.guide-table th, .guide-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.guide-table th {
  background: var(--bg-subtle);
  font-weight: 600;
  color: var(--text-primary);
}

/* Status pills (miniature badges for the status table) */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.pill-blue    { background: #e3f0f8; color: #1A6FA0; }
.pill-orange  { background: #fef3e2; color: #D4881E; }
.pill-amber   { background: #fff4d6; color: #a87415; }
.pill-green   { background: #e6f7ef; color: #0E8B7A; }
.pill-gray    { background: #edf0f3; color: #4A5568; }
.pill-indigo  { background: #e8e8f5; color: #3A3ABF; }

/* Callouts */
.guide-callout {
  margin: 18px 0;
  padding: 14px 18px;
  border-left: 3px solid var(--mm-red);
  background: #fcf2f0;
  border-radius: 6px;
  font-size: 0.9375rem;
  color: var(--text-primary);
}
.guide-callout-info { background: #e3f0f8; border-left-color: #1A6FA0; }
.guide-callout strong { color: var(--mm-red); margin-right: 4px; }
.guide-callout-info strong { color: #1A6FA0; }

/* Admin dashboard card grid (4-card view) */
.guide-admin-cards { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.guide-card-blue   { border-left: 3px solid #1A6FA0; }
.guide-card-red    { border-left: 3px solid var(--mm-red); }

/* FAQ accordion */
.guide-faq details {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 0;
  margin-bottom: 8px;
  overflow: hidden;
}
.guide-faq summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-primary);
  list-style: none;
  position: relative;
  padding-right: 40px;
}
.guide-faq summary::-webkit-details-marker { display: none; }
.guide-faq summary::after {
  content: '+';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.guide-faq details[open] summary::after { content: '−'; }
.guide-faq details[open] summary { background: var(--bg-subtle); }
.guide-faq details p {
  padding: 0 16px 14px;
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.guide-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* Narrow viewport: stack TOC below content */
@media (max-width: 900px) {
  .guide-root { grid-template-columns: 1fr; }
  .guide-toc { position: static; }
  .guide-body { padding: 28px 24px; }
  .guide-twocol { grid-template-columns: 1fr; }
}

/* Product-line type badges (My Proposals + All Submissions) */
.badge-estimate  { background: #e8e8f5; color: #3A3ABF; }
.badge-proposal  { background: #e3f0f8; color: #1A6FA0; }

/* ---------------------------------------------------------------------------
   Feature Toggle Switches
   --------------------------------------------------------------------------- */
.admin-toggles {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 600px;
}

.admin-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 20px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--text-muted);
  border-radius: 26px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}
