/* ── Page layout (full width) ─────────────────────────────────────────────── */

.rl-page {
  padding: 12px 12px 48px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rl-loading,
.rl-empty,
.rl-error {
  color: rgba(255,255,255,0.85);
  text-align: center;
  padding: 48px 16px;
  font-size: 0.95rem;
}

.rl-error { color: #fca5a5; }

/* ── Header extras ────────────────────────────────────────────────────────── */

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

/* ── Filters bar ──────────────────────────────────────────────────────────── */

.rl-filters {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rl-search {
  flex: 1;
  min-width: 160px;
  font-family: inherit;
  font-size: 0.875rem;
  border: none;
  border-radius: 8px;
  padding: 7px 11px;
  background: rgba(255,255,255,0.92);
  color: #1f2937;
  outline: none;
}
.rl-search:focus { background: #fff; }

.rl-select {
  font-family: inherit;
  font-size: 0.82rem;
  border: none;
  border-radius: 8px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.92);
  color: #1f2937;
  outline: none;
  cursor: pointer;
}
.rl-select:focus { background: #fff; }

.rl-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.rl-refresh-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.rl-refresh-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 7px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.rl-refresh-btn:hover:not(:disabled) { background: rgba(255,255,255,0.3); }
.rl-refresh-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.rl-last-updated {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.65);
  white-space: nowrap;
}

/* ── Job card ─────────────────────────────────────────────────────────────── */

.rl-job-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  overflow: hidden;
}

.rl-job-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #f9fafb;
  border-bottom: 1px solid #f3f4f6;
}

.rl-job-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.rl-job-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #111827;
  word-break: break-word;
}
.rl-job-title:hover { color: #667eea; }

.rl-title-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rl-tracker-link {
  font-size: 0.72rem;
  font-weight: 500;
  color: #667eea;
  text-decoration: none;
}
.rl-tracker-link:hover { color: #4f46e5; text-decoration: underline; }

.rl-job-badges { display: flex; gap: 4px; flex-wrap: wrap; }

.rl-badge {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
}
.badge-rush { background: #fee2e2; color: #b91c1c; }
.badge-firm { background: #ede9fe; color: #6d28d9; }

.rl-due {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Order section ────────────────────────────────────────────────────────── */

.rl-order-section { border-top: 1px solid #f3f4f6; }

.rl-order-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: #fafafa;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
}

.rl-collapse-btn {
  font-family: inherit;
  font-size: 0.65rem;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
  line-height: 1;
}
.rl-collapse-btn:hover { color: #4b5563; }

.rl-order-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.rl-order-id {
  font-size: 0.82rem;
  font-weight: 700;
  color: #374151;
  white-space: nowrap;
}

.rl-order-customer {
  font-size: 0.78rem;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rl-order-dues {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.rl-order-due {
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Due date color coding */
.due-overdue { color: #dc2626; }
.due-today   { color: #d97706; }
.due-soon    { color: #ca8a04; }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */

.rl-tabs {
  display: flex;
  align-items: flex-end;
  border-bottom: 2px solid #d1d5db;
  background: #f3f4f6;
  padding: 6px 10px 0;
  gap: 3px;
}

.rl-tab {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7280;
  background: #e5e7eb;
  border: 1.5px solid #d1d5db;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 6px 16px;
  cursor: pointer;
  transition: color 0.1s, background 0.1s;
}
.rl-tab:hover:not(.active) { background: #ede9f9; color: #374151; }
.rl-tab.active {
  color: #374151;
  font-weight: 700;
  background: #fff;
  border-color: #d1d5db;
  position: relative;
  margin-bottom: -2px;
  padding-bottom: 8px;
  z-index: 1;
}

/* ── Group block ──────────────────────────────────────────────────────────── */

.rl-group-wrap { overflow-x: auto; }

.rl-subtask-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  background: #f9fafb;
  border-bottom: 1px solid #f3f4f6;
  flex-wrap: wrap;
}

.rl-subtask-status {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 8px;
}

.pill-pending     { background: #f3f4f6; color: #9ca3af; }
.pill-in_progress { background: #fef3c7; color: #92400e; }
.pill-complete    { background: #d1fae5; color: #065f46; }
.pill-skipped     { background: #f9fafb; color: #d1d5db; }

.rl-mark-all-btn {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  background: #e0e7ff;
  color: #3730a3;
  border: none;
  border-radius: 5px;
  padding: 3px 9px;
  cursor: pointer;
}
.rl-mark-all-btn:hover { background: #c7d2fe; }


/* ── Table ────────────────────────────────────────────────────────────────── */

.rl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.rl-table thead th {
  text-align: left;
  padding: 5px 8px;
  font-size: 0.67rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9ca3af;
  background: #fafafa;
  border-bottom: 1px solid #f3f4f6;
  white-space: nowrap;
}

.rl-table tbody tr { border-bottom: 1px solid #f9fafb; }
.rl-table tbody tr:last-child { border-bottom: none; }

.rl-table td {
  padding: 6px 8px;
  color: #374151;
  vertical-align: middle;
}

.rl-row-done td { opacity: 0.4; }
.rl-row-done .rl-td-done,
.rl-row-done .rl-td-notes { opacity: 1; }

.rl-th-done,
.rl-td-done  { text-align: center; width: 36px; }
.rl-th-pos,
.rl-td-pos   { text-align: center; width: 28px; color: #9ca3af; font-size: 0.72rem; }
.rl-td-name  { font-weight: 500; }
.rl-td-sku   { font-family: 'SF Mono', 'Fira Mono', monospace; font-size: 0.72rem; color: #6b7280; }
.rl-th-qty,
.rl-td-qty   { text-align: center; width: 36px; }
.rl-td-mat   { white-space: nowrap; }
.rl-td-mach  { white-space: nowrap; }
.rl-td-notes { min-width: 130px; }

/* Machine assignment dropdown */
.rl-machine-sel {
  font-family: inherit;
  font-size: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  padding: 2px 4px;
  color: #374151;
  background: #fff;
  cursor: pointer;
  max-width: 110px;
}
.rl-machine-sel:focus { outline: none; border-color: #667eea; }

/* Notes textarea */
.rl-notes-input {
  font-family: inherit;
  font-size: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  padding: 3px 6px;
  width: 100%;
  color: #374151;
  background: #fff;
  min-width: 100px;
  min-height: 44px;
  resize: vertical;
}
.rl-notes-input:focus { outline: none; border-color: #667eea; }

/* ── Responsive: hide columns on mobile ───────────────────────────────────── */

@media (max-width: 639px) {
  .rl-hide-mobile { display: none; }
}

/* ── P1 Tooltip ───────────────────────────────────────────────────────────── */

.p1-icon {
  font-family: inherit;
  font-size: 0.72rem;
  background: none;
  border: none;
  color: #667eea;
  cursor: pointer;
  padding: 0 0 0 3px;
  vertical-align: middle;
  line-height: 1;
}
.p1-icon:hover { color: #4f46e5; }

.p1-tooltip {
  position: absolute;
  z-index: 500;
  background: #1f2937;
  color: #f3f4f6;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.78rem;
  max-width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  pointer-events: none;
}

.p1-table { border-collapse: collapse; width: 100%; }
.p1-table th {
  text-align: left;
  color: #9ca3af;
  font-weight: 500;
  padding: 2px 8px 2px 0;
  white-space: nowrap;
  vertical-align: top;
}
.p1-table td { color: #f9fafb; padding: 2px 0; word-break: break-word; }

/* ── Desktop spacing ──────────────────────────────────────────────────────── */

@media (min-width: 640px) {
  .rl-page { padding: 14px 16px 56px; }
  .rl-filters { padding: 10px 16px; }
  .rl-table { font-size: 0.82rem; }
  .rl-notes-input { min-width: 140px; min-height: 44px; }
}
