/* ============================================================
   PR315 Change Order Engine — Styles
   All selectors scoped to .pr315-* prefix only.
   ============================================================ */

/* ── Page header ────────────────────────────────────────────── */
.pr315-page-header {
  padding: 16px 20px 0;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.pr315-page-title {
  font-size: 20px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.pr315-page-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 10px 0;
}

.pr315-tab-ribbon {
  height: 3px;
  background: #f97316;
  border-radius: 2px 2px 0 0;
  margin-top: 8px;
}

/* ── Lily bar ────────────────────────────────────────────────── */
.pr315-lily-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ede9fe;
  border-left: 4px solid #7c3aed;
  padding: 10px 16px;
  margin: 0 0 0 0;
  font-size: 13px;
  color: #4c1d95;
}

.pr315-lily-icon {
  font-size: 11px;
  font-weight: 700;
  background: #7c3aed;
  color: #fff;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pr315-lily-text {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}

/* ── Stats row ────────────────────────────────────────────────── */
.pr315-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.pr315-stat-pill {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 120px;
  flex: 1;
}

.pr315-stat-label {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.pr315-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #1A1A2E;
  line-height: 1;
}

/* ── Action bar ───────────────────────────────────────────────── */
.pr315-action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.pr315-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}

.pr315-btn:hover {
  background: #f3f4f6;
}

.pr315-btn-primary {
  background: #f97316;
  border-color: #f97316;
  color: #fff;
}

.pr315-btn-primary:hover {
  background: #ea6c0a;
  border-color: #ea6c0a;
}

.pr315-btn-secondary {
  background: #6b7280;
  border-color: #6b7280;
  color: #fff;
}

.pr315-btn-secondary:hover {
  background: #4b5563;
  border-color: #4b5563;
}

.pr315-btn-danger {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.pr315-btn-danger:hover {
  background: #fecaca;
}

.pr315-btn-new {
  margin-right: 4px;
}

/* Two-tap confirm pulse */
.pr315-confirm-pending {
  background: #fff7ed !important;
  border-color: #f97316 !important;
  color: #c2410c !important;
  animation: pr315-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes pr315-pulse {
  from { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4); }
  to   { box-shadow: 0 0 0 6px rgba(249, 115, 22, 0); }
}

/* ── Filter bar ───────────────────────────────────────────────── */
.pr315-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pr315-filter-select {
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
}

/* ── List wrapper ─────────────────────────────────────────────── */
.pr315-list-wrapper {
  padding: 12px 20px 20px;
  overflow-x: auto;
}

/* ── Table ────────────────────────────────────────────────────── */
.pr315-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pr315-thead-tr {
  background: #1A1A2E;
}

.pr315-th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #e5e7eb;
  white-space: nowrap;
}

.pr315-tr {
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.1s;
}

.pr315-tr:hover {
  background: #fafafa;
}

.pr315-td {
  padding: 10px 12px;
  vertical-align: middle;
  color: #374151;
}

.pr315-title-cell {
  font-weight: 600;
  color: #1A1A2E;
  max-width: 260px;
}

.pr315-actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.pr315-amount {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ── Badges ───────────────────────────────────────────────────── */
.pr315-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.4;
}

/* Status badges */
.pr315-badge-draft {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #d1d5db;
}

.pr315-badge-pending_internal {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.pr315-badge-internally_approved {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.pr315-badge-submitted_to_gc {
  background: #ccfbf1;
  color: #0f766e;
  border: 1px solid #5eead4;
}

.pr315-badge-gc_approved {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.pr315-badge-gc_rejected {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.pr315-badge-negotiating {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fdba74;
}

.pr315-badge-void {
  background: #f9fafb;
  color: #9ca3af;
  border: 1px solid #e5e7eb;
}

/* Source badges */
.pr315-badge-source-field_initiated {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde047;
}

.pr315-badge-source-pm_initiated {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

.pr315-badge-source-owner_directed {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #d8b4fe;
}

.pr315-badge-source-unforeseen_condition {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ── Detail panel ─────────────────────────────────────────────── */
.pr315-detail-row td {
  padding: 0;
}

.pr315-detail-panel {
  border-left: 4px solid #f97316;
  background: #fff;
  padding: 20px 24px;
  margin: 0;
}

.pr315-detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.pr315-co-number-lg {
  font-size: 16px;
  font-weight: 800;
  color: #1A1A2E;
}

.pr315-title-lg {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  flex: 1;
}

.pr315-detail-dates {
  margin-bottom: 8px;
  font-size: 12px;
  color: #6b7280;
}

.pr315-date-label {
  margin-right: 14px;
}

.pr315-detail-desc {
  font-size: 13px;
  color: #4b5563;
  margin-bottom: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.pr315-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin: 14px 0 8px 0;
}

.pr315-empty-scope {
  font-size: 13px;
  color: #9ca3af;
  font-style: italic;
  padding: 8px 0;
}

/* Scope items table (reuses base table styles) */
.pr315-scope-table {
  margin-bottom: 12px;
}

/* Cost summary */
.pr315-cost-summary {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 14px;
  max-width: 340px;
}

.pr315-cost-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  color: #374151;
}

.pr315-cost-total {
  border-top: 1px solid #d1d5db;
  margin-top: 4px;
  padding-top: 8px;
  font-weight: 700;
  color: #1A1A2E;
}

.pr315-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.pr315-revision-link {
  font-size: 12px;
  color: #6b7280;
  margin-top: 8px;
}

.pr315-linked-inv {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

/* ── Send sub-panel ───────────────────────────────────────────── */
.pr315-send-subpanel {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 14px 16px;
  margin-top: 10px;
  width: 100%;
}

/* ── GC Response panel ────────────────────────────────────────── */
.pr315-gc-response-panel {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 14px 16px;
  margin-top: 6px;
  width: 100%;
}

/* ── Form elements ────────────────────────────────────────────── */
.pr315-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.pr315-label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.pr315-input {
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  width: 100%;
  box-sizing: border-box;
  color: #374151;
  background: #fff;
}

.pr315-input:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.pr315-input-sm {
  width: auto;
  min-width: 80px;
}

.pr315-textarea {
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  width: 100%;
  box-sizing: border-box;
  min-height: 70px;
  resize: vertical;
  color: #374151;
  background: #fff;
}

.pr315-textarea:focus {
  outline: none;
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.pr315-select {
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
}

/* ── Wizard ───────────────────────────────────────────────────── */
.pr315-wizard {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin: 12px 20px;
  padding: 20px 24px;
}

.pr315-wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 12px;
}

.pr315-wizard-step {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  padding: 4px 14px 4px 0;
  margin-right: 14px;
  cursor: default;
}

.pr315-wizard-step-active {
  color: #f97316;
  border-bottom: 2px solid #f97316;
  margin-bottom: -14px;
}

.pr315-wizard-step-done {
  color: #15803d;
}

.pr315-wizard-panel {
  padding: 4px 0;
}

.pr315-markup-row {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.pr315-scope-input-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px;
  background: #f9fafb;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.pr315-row-total {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  min-width: 60px;
  text-align: right;
}

.pr315-wiz-cost {
  max-width: 300px;
  margin-top: 12px;
}

.pr315-wiz-cost-preview {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px 14px;
  margin-top: 12px;
  max-width: 300px;
}

.pr315-wiz-cost-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 3px 0;
  color: #374151;
}

.pr315-wiz-cost-adj {
  border-top: 1px solid #d1d5db;
  margin-top: 4px;
  padding-top: 6px;
  font-weight: 700;
  color: #1A1A2E;
}

/* ── Hidden from field tech ────────────────────────────────────── */
.pr315-hidden-ft {
  color: #9ca3af;
  font-style: normal;
}

/* ── Responsive < 768px ────────────────────────────────────────── */
@media (max-width: 767px) {
  .pr315-stats-row {
    padding: 10px 12px;
    gap: 8px;
  }

  .pr315-stat-pill {
    min-width: calc(50% - 8px);
    flex: none;
  }

  .pr315-action-bar {
    padding: 10px 12px;
    flex-wrap: wrap;
  }

  .pr315-list-wrapper {
    padding: 8px 0;
  }

  /* Card collapse for table rows */
  .pr315-table,
  .pr315-table thead,
  .pr315-table tbody,
  .pr315-table tr,
  .pr315-table td,
  .pr315-table th {
    display: block;
  }

  .pr315-thead-tr {
    display: none;
  }

  .pr315-tr {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin: 8px 12px;
    padding: 10px 14px;
    cursor: pointer;
  }

  .pr315-td {
    padding: 4px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border: none;
  }

  .pr315-td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 100px;
  }

  .pr315-actions-cell {
    flex-wrap: wrap;
  }

  .pr315-detail-panel {
    padding: 14px 16px;
  }

  .pr315-wizard {
    margin: 10px 12px;
    padding: 16px;
  }

  .pr315-cost-summary {
    max-width: 100%;
  }

  .pr315-page-header {
    padding: 12px 14px 0;
  }
}
