/* =============================================================
   TradeRail — PR234: Rates & Assignments
   Namespace : .ra-*
   Brand     : #FF6B00 primary, #1A1A2E dark
   ============================================================= */

/* ── Module shell ───────────────────────────────────────────── */
.ra-module {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1A1A2E;
  background: #f5f6f8;
  min-height: 100%;
  padding-bottom: 40px;
}

/* ── Header ─────────────────────────────────────────────────── */
.ra-module-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 20px 28px 0;
}

.ra-module-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0 0 4px;
}

.ra-module-sub {
  font-size: 13px;
  color: #9ca3af;
  margin: 0 0 14px;
}

/* ── Burden notice ──────────────────────────────────────────── */
.ra-burden-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
}

.ra-burden-notice-icon {
  flex-shrink: 0;
  font-size: 13px;
  margin-top: 1px;
  color: #d97706;
}

/* ── Tab bar ────────────────────────────────────────────────── */
.ra-tab-bar {
  display: flex;
  gap: 0;
  padding: 0;
  margin: 0 -28px;
  padding: 0 28px;
  border-top: 1px solid #f3f4f6;
}

.ra-tab {
  display: inline-flex;
  align-items: center;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.14s, border-color 0.14s;
  white-space: nowrap;
  outline: none;
  font-family: inherit;
}

.ra-tab:hover {
  color: #FF6B00;
}

.ra-tab.ra-tab-active {
  color: #FF6B00;
  border-bottom-color: #FF6B00;
  font-weight: 600;
}

/* ── Tab content area ───────────────────────────────────────── */
.ra-tab-content {
  padding: 20px 28px;
}

/* ── Lily banner ────────────────────────────────────────────── */
.ra-lily-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff3e8;
  border: 1px solid #ffb366;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: #92400e;
  font-weight: 500;
  margin-bottom: 14px;
}

.ra-lily-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FF6B00;
  flex-shrink: 0;
}

/* ── Filter bar ─────────────────────────────────────────────── */
.ra-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.ra-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 32px 7px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.14s, box-shadow 0.14s;
  min-width: 130px;
}

.ra-select:focus {
  border-color: #FF6B00;
  box-shadow: 0 0 0 3px rgba(255,107,0,0.1);
}

/* ── Buttons ────────────────────────────────────────────────── */
.ra-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: background 0.14s, opacity 0.14s, box-shadow 0.14s;
  white-space: nowrap;
  outline: none;
  line-height: 1.4;
}

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

.ra-btn-primary:hover {
  background: #e55f00;
  box-shadow: 0 2px 8px rgba(255,107,0,0.25);
}

.ra-btn-ghost {
  background: transparent;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.ra-btn-ghost:hover {
  background: #f9fafb;
  color: #374151;
}

.ra-btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.ra-btn-pin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: #fff3e8;
  color: #FF6B00;
  border: 1px solid #ffb366;
  font-family: inherit;
  transition: background 0.12s;
  outline: none;
}

.ra-btn-pin:hover {
  background: #ffe0c2;
}

.ra-btn-pin-sm {
  padding: 3px 8px;
  font-size: 11px;
}

.ra-ml { margin-left: 8px; }
.ra-ml-auto { margin-left: auto; }

/* ── Assignment cards list ──────────────────────────────────── */
.ra-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ra-card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: box-shadow 0.15s;
}

.ra-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}

.ra-card-open {
  box-shadow: 0 4px 20px rgba(0,0,0,0.09);
  border-color: #d1d5db;
}

.ra-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}

.ra-card-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ra-worker-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1A1A2E;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ra-card-meta {
  display: block;
  font-size: 12px;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ra-card-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 16px;
}

.ra-card-total {
  font-size: 14px;
  font-weight: 700;
  color: #1A1A2E;
  font-variant-numeric: tabular-nums;
  min-width: 72px;
  text-align: right;
}

.ra-chevron {
  font-size: 10px;
  color: #d1d5db;
  margin-left: 2px;
}

/* ── Card expanded body ─────────────────────────────────────── */
.ra-card-section {
  padding: 14px 18px;
  border-top: 1px solid #f3f4f6;
}

.ra-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #9ca3af;
  margin-bottom: 10px;
}

.ra-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

/* Rate grid inside expanded card */
.ra-rate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.ra-rate-item {
  background: #f9fafb;
  border: 1px solid #f3f4f6;
  border-radius: 7px;
  padding: 9px 12px;
}

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

.ra-rate-value {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #1A1A2E;
}

.ra-pin-gated {
  color: #9ca3af;
  font-size: 13px;
}

/* Card actions row */
.ra-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid #f3f4f6;
  background: #fafafa;
}

/* Totals */
.ra-totals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  color: #6b7280;
}

.ra-totals-grand {
  font-size: 14px;
  font-weight: 700;
  color: #1A1A2E;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
  margin-top: 4px;
}

.ra-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #1A1A2E;
}

.ra-muted {
  color: #9ca3af;
  font-size: 12px;
}

/* ── Badges ─────────────────────────────────────────────────── */
.ra-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.ra-badge-progress {
  background: #eff6ff;
  color: #2563eb;
}

.ra-badge-review {
  background: #fffbeb;
  color: #b45309;
}

.ra-badge-ready {
  background: #f0fdf4;
  color: #16a34a;
}

.ra-badge-ar {
  background: #f5f3ff;
  color: #7c3aed;
}

.ra-badge-nonbillable {
  background: #fef2f2;
  color: #dc2626;
}

/* Lily flagged inline text */
.ra-lily-flag {
  font-size: 12px;
  font-weight: 600;
  color: #FF6B00;
  background: #fff3e8;
  border: 1px solid #ffb366;
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
}

/* Non-billable info block */
.ra-nonbillable-block {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 8px;
}

.ra-nonbillable-note {
  font-size: 12px;
  color: #dc2626;
  margin: 0;
}

/* ── Rates table ────────────────────────────────────────────── */
.ra-table-wrap {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  margin-top: 16px;
}

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

.ra-table thead th {
  background: #f9fafb;
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.ra-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
}

.ra-table tbody tr:last-child {
  border-bottom: none;
}

.ra-table tbody tr:hover {
  background: #fafafa;
}

.ra-table td {
  padding: 11px 14px;
  color: #374151;
  vertical-align: middle;
}

.ra-table td:first-child {
  font-weight: 600;
  color: #1A1A2E;
}

/* ── Apprentice ratio box ───────────────────────────────────── */
.ra-ratio-box {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px 18px;
  margin-top: 20px;
}

.ra-ratio-label {
  font-size: 13px;
  font-weight: 700;
  color: #1A1A2E;
  margin-bottom: 12px;
}

.ra-ratio-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.ra-ratio-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ra-ratio-count {
  font-size: 22px;
  font-weight: 800;
  color: #1A1A2E;
  line-height: 1;
}

.ra-ratio-apprentice {
  color: #FF6B00;
}

.ra-ratio-note {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 10px;
}

/* ── PIN modal ──────────────────────────────────────────────── */
.ra-pin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.5);
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ra-pin-modal {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px 20px;
  width: 300px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
  text-align: center;
}

.ra-pin-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0 0 4px;
}

.ra-pin-modal-sub {
  font-size: 12px;
  color: #9ca3af;
  margin: 0 0 18px;
}

.ra-pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 20px;
}

.ra-pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  background: transparent;
  transition: background 0.12s, border-color 0.12s;
}

.ra-pin-dot-filled {
  background: #FF6B00;
  border-color: #FF6B00;
}

.ra-pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.ra-pin-key {
  padding: 13px 0;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  font-size: 18px;
  font-weight: 600;
  color: #1A1A2E;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, border-color 0.1s;
  outline: none;
}

.ra-pin-key:hover {
  background: #fff3e8;
  border-color: #FF6B00;
  color: #FF6B00;
}

.ra-pin-key:active {
  background: #ffe0c2;
}

.ra-pin-key-del {
  font-size: 16px;
  color: #9ca3af;
}

.ra-pin-key-del:hover {
  color: #dc2626;
  border-color: #fca5a5;
  background: #fef2f2;
}

.ra-pin-error {
  font-size: 12px;
  color: #dc2626;
  min-height: 18px;
  margin-bottom: 4px;
}

.ra-pin-lockout {
  font-size: 12px;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 7px 10px;
  margin-bottom: 8px;
}

/* ── Helper / empty state ───────────────────────────────────── */
.ra-empty {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
}

.ra-empty-sm {
  font-size: 13px;
  color: #9ca3af;
  padding: 16px 0;
  text-align: center;
}

.ra-helper {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 14px;
}

.ra-no-access {
  text-align: center;
  padding: 48px 24px;
  color: #9ca3af;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 767px) {
  .ra-module-header,
  .ra-tab-content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .ra-tab-bar {
    margin: 0 -16px;
    padding: 0 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ra-tab {
    padding: 10px 14px;
    font-size: 13px;
  }

  .ra-card-header {
    padding: 12px 14px;
  }

  .ra-rate-grid {
    grid-template-columns: 1fr 1fr;
  }
}
