/* ===========================================================
   THEME VARIABLES
   =========================================================== */
:root {
  /* Dark theme defaults */
  --bg: #050814;
  --bg-alt: #0b1020;
  --card-bg: #151a30;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --text: #f9fafb;
  --text-muted: #9ca3af;
  --danger: #f97373;
  --border: #1f2937;
  --header-bg: #020617;
  --row-even-bg: rgba(15, 23, 42, 0.6);
  --row-hover-bg: rgba(37, 99, 235, 0.12);
}

/* Light theme overrides */
body.light {
  --bg: #f3f4f6;
  --bg-alt: #e5e7eb;
  --card-bg: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --danger: #b91c1c;
  --header-bg: #e5e7eb;
  --row-even-bg: rgba(243, 244, 246, 0.9);
  --row-hover-bg: rgba(59, 130, 246, 0.12);
}

/* ===========================================================
   BASE ELEMENTS
   =========================================================== */
* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, var(--bg-alt) 0, var(--bg) 55%);
  color: var(--text);
  transition: background 0.25s ease, color 0.25s ease;
}

/* Clean inline link for Job Number */
.job-link {
  color: inherit;            /* Match surrounding text colour */
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

/* Subtle hover */
.job-link:hover {
  color: var(--accent);      /* Soft highlight on hover */
  text-decoration: none;
}

/* Keyboard focus outline */
.job-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ===========================================================
   LAYOUT
   =========================================================== */

/* Sticky first column (Job Number) */
.table-wrapper {
  position: relative;
}

th.sticky-col,
td.sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--card-bg);
}

/* Make header sit above body cells */
thead th.sticky-col {
  z-index: 4;
  box-shadow: 4px 0 8px rgba(15, 23, 42, 0.45);
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.title-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.title-logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  height: 32px;
  width: 32px;
  border-radius: 10px;
}

h1 {
  margin: 0;
  font-size: 1.6rem;
}

.title-block p {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ===========================================================
   BUTTONS
   =========================================================== */
.btn {
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.1s ease, color 0.1s ease;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.12), 0 18px 35px rgba(15, 23, 42, 0.7);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.3), 0 22px 40px rgba(15, 23, 42, 0.9);
  background: #2563eb;
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.3), 0 8px 18px rgba(15, 23, 42, 0.7);
}

.theme-toggle {
  background: transparent;
  color: var(--text-muted);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.4);
  padding-inline: 10px;
}

.theme-toggle:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.btn.btn-secondary {
  background: transparent;
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.5);
}

.btn.btn-secondary:hover {
  background: var(--accent-soft);
  color: var(--text);
}

/* ===========================================================
   SUMMARY PILLS
   =========================================================== */
.summary-row {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

body.light .pill {
  background: rgba(249, 250, 251, 0.95);
}

.pill strong {
  color: var(--text);
  font-weight: 600;
}

/* ===========================================================
   TABLE
   =========================================================== */
.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.95);
  max-height: 70vh;
}

body.light .table-wrapper {
  background: rgba(249, 250, 251, 0.98);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  font-size: 0.82rem;
}

thead {
  position: sticky;
  top: 0;
  background: var(--header-bg);
  z-index: 1;
}

th,
td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid #111827;
  white-space: nowrap;
}

body.light th,
body.light td {
  border-bottom-color: #e5e7eb;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  font-weight: 600;
  color: var(--text-muted);
}

tbody tr:nth-child(even) {
  background: var(--row-even-bg);
}

tbody tr:hover {
  background: var(--row-hover-bg);
}

.number {
  font-variant-numeric: tabular-nums;
}

.negative {
  color: var(--danger);
}

/* ===========================================================
   FOOTER
   =========================================================== */
.footer {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.9;
}

.footer-logo {
  height: 18px;
  width: auto;
}

/* ===========================================================
   TOOLTIP
   =========================================================== */
.tooltip {
  position: fixed;
  background: var(--card-bg);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  max-width: 260px;
  z-index: 9999;
}

/* ===========================================================
   MODAL
   =========================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  z-index: 9000;
}

.modal-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  width: 90%;
  max-width: 700px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  color: var(--text);
  max-height: 80vh;
  overflow-y: auto;
}

.modal-close {
  float: right;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.modal-close:hover {
  color: var(--text);
}

/* ===========================================================
   RESPONSIVE
   =========================================================== */
@media (max-width: 640px) {
  .page {
    padding: 16px 10px 32px;
  }
  h1 {
    font-size: 1.25rem;
  }
}
