/* ============================================================
   PR321 — WIP Schedule Report Styles
   Class prefix: .pr321-
   Portal aesthetic: matches pr314–pr320
   ============================================================ */

/* ── Page Header ─────────────────────────────────────────── */
.pr321-page-header {
  padding: 20px 24px 12px;
  border-bottom: 2px solid #FF6B00;
  background: #fff;
}

.pr321-page-title {
  font-size: 22px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0 0 4px;
}

.pr321-lily-subtitle {
  font-size: 13px;
  color: #7C3AED;
  margin: 0;
}

/* ── Tab Ribbon ──────────────────────────────────────────── */
.pr321-tab-ribbon {
  display: flex;
  gap: 0;
  background: #f5f5f5;
  border-bottom: 2px solid #FF6B00;
  padding: 0 16px;
}

.pr321-tab-ribbon-item {
  display: inline-block;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  margin-right: 2px;
}

.pr321-tab-ribbon-active {
  background: #FF6B00;
  color: #fff;
  font-weight: 700;
}

/* ── Filter Bar ──────────────────────────────────────────── */
.pr321-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #fafafa;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

.pr321-filter-status {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  color: #1A1A2E;
  background: #fff;
  min-width: 140px;
}

.pr321-filter-search {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  color: #1A1A2E;
  background: #fff;
  flex: 1;
  min-width: 160px;
}

.pr321-filter-search:focus,
.pr321-filter-status:focus {
  outline: none;
  border-color: #FF6B00;
  box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.15);
}

/* ── Buttons ─────────────────────────────────────────────── */
.pr321-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.pr321-btn-download {
  background: #FF6B00;
  color: #fff;
}

.pr321-btn-download:hover {
  background: #e05e00;
}

.pr321-btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.pr321-btn-secondary:hover {
  background: #e5e7eb;
}

/* ── Table Wrapper ───────────────────────────────────────── */
.pr321-table-wrap {
  width: 100%;
  overflow-x: auto;
  padding: 0;
}

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

.pr321-table thead tr {
  background: #1A1A2E;
  color: #fff;
}

.pr321-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: #fff;
}

.pr321-table tbody tr {
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  transition: background 0.1s;
}

.pr321-table tbody tr:hover {
  background: #f9fafb;
}

.pr321-table td {
  padding: 9px 12px;
  color: #374151;
  white-space: nowrap;
}

.pr321-col-name {
  font-weight: 500;
  color: #1A1A2E;
  max-width: 180px;
  white-space: normal;
}

/* ── Row States ──────────────────────────────────────────── */
.pr321-row-overbilled {
  background: #fff5f5 !important;
}

.pr321-row-overbilled:hover {
  background: #ffe8e8 !important;
}

/* ── Over/Under Colors ───────────────────────────────────── */
.pr321-ou-positive {
  color: #16A34A;
  font-weight: 600;
}

.pr321-ou-negative {
  color: #CC0000;
  font-weight: 600;
}

/* ── Margin Colors ───────────────────────────────────────── */
.pr321-margin-green {
  color: #16A34A;
  font-weight: 600;
}

.pr321-margin-amber {
  color: #D97706;
  font-weight: 600;
}

.pr321-margin-red {
  color: #CC0000;
  font-weight: 600;
}

/* ── Footer / Summary Row ────────────────────────────────── */
.pr321-footer-row {
  background: #f1f5f9 !important;
  border-top: 2px solid #1A1A2E;
  font-weight: 600;
}

.pr321-footer-row td {
  padding: 10px 12px;
  font-weight: 700;
  color: #1A1A2E;
}

/* ── Status Badge ────────────────────────────────────────── */
.pr321-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.03em;
}

.pr321-status-active {
  background: #dcfce7;
  color: #16A34A;
}

.pr321-status-complete {
  background: #e0e7ff;
  color: #3730a3;
}

.pr321-status-on_hold {
  background: #fef9c3;
  color: #854d0e;
}

/* ── Lily Bar ────────────────────────────────────────────── */
.pr321-lily-bar {
  margin: 16px;
  padding: 12px 16px;
  background: #f5f0ff;
  border-left: 4px solid #7C3AED;
  border-radius: 0 6px 6px 0;
}

.pr321-lily-bar .pr321-lily-subtitle {
  font-size: 12px;
  font-weight: 700;
  color: #7C3AED;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.pr321-lily-insight {
  font-size: 13px;
  color: #4B5563;
  margin-bottom: 4px;
  line-height: 1.5;
}

.pr321-lily-insight:last-child {
  margin-bottom: 0;
}

/* ── Detail Panel ────────────────────────────────────────── */
.pr321-detail-panel {
  margin: 16px;
  padding: 20px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.pr321-detail-header {
  font-size: 16px;
  font-weight: 700;
  color: #1A1A2E;
  margin-bottom: 16px;
  border-bottom: 2px solid #FF6B00;
  padding-bottom: 8px;
}

/* ── Bar Chart ───────────────────────────────────────────── */
.pr321-detail-chart {
  margin-bottom: 16px;
}

.pr321-chart-label {
  font-size: 12px;
  font-weight: 700;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.pr321-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.pr321-bar-lbl {
  font-size: 12px;
  color: #6B7280;
  min-width: 55px;
}

.pr321-bar-track {
  flex: 1;
  height: 14px;
  background: #f1f5f9;
  border-radius: 7px;
  overflow: hidden;
}

.pr321-bar {
  height: 100%;
  border-radius: 7px;
  min-width: 2px;
}

.pr321-bar-earned {
  background: #16A34A;
}

.pr321-bar-billed {
  background: #2563EB;
}

.pr321-bar-cost {
  background: #D97706;
}

.pr321-bar-val {
  font-size: 12px;
  color: #374151;
  font-weight: 600;
  min-width: 80px;
  text-align: right;
}

/* ── Detail Fields ───────────────────────────────────────── */
.pr321-detail-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 16px;
  margin-bottom: 16px;
}

.pr321-field-row {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  background: #f9fafb;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.pr321-field-row span {
  font-size: 11px;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}

.pr321-field-row strong {
  font-size: 15px;
  color: #1A1A2E;
}

.pr321-detail-over-under strong {
  font-size: 15px;
}

/* ── Period History / Snapshots ──────────────────────────── */
.pr321-period-history {
  margin-top: 16px;
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
}

.pr321-period-history-title {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pr321-snapshot-section {
  margin: 16px;
  padding: 14px 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.pr321-snapshot-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 8px;
}

.pr321-snapshot-row {
  font-size: 13px;
  color: #4B5563;
  margin-bottom: 4px;
  line-height: 1.5;
}

.pr321-snapshot-item {
  font-size: 13px;
  color: #4B5563;
  margin-bottom: 4px;
  line-height: 1.5;
}

.pr321-snapshot-badge {
  display: inline-block;
  background: #e5e7eb;
  color: #374151;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-right: 4px;
}

/* ── Confirm Panel (two-tap) ─────────────────────────────── */
.pr321-confirm-pending {
  display: inline-block;
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  color: #92400E;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* ── Summary Stats Row ───────────────────────────────────── */
.pr321-stats-row {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

.pr321-stat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 14px;
  min-width: 100px;
}

.pr321-stat-label {
  font-size: 11px;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pr321-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #1A1A2E;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 767px) {
  .pr321-page-header {
    padding: 14px 12px 8px;
  }

  .pr321-page-title {
    font-size: 18px;
  }

  .pr321-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .pr321-filter-status,
  .pr321-filter-search {
    width: 100%;
  }

  .pr321-table {
    font-size: 12px;
  }

  .pr321-detail-fields {
    grid-template-columns: 1fr 1fr;
  }

  .pr321-lily-bar {
    margin: 8px;
  }

  .pr321-stats-row {
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .pr321-detail-fields {
    grid-template-columns: 1fr;
  }

  .pr321-table thead th,
  .pr321-table td {
    padding: 6px 8px;
  }
}
