/* ============================================================
   PR322 T&M Billing Engine — Styles
   Class prefix: .pr322-
   TradeRail brand: #FF6B00, #1A1A2E
   ============================================================ */

/* ── Module wrapper ──────────────────────────────────────────────────────────── */
.pr322-module {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: #1A1A2E;
  background: #fff;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* ── Page header ──────────────────────────────────────────────────────────────── */
.pr322-header {
  padding: 16px 20px 0 20px;
  border-bottom: 1px solid #E5E7EB;
  background: #fff;
  border-radius: 8px 8px 0 0;
}

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

.pr322-page-title strong {
  font-weight: 800;
}

/* ── Orange tab ribbon ──────────────────────────────────────────────────────── */
.pr322-tab-ribbon {
  display: flex;
  gap: 0;
  border-bottom: none;
  margin-bottom: 0;
}

.pr322-tab-ribbon-item {
  display: inline-block;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #6B7280;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
}

.pr322-tab-active {
  background: #FF6B00;
  color: #fff;
  border-color: #FF6B00;
}

/* ── Lily insight bar ─────────────────────────────────────────────────────────── */
.pr322-lily-subtitle {
  margin: 8px 0;
}

.pr322-lily-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f5f0ff;
  border-left: 4px solid #7C3AED;
  border-radius: 4px;
  padding: 8px 14px;
  margin: 8px 0;
}

.pr322-lily-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #7C3AED;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.pr322-lily-text {
  font-size: 13px;
  color: #374151;
}

/* ── Ceiling tracker ─────────────────────────────────────────────────────────── */
.pr322-ceiling-tracker {
  padding: 10px 20px;
  background: #FFF7ED;
  border-bottom: 1px solid #FED7AA;
}

.pr322-ceiling-label {
  font-size: 13px;
  font-weight: 600;
  color: #92400E;
  margin-bottom: 6px;
}

.pr322-ceiling-bar-track {
  height: 10px;
  background: #E5E7EB;
  border-radius: 5px;
  overflow: hidden;
}

.pr322-ceiling-bar-fill {
  height: 100%;
  background: #FF6B00;
  border-radius: 5px;
  transition: width 0.3s;
}

.pr322-ceiling-bar-fill-warn {
  background: #F59E0B;
}

.pr322-ceiling-bar-fill-danger {
  background: #DC2626;
}

/* ── Summary strip ───────────────────────────────────────────────────────────── */
.pr322-summary-strip {
  display: flex;
  gap: 16px;
  padding: 12px 20px;
  background: #F9FAFB;
  border-bottom: 1px solid #E5E7EB;
  flex-wrap: wrap;
}

.pr322-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
}

.pr322-summary-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6B7280;
  font-weight: 600;
}

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

/* ── List header / toolbar ───────────────────────────────────────────────────── */
.pr322-list-container {
  padding: 0;
}

.pr322-list-header {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  align-items: center;
  border-bottom: 1px solid #E5E7EB;
}

/* ── Filter bar ──────────────────────────────────────────────────────────────── */
.pr322-filter-bar {
  display: flex;
  gap: 10px;
  padding: 10px 20px;
  background: #F9FAFB;
  border-bottom: 1px solid #E5E7EB;
  align-items: center;
  flex-wrap: wrap;
}

.pr322-filters {
  display: flex;
  gap: 10px;
  align-items: center;
}

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

.pr322-btn-primary {
  background: #FF6B00;
  color: #fff;
  border-color: #FF6B00;
}

.pr322-btn-primary:hover {
  background: #E55A00;
  border-color: #E55A00;
}

.pr322-btn-outline {
  background: transparent;
  color: #374151;
  border-color: #D1D5DB;
}

.pr322-btn-outline:hover {
  background: #F3F4F6;
}

.pr322-btn-success {
  background: #16A34A;
  color: #fff;
  border-color: #16A34A;
}

.pr322-btn-success:hover {
  background: #15803D;
}

.pr322-btn-danger {
  background: #DC2626;
  color: #fff;
  border-color: #DC2626;
}

.pr322-btn-danger:hover {
  background: #B91C1C;
}

.pr322-btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ── Inputs / selects ────────────────────────────────────────────────────────── */
.pr322-input {
  padding: 6px 10px;
  border: 1px solid #D1D5DB;
  border-radius: 5px;
  font-size: 13px;
  color: #1A1A2E;
  background: #fff;
  outline: none;
}

.pr322-input:focus {
  border-color: #FF6B00;
  box-shadow: 0 0 0 2px rgba(255,107,0,0.12);
}

.pr322-select {
  padding: 6px 10px;
  border: 1px solid #D1D5DB;
  border-radius: 5px;
  font-size: 13px;
  color: #1A1A2E;
  background: #fff;
  cursor: pointer;
}

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.pr322-table-wrap {
  overflow-x: auto;
  padding: 0 20px;
}

.pr322-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pr322-table thead tr {
  background: #F3F4F6;
}

.pr322-table th {
  text-align: left;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6B7280;
  border-bottom: 2px solid #E5E7EB;
  white-space: nowrap;
}

.pr322-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #F3F4F6;
  color: #1A1A2E;
  vertical-align: middle;
}

.pr322-invoice-row:hover td {
  background: #FFF7ED;
}

.pr322-empty {
  text-align: center;
  color: #9CA3AF;
  padding: 20px;
  font-style: italic;
}

/* ── Status badges ───────────────────────────────────────────────────────────── */
.pr322-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: #fff;
}

.pr322-badge-draft {
  background: #6B7280;
}

.pr322-badge-submitted {
  background: #2563EB;
}

.pr322-badge-approved {
  background: #16A34A;
}

.pr322-badge-invoiced {
  background: #7C3AED;
}

.pr322-badge-paid {
  background: #374151;
}

.pr322-badge-voided {
  background: #9CA3AF;
}

/* ── Rate type badges ────────────────────────────────────────────────────────── */
.pr322-rate-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pr322-rate-st {
  background: #DCFCE7;
  color: #166534;
}

.pr322-rate-ot {
  background: #FEF3C7;
  color: #92400E;
}

.pr322-rate-dt {
  background: #FEE2E2;
  color: #991B1B;
}

/* ── Detail panel ────────────────────────────────────────────────────────────── */
.pr322-detail-panel {
  padding: 16px 20px;
}

.pr322-detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #E5E7EB;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pr322-detail-title {
  font-size: 18px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0;
}

.pr322-detail-period {
  font-size: 13px;
  color: #6B7280;
}

/* ── Lines sections ──────────────────────────────────────────────────────────── */
.pr322-lines-section {
  margin-bottom: 18px;
}

.pr322-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0 0 8px 0;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #374151;
}

/* ── Totals section ──────────────────────────────────────────────────────────── */
.pr322-totals-section {
  background: #F9FAFB;
  border-radius: 6px;
  padding: 14px 20px;
  margin-bottom: 18px;
  max-width: 360px;
  margin-left: auto;
}

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

.pr322-grand-total {
  border-top: 2px solid #E5E7EB;
  margin-top: 6px;
  padding-top: 8px;
  font-weight: 700;
  font-size: 15px;
  color: #1A1A2E;
}

/* ── Notes section ───────────────────────────────────────────────────────────── */
.pr322-notes-section {
  margin-bottom: 18px;
}

.pr322-notes-text {
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 5px;
  padding: 10px 14px;
  font-size: 13px;
  color: #374151;
  min-height: 40px;
}

/* ── Rate schedule section ───────────────────────────────────────────────────── */
.pr322-rate-section {
  margin-bottom: 18px;
}

.pr322-rate-table {
  margin-bottom: 8px;
}

.pr322-rate-markups {
  display: flex;
  gap: 18px;
  font-size: 13px;
  color: #6B7280;
  padding: 4px 0;
}

/* ── Detail actions ──────────────────────────────────────────────────────────── */
.pr322-detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid #E5E7EB;
  align-items: center;
}

/* ── Two-tap confirm panels ──────────────────────────────────────────────────── */
.pr322-confirm-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  border-radius: 6px;
  padding: 8px 14px;
  flex-wrap: wrap;
}

.pr322-confirm-panel span {
  font-size: 13px;
  font-weight: 600;
  color: #92400E;
}

/* ── Wizard panel ────────────────────────────────────────────────────────────── */
.pr322-wizard-panel {
  padding: 20px;
}

.pr322-wizard-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #E5E7EB;
}

.pr322-wizard-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0;
}

.pr322-wizard-form {
  max-width: 480px;
}

.pr322-form-row {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.pr322-wizard-actions {
  display: flex;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid #E5E7EB;
  flex-wrap: wrap;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .pr322-summary-strip {
    gap: 10px;
  }
  .pr322-summary-item {
    min-width: 80px;
  }
  .pr322-detail-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .pr322-totals-section {
    max-width: 100%;
    margin-left: 0;
  }
}
