body {
  background:
    radial-gradient(ellipse at 25% 45%, rgba(30,77,140,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 72% 72%, rgba(45,27,105,0.14) 0%, transparent 50%),
    radial-gradient(ellipse at 82% 18%, rgba(26,82,118,0.12) 0%, transparent 45%),
    radial-gradient(ellipse at 12% 78%, rgba(30,60,120,0.10) 0%, transparent 42%),
    linear-gradient(150deg, #0f2044 0%, #1a3a6b 100%);
}

main { position: relative; z-index: 1; padding: 2rem; max-width: 1200px; margin: 0 auto; }

/* ── Charts ── */
.charts-row {
  display: grid; grid-template-columns: 2fr 1fr;
  gap: 1.25rem; margin-bottom: 2rem; align-items: stretch;
}
.chart-card {
  background: rgba(10,25,60,0.68); backdrop-filter: blur(8px);
  border: 1px solid rgba(0,170,255,0.2); border-radius: 14px;
  padding: 1.25rem 1.5rem 1rem; display: flex; flex-direction: column;
}
.chart-card h3 {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: #00aaff; margin-bottom: 0.9rem; flex-shrink: 0;
}
.chart-wrap { position: relative; flex: 1; min-height: 160px; }

/* ── Toolbar ── */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.6rem;
}
#run-count {
  font-size: 0.72rem; font-weight: 700;
  color: #a8d8f0; text-transform: uppercase; letter-spacing: 0.08em;
}
.btn-action {
  background: rgba(0,170,255,0.12); border: 1px solid rgba(0,170,255,0.35);
  border-radius: 8px; color: #a8d8f0; cursor: pointer; font-size: 0.8rem;
  padding: 0.35rem 0.85rem; transition: background 0.15s, border-color 0.15s, color 0.15s;
  display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap;
}
.btn-action:hover { background: rgba(0,170,255,0.22); border-color: rgba(0,170,255,0.6); color: #ffffff; }
.btn-action.btn-danger { border-color: rgba(255,100,100,0.3); color: #c07070; }
.btn-action.btn-danger:hover { background: rgba(255,60,60,0.12); border-color: rgba(255,100,100,0.55); color: #ff9090; }

/* ── Floating selection toolbar ── */
#float-toolbar {
  position: fixed; bottom: 0; left: 50%;
  transform: translateX(-50%) translateY(110%);
  background: rgba(7,18,50,0.94); backdrop-filter: blur(16px);
  border: 1px solid rgba(0,170,255,0.28); border-bottom: none;
  border-radius: 14px 14px 0 0;
  padding: 0.8rem 1.5rem;
  display: flex; align-items: center; gap: 0.7rem;
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
  z-index: 50; box-shadow: 0 -6px 28px rgba(0,120,255,0.12);
}
#float-toolbar.visible { transform: translateX(-50%) translateY(0); }
#float-count {
  color: #a8d8f0; font-size: 0.82rem; font-weight: 600;
  padding-right: 0.5rem; border-right: 1px solid rgba(0,170,255,0.2);
  margin-right: 0.2rem;
}

/* ── Table ── */
.table-card {
  background: rgba(10,25,60,0.68); backdrop-filter: blur(8px);
  border: 1px solid rgba(0,170,255,0.2); border-radius: 14px; overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }

thead th {
  background: linear-gradient(180deg, #0a2a5e 0%, #0d3875 100%);
  border-bottom: 2px solid #00aaff;
  color: #00ffff; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em;
  padding: 0.8rem 1rem; text-align: left; text-transform: uppercase;
  user-select: none; -webkit-user-select: none; cursor: default;
}
thead th.col-check { width: 2.75rem; padding: 0.8rem 0.5rem; text-align: center; }
thead th.col-actions { width: 2.75rem; text-align: center; }
thead th.col-type { width: 5.5rem; }
thead th.col-chevron { width: 2.25rem; }

/* In-progress rows */
.row-in-progress {
  background: rgba(255,170,0,0.08) !important;
  box-shadow: inset 3px 0 0 rgba(255,170,0,0.7);
}
.row-in-progress:hover {
  background: rgba(255,170,0,0.14) !important;
  box-shadow: inset 3px 0 0 rgba(255,170,0,0.9);
}

/* Pagination */
.pagination-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 0.3rem; padding: 0.85rem 0 0.25rem;
}
.btn-page, .btn-page-nav {
  background: rgba(0,170,255,0.07); border: 1px solid rgba(0,170,255,0.18);
  border-radius: 6px; color: #5a8aaa; cursor: pointer;
  font-size: 0.82rem; font-weight: 600; min-width: 32px; height: 32px;
  padding: 0 0.55rem; transition: background 0.15s, color 0.15s, border-color 0.15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-page:hover, .btn-page-nav:hover {
  background: rgba(0,170,255,0.15); border-color: rgba(0,170,255,0.4); color: #a8d8f0;
}
.btn-page.active {
  background: rgba(0,170,255,0.22); border-color: rgba(0,170,255,0.65);
  color: #00aaff; cursor: default; pointer-events: none;
}
.btn-page.ellipsis {
  background: none; border-color: transparent; color: #2a4a60;
  cursor: default; pointer-events: none;
}
.btn-page-nav:disabled { opacity: 0.28; cursor: not-allowed; pointer-events: none; }

/* Data rows */
.data-row {
  border-bottom: 1px solid rgba(0,170,255,0.07);
  cursor: pointer;
  transition: background 0.1s;
}
.data-row:nth-child(4n+3) { background: rgba(255,255,255,0.018); }
.data-row:hover { background: rgba(0,170,255,0.09) !important; }
.data-row.selected { background: rgba(0,170,255,0.11) !important; }
.data-row.expanded { background: rgba(0,170,255,0.06) !important; }

tbody td { padding: 0.8rem 1rem; font-size: 0.9rem; vertical-align: middle; }
td.col-check { padding: 0.8rem 0.5rem; text-align: center; }
td.col-actions { padding: 0.4rem 0.5rem; text-align: center; }
td.col-chevron { padding: 0.8rem 0.5rem; text-align: center; }

.row-check { cursor: pointer; accent-color: #00aaff; width: 15px; height: 15px; }

.ts { color: #a8d8f0; }

/* Chevron */
.chevron-icon {
  color: #2a5570; display: block;
  transition: transform 0.25s ease, color 0.15s;
}
.data-row:hover .chevron-icon { color: #6a9ab8; }
.data-row.expanded .chevron-icon { transform: rotate(180deg); color: #00aaff; }

/* Expand rows */
.expand-row td { padding: 0; border-bottom: 1px solid rgba(0,170,255,0.07); }
.expand-row.open td { border-top: 1px solid rgba(0,238,255,0.14); }

.expand-inner { max-height: 0; overflow: hidden; transition: max-height 0.32s ease; }
.expand-row.open .expand-inner { max-height: 1400px; }

.expand-content { background: rgba(3,10,32,0.6); padding: 1.1rem 1.5rem 1.25rem; }

.expand-fields-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem; margin-bottom: 1rem;
}
.expand-field {
  background: rgba(0,170,255,0.04); border: 1px solid rgba(0,170,255,0.11);
  border-radius: 7px; padding: 0.55rem 0.75rem;
  transition: background 0.2s, border-color 0.2s;
  position: relative;
}

/* Corner copy button */
.field-card-copy-btn {
  position: absolute; top: 0.35rem; right: 0.35rem;
  background: none; border: none; cursor: pointer;
  color: #2a5570; padding: 0.3rem;
  border-radius: 4px;
  opacity: 0; transition: opacity 0.15s, color 0.15s, background 0.15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.expand-field:hover .field-card-copy-btn { opacity: 1; }
.field-card-copy-btn:hover { color: #5a9fcc; background: rgba(0,170,255,0.12); }
.field-card-copy-btn.copied { color: #00ffa0 !important; opacity: 1; }

.expand-field-label {
  color: #375f7a; font-size: 0.67rem; font-weight: 700;
  letter-spacing: 0.07em; margin-bottom: 0.25rem; text-transform: uppercase;
  user-select: none; -webkit-user-select: none; cursor: default;
}
.expand-field-value-row {
  display: flex; align-items: flex-start; gap: 0.4rem;
  border-radius: 4px; padding: 2px 5px; margin: -2px -5px;
  transition: background 0.15s;
  cursor: default; user-select: none; -webkit-user-select: none;
}
.field-value-copy { cursor: pointer; user-select: text; -webkit-user-select: text; }
.field-value-copy:hover { background: rgba(0,170,255,0.15); }
.field-value-copy.copied { background: rgba(0,255,160,0.1); }

.expand-field-value {
  color: #d0e8f5; font-size: 0.875rem; line-height: 1.4;
  word-break: break-word; white-space: pre-wrap; flex: 1;
  transition: color 0.3s;
}
.expand-field-value.null { color: #1e3a50; font-style: italic; cursor: default; user-select: none; -webkit-user-select: none; }
.expand-field-value.value-copied { color: #00ff88; }

.expand-footer { margin-top: 0.65rem; display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }

/* ── Split-style expand footer buttons ── */
.btn-expand-split {
  height: 42px; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; overflow: hidden;
  font-size: 14px; font-weight: 700; letter-spacing: 0.05em;
  text-decoration: none; border-width: 1px; border-style: solid;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.split-btn-icon {
  width: 42px; height: 100%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.split-btn-label {
  padding: 0 1rem 0 0.8rem; white-space: nowrap;
}

/* View Full Run — green */
.btn-view-run-expand {
  background: rgba(0,200,100,0.15); border-color: rgba(0,200,100,0.5); color: #00c864;
}
.btn-view-run-expand .split-btn-icon { background: rgba(0,200,100,0.25); }
.btn-view-run-expand:hover {
  background: rgba(0,200,100,0.28); border-color: rgba(0,200,100,0.85);
  box-shadow: 0 0 14px rgba(0,200,100,0.2);
}
.btn-view-run-expand:hover .split-btn-icon { background: rgba(0,200,100,0.42); }

/* Copy All Fields — cyan */
.btn-copy-all-fields {
  background: rgba(0,170,255,0.15); border-color: rgba(0,170,255,0.5); color: #00aaff;
  width: 195px; flex-shrink: 0;
}
.btn-copy-all-fields .split-btn-label { flex: 1; text-align: center; }
.btn-copy-all-fields .split-btn-icon { background: rgba(0,170,255,0.25); }
.btn-copy-all-fields:hover {
  background: rgba(0,170,255,0.28); border-color: rgba(0,170,255,0.85);
  box-shadow: 0 0 14px rgba(0,170,255,0.2);
}
.btn-copy-all-fields:hover .split-btn-icon { background: rgba(0,170,255,0.42); }
.btn-copy-all-fields.copied {
  background: rgba(0,255,160,0.15); border-color: rgba(0,255,160,0.5); color: #00ffa0;
}
.btn-copy-all-fields.copied .split-btn-icon { background: rgba(0,255,160,0.25); }

.expand-error {
  background: rgba(255,60,60,0.08); border: 1px solid rgba(255,60,60,0.22);
  border-radius: 7px; color: #ff6060; font-size: 0.875rem;
  margin-bottom: 0.9rem; padding: 0.6rem 0.8rem;
}

/* ── Write run expand content ── */
.write-section-label {
  color: #3a6a8a; font-size: 0.67rem; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  margin: 0.75rem 0 0.4rem;
  user-select: none; -webkit-user-select: none; cursor: default;
}
.write-section-label:first-child { margin-top: 0; }
.write-status-change {
  display: flex; align-items: center; gap: 0.65rem;
  background: rgba(0,170,255,0.06); border: 1px solid rgba(0,170,255,0.15);
  border-radius: 7px; padding: 0.55rem 0.85rem;
  font-size: 0.875rem; margin-bottom: 0.5rem;
}
.write-status-from  { color: #7aa8c0; }
.write-status-arrow { color: #3a6a8a; }
.write-status-to    { color: #00ffa0; font-weight: 600; }
.write-action-row {
  display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
  padding: 0.4rem 0.65rem; border-radius: 6px;
  background: rgba(0,170,255,0.04); border: 1px solid rgba(0,170,255,0.1);
  margin-bottom: 0.3rem; font-size: 0.82rem;
}
.write-action-name { color: #a8d8f0; flex: 1; font-weight: 500; min-width: 0; }
.write-action-badge {
  font-size: 0.67rem; font-weight: 700; letter-spacing: 0.06em;
  padding: 0.1rem 0.45rem; border-radius: 4px; text-transform: uppercase; flex-shrink: 0;
}
.write-action-badge.ok  { background: rgba(0,255,160,0.15); color: #00ffa0; }
.write-action-badge.err { background: rgba(255,100,100,0.15); color: #ff8080; }
.write-action-dur    { color: #3a6a8a; font-size: 0.72rem; flex-shrink: 0; }
.write-action-detail { color: #5a8aaa; font-size: 0.78rem; flex-shrink: 0; }

/* ── Latest badge ── */
.badge-latest {
  background: rgba(0,255,255,0.15); border: 1px solid rgba(0,255,255,0.4);
  color: #00ffff; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  padding: 0.1rem 0.4rem; vertical-align: middle;
  display: inline-block; margin-left: 0.4rem;
  animation: latestPulse 2.5s ease-in-out infinite;
}
@keyframes latestPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(0,255,255,0.2); }
  50%       { box-shadow: 0 0 8px rgba(0,255,255,0.55), 0 0 14px rgba(0,255,255,0.25); }
}

.empty { color: #2a5070; padding: 3rem; text-align: center; }

/* ── New Run card ── */
.new-run-card {
  background: rgba(10,25,60,0.68); backdrop-filter: blur(8px);
  border: 1px solid rgba(0,170,255,0.2); border-radius: 14px;
  padding: 0 1.5rem; height: 64px; margin-bottom: 1.5rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: nowrap;
  justify-content: space-between;
  position: relative; z-index: 10;
}
.new-run-card h3 {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: #00aaff; flex-shrink: 0;
}
.new-run-card input[type="text"] {
  background: rgba(0,0,0,0.3); border: 1px solid rgba(0,170,255,0.25);
  border-radius: 8px; color: #e2e8f0; font-size: 0.9rem;
  padding: 0 0.85rem; height: 38px; outline: none; width: 200px;
  transition: border-color 0.15s;
}
.new-run-card input[type="text"]:focus { border-color: rgba(0,170,255,0.6); }

/* ── Custom portal dropdown ── */
.portal-dropdown { position: relative; }
.portal-dropdown-btn {
  background: rgba(0,0,0,0.3); border: 1px solid rgba(0,170,255,0.25);
  border-radius: 8px; color: #e2e8f0; font-size: 0.9rem;
  height: 38px; padding: 0 0.75rem 0 0.85rem;
  display: inline-flex; align-items: center; gap: 0.5rem;
  cursor: pointer; outline: none; min-width: 160px;
  font-family: 'Rajdhani', sans-serif; font-weight: 600;
  transition: border-color 0.15s;
}
.portal-dropdown-btn:focus,
.portal-dropdown-btn.open { border-color: rgba(0,170,255,0.6); outline: none; }
.portal-dropdown-label { flex: 1; text-align: left; }
.portal-dropdown-btn.placeholder .portal-dropdown-label { color: rgba(255,255,255,0.35); }
.portal-chevron { flex-shrink: 0; color: #4a7a9a; transition: transform 0.2s ease; }
.portal-dropdown-btn.open .portal-chevron { transform: rotate(180deg); }

.portal-dropdown-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  background: rgba(10,15,40,0.97); backdrop-filter: blur(20px);
  border: 1px solid rgba(139,92,246,0.3); border-radius: 8px;
  min-width: 100%; padding: 0.4rem 0; overflow: hidden;
  display: none; flex-direction: column;
  z-index: 1000; box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  animation: portalDropFade 0.15s ease;
}
@keyframes portalDropFade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.portal-dropdown-menu.open { display: flex; }

.portal-dropdown-item {
  position: relative;
  color: #a8d8f0; padding: 0.45rem 0.8rem;
  font-family: 'Rajdhani', sans-serif; font-weight: 600; font-size: 14px;
  cursor: pointer; white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease;
}
.portal-dropdown-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: #c084fc; box-shadow: 0 0 6px #c084fc, 0 0 12px #c084fc;
  transform: scaleY(0); transform-origin: center;
  transition: transform 0.2s ease;
}
.portal-dropdown-item:hover { color: #c084fc; background: rgba(192,132,252,0.1); }
.portal-dropdown-item:hover::before { transform: scaleY(1); }
.portal-dropdown-item.selected { color: #47c8ff; }
.portal-dropdown-item.selected::before {
  background: #47c8ff; box-shadow: 0 0 6px #47c8ff, 0 0 12px #47c8ff;
  transform: scaleY(1);
}

.btn-run {
  background: rgba(0,170,255,0.18); border: 1px solid rgba(0,170,255,0.45);
  border-radius: 8px; color: #80d8ff; cursor: pointer; font-size: 0.875rem;
  font-weight: 600; padding: 0 1.1rem; height: 38px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  display: inline-flex; align-items: center; gap: 0.45rem; flex-shrink: 0;
}
.btn-run:hover { background: rgba(0,170,255,0.3); border-color: rgba(0,170,255,0.7); color: #ffffff; }
.btn-run:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Search section divider ── */
.run-card-divider {
  width: 1px; height: 24px; align-self: center;
  background: rgba(255,255,255,0.15); flex-shrink: 0; margin: 0 24px;
}

/* ── Search input wrapper ── */
.search-wrap { position: relative; display: inline-flex; align-items: center; }
.search-wrap input[type="text"] {
  background: rgba(0,0,0,0.3); border: 1px solid rgba(0,170,255,0.25);
  border-radius: 8px; color: #e2e8f0; font-size: 0.9rem;
  padding: 0 1.8rem 0 0.85rem; height: 38px; outline: none; width: 200px;
  transition: border-color 0.15s;
}
.search-wrap input[type="text"]:focus { border-color: rgba(0,170,255,0.6); }
.search-clear {
  position: absolute; right: 0.5rem;
  background: none; border: none; cursor: pointer;
  color: #3a6080; font-size: 1rem; line-height: 1;
  padding: 0; display: none; align-items: center;
  transition: color 0.15s;
}
.search-clear.visible { display: flex; }
.search-clear:hover { color: #a8d8f0; }

/* ── Search match highlight ── */
.search-job-number { color: #ffffff; }
.search-match {
  color: #47c8ff; font-weight: 700;
  text-shadow:
    0 0 4px rgba(71,200,255,0.7),
    0 0 8px rgba(71,200,255,0.4);
}

/* ── Search dropdown ── */
.search-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: rgba(7,18,50,0.97); backdrop-filter: blur(14px);
  border: 1px solid rgba(0,170,255,0.25); border-radius: 10px;
  min-width: 340px; max-height: 360px; overflow-y: auto;
  z-index: 1000; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: none; flex-direction: column;
}
.search-dropdown.open { display: flex; }
.search-dropdown::-webkit-scrollbar { width: 4px; }
.search-dropdown::-webkit-scrollbar-thumb { background: rgba(0,170,255,0.2); border-radius: 4px; }
.search-dropdown-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.85rem; cursor: pointer;
  border-bottom: 1px solid rgba(0,170,255,0.07);
  transition: background 0.12s;
  text-decoration: none;
}
.search-dropdown-item:last-child { border-bottom: none; }
.search-dropdown-item:hover { background: rgba(0,170,255,0.1); }
.search-dropdown-job { font-size: 0.9rem; font-weight: 700; color: #d0e8f5; flex: 1; }
.search-dropdown-meta { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.search-dropdown-ts { color: #4a7a9a; font-size: 0.72rem; }
.search-dropdown-empty { color: #2a5070; font-size: 0.875rem; padding: 0.75rem 0.85rem; }

/* ── In-progress badge ── */
.badge-in-progress {
  background: rgba(0,170,255,0.12); border: 1px solid rgba(0,170,255,0.35);
  color: #00aaff; border-radius: 9999px; font-size: 0.72rem; font-weight: 700;
  padding: 0.2rem 0.65rem; display: inline-flex; align-items: center; gap: 0.4rem;
}
.badge-in-progress-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #00aaff; flex-shrink: 0;
  animation: badge-pulse 1.2s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}
