/* ==========================================================================
   HAZARA AI — dark purple / luminous theme
   ========================================================================== */

:root {
  /* surfaces */
  --bg: #07040f;
  --bg-2: #0b0616;
  --panel: rgba(22, 13, 40, 0.72);
  --panel-solid: #150d28;
  --panel-2: rgba(38, 24, 66, 0.55);
  --panel-3: rgba(48, 31, 82, 0.7);
  --line: rgba(167, 139, 250, 0.16);
  --line-strong: rgba(167, 139, 250, 0.34);

  /* ink */
  --text: #f4eeff;
  --text-dim: #b6a6d6;
  --text-faint: #7d6ca0;

  /* brand */
  --violet: #a855f7;
  --violet-2: #7c3aed;
  --violet-3: #c084fc;
  --magenta: #d946ef;
  --cyan: #22d3ee;

  /* states */
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.12);
  --red: #fb7185;
  --red-soft: rgba(251, 113, 133, 0.12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.12);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;

  --glow-sm: 0 0 12px rgba(168, 85, 247, 0.35);
  --glow: 0 0 28px rgba(168, 85, 247, 0.42);
  --glow-lg: 0 0 60px rgba(168, 85, 247, 0.3);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── ambient background ─────────────────────────────────────────────── */

.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
}

.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.5;
  will-change: transform;
}

.blob-1 {
  width: 720px;
  height: 720px;
  top: -260px;
  left: -140px;
  background: radial-gradient(circle at 35% 35%, #7c3aed, transparent 68%);
  animation: drift-a 26s ease-in-out infinite;
}

.blob-2 {
  width: 620px;
  height: 620px;
  top: -180px;
  right: -120px;
  background: radial-gradient(circle at 60% 40%, #d946ef, transparent 66%);
  opacity: 0.38;
  animation: drift-b 32s ease-in-out infinite;
}

.blob-3 {
  width: 760px;
  height: 760px;
  bottom: -340px;
  left: 42%;
  background: radial-gradient(circle at 50% 50%, #4c1d95, transparent 70%);
  opacity: 0.45;
  animation: drift-c 38s ease-in-out infinite;
}

@keyframes drift-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(90px, 60px) scale(1.12); }
}
@keyframes drift-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-110px, 80px) scale(1.16); }
}
@keyframes drift-c {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-70px, -90px) scale(1.1); }
}

.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(167, 139, 250, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167, 139, 250, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 78%);
}

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }

code {
  background: rgba(124, 58, 237, 0.16);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.85em;
  color: var(--violet-3);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

/* ── topbar ──────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 26px;
  background: rgba(7, 4, 15, 0.72);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(167, 139, 250, 0.08), 0 16px 40px -28px rgba(0, 0, 0, 0.9);
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(150deg, rgba(168, 85, 247, 0.22), rgba(217, 70, 239, 0.1));
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), var(--glow-sm);
  flex-shrink: 0;
}

.brand-mark svg { display: block; filter: drop-shadow(0 0 6px rgba(192, 132, 252, 0.55)); }
.hz-hex { opacity: 0.55; }
.hz-h { animation: hz-pulse 4.5s ease-in-out infinite; }

@keyframes hz-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.62; }
}

.brand-text h1 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(100deg, #ffffff 8%, #d8b4fe 52%, #a855f7 96%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-accent {
  background: linear-gradient(100deg, #c084fc, #d946ef);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-left: 3px;
}

.brand-sub {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-cluster { display: flex; align-items: center; gap: 8px; }

/* ── layout & panels ────────────────────────────────────────────────── */

.layout {
  max-width: 1340px;
  margin: 0 auto;
  padding: 26px 26px 90px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.panel {
  position: relative;
  background: linear-gradient(168deg, rgba(30, 19, 54, 0.82), rgba(15, 9, 28, 0.72));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    0 30px 70px -34px rgba(0, 0, 0, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

/* luminous top edge */
.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(192, 132, 252, 0.55),
    rgba(217, 70, 239, 0.35),
    transparent
  );
}

.panel-head { margin-bottom: 18px; }
.panel-head h2 { font-size: 18px; font-weight: 700; }
.hint { margin: 7px 0 0; font-size: 13px; color: var(--text-dim); line-height: 1.6; }
.hint code { font-size: 12px; }

.eyebrow {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--violet-3);
  margin-bottom: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.24);
}

/* ── buttons ─────────────────────────────────────────────────────────── */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.08s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn:focus-visible {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.28), var(--glow-sm);
}

.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #a855f7 52%, #d946ef);
  border-color: rgba(216, 180, 254, 0.35);
  color: #fff;
  font-weight: 650;
  box-shadow: 0 8px 22px -10px rgba(168, 85, 247, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #8b5cf6, #b366f9 52%, #e05af5);
  border-color: rgba(232, 200, 255, 0.5);
  box-shadow: 0 10px 30px -8px rgba(168, 85, 247, 1), 0 0 22px rgba(168, 85, 247, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn-danger {
  background: var(--red-soft);
  border-color: rgba(251, 113, 133, 0.32);
  color: #fda4af;
}
.btn-danger:hover { background: rgba(251, 113, 133, 0.2); border-color: rgba(251, 113, 133, 0.5); }

.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); border-color: var(--line-strong); }

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }

.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }

/* ── fields ──────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.field small { font-size: 11.5px; color: var(--text-faint); }
.field-inline { flex-direction: row; align-items: center; gap: 10px; margin-bottom: 0; }
.field-inline > span { text-transform: none; letter-spacing: 0.04em; font-size: 12px; }

input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  background: rgba(9, 5, 18, 0.6);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 13.5px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
textarea { min-height: 70px; line-height: 1.6; }

input::placeholder, textarea::placeholder { color: #5d4f7d; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--violet);
  background: rgba(12, 7, 24, 0.85);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2), 0 0 18px -6px rgba(168, 85, 247, 0.5);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 L6 8 L9.5 4.5' stroke='%23a78bfa' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}
select option { background: var(--panel-solid); color: var(--text); }

input[type="number"] { max-width: 140px; }

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.controls-wrap { margin-bottom: 20px; }
.controls .field { margin-bottom: 0; }

/* ── pills & chips ───────────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  border: 1px solid var(--line);
  background: var(--panel-2);
  white-space: nowrap;
  color: var(--text-dim);
}
.pill-muted { color: var(--text-dim); }
.pill-green {
  background: var(--green-soft);
  border-color: rgba(52, 211, 153, 0.34);
  color: var(--green);
  box-shadow: 0 0 16px -4px rgba(52, 211, 153, 0.6);
}
.pill-red {
  background: var(--red-soft);
  border-color: rgba(251, 113, 133, 0.36);
  color: var(--red);
  box-shadow: 0 0 16px -4px rgba(251, 113, 133, 0.6);
}
.pill-amber {
  background: var(--amber-soft);
  border-color: rgba(251, 191, 36, 0.34);
  color: var(--amber);
  box-shadow: 0 0 16px -4px rgba(251, 191, 36, 0.5);
}
.pill-blue {
  background: var(--blue-soft);
  border-color: rgba(96, 165, 250, 0.34);
  color: var(--blue);
  box-shadow: 0 0 16px -4px rgba(96, 165, 250, 0.5);
}
.pill-accent {
  background: rgba(168, 85, 247, 0.16);
  border-color: rgba(192, 132, 252, 0.4);
  color: var(--violet-3);
  box-shadow: 0 0 18px -4px rgba(168, 85, 247, 0.7);
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  background: rgba(168, 85, 247, 0.14);
  border: 1px solid rgba(192, 132, 252, 0.34);
  color: var(--violet-3);
}
.chip-empty { font-size: 12px; color: var(--text-faint); font-style: italic; }
.chip-missing {
  background: var(--red-soft);
  border-color: rgba(251, 113, 133, 0.34);
  color: var(--red);
}

.detect-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 15px;
  margin-bottom: 16px;
  background: linear-gradient(120deg, rgba(124, 58, 237, 0.12), rgba(217, 70, 239, 0.05));
  border: 1px solid rgba(168, 85, 247, 0.22);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.detect-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--violet-3);
  flex-shrink: 0;
}

/* ── tabs ────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  margin-bottom: 22px;
  background: rgba(9, 5, 18, 0.5);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: fit-content;
}
.tab-btn {
  appearance: none;
  background: none;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-dim);
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 650;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.18s, background 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.9), rgba(168, 85, 247, 0.7));
  border-color: rgba(216, 180, 254, 0.4);
  box-shadow: 0 6px 20px -8px rgba(168, 85, 247, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}
.tab-icon { font-size: 10px; opacity: 0.9; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-up 0.32s ease; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ── bulk disclosure ─────────────────────────────────────────────────── */

.bulk {
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(9, 5, 18, 0.4);
}
.bulk summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 9px;
}
.bulk summary::-webkit-details-marker { display: none; }
.bulk summary::before {
  content: "▸";
  color: var(--violet-3);
  font-size: 11px;
  transition: transform 0.2s;
  display: inline-block;
}
.bulk[open] summary::before { transform: rotate(90deg); }
.bulk summary:hover { color: var(--violet-3); }
.summary-hint { font-size: 12px; font-weight: 500; color: var(--text-faint); }
.bulk[open] summary { margin-bottom: 16px; }
.bulk-controls {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.bulk-controls select { width: auto; }

/* ── reference library ───────────────────────────────────────────────── */

.ref-grid-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.ref-block {
  position: relative;
  background: rgba(9, 5, 18, 0.45);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ref-block:hover { border-color: var(--line-strong); box-shadow: 0 0 24px -12px rgba(168, 85, 247, 0.7); }

.ref-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.ref-head h3 {
  font-size: 13.5px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 9px;
}
.ref-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-image { background: var(--violet); box-shadow: 0 0 10px 1px rgba(168, 85, 247, 0.9); }
.dot-video { background: var(--magenta); box-shadow: 0 0 10px 1px rgba(217, 70, 239, 0.9); }
.dot-audio { background: var(--cyan); box-shadow: 0 0 10px 1px rgba(34, 211, 238, 0.9); }

.count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--violet-3);
  background: rgba(168, 85, 247, 0.14);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 999px;
  padding: 2px 10px;
  min-width: 26px;
  text-align: center;
}

.dropzone {
  border: 1.5px dashed rgba(167, 139, 250, 0.32);
  border-radius: var(--radius-sm);
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  color: var(--text-dim);
  background: rgba(124, 58, 237, 0.04);
}
.dropzone p { margin: 0 0 5px; font-size: 13px; }
.dropzone strong { color: var(--text); font-weight: 650; }
.dropzone small { font-size: 11px; color: var(--text-faint); }
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--violet);
  background: rgba(168, 85, 247, 0.14);
  box-shadow: 0 0 28px -10px rgba(168, 85, 247, 0.9);
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 11px;
  margin-top: 14px;
}

.thumb {
  position: relative;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  overflow: hidden;
  aspect-ratio: 1;
  cursor: default;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.thumb:hover { transform: translateY(-2px); }
.thumb img, .thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb .thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--text-faint);
}

/* Detected reference: green border + glow. */
.thumb.detected {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.24), 0 0 20px -4px rgba(52, 211, 153, 0.85);
}

.thumb-index {
  position: absolute;
  top: 5px;
  left: 5px;
  background: rgba(7, 4, 15, 0.86);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.3px;
  backdrop-filter: blur(6px);
}
.thumb.detected .thumb-index {
  background: var(--green);
  border-color: var(--green);
  color: #04140c;
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.9);
}

/* The small green "used" icon badge. */
.thumb-used {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--green);
  color: #04140c;
  font-size: 10.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.95), 0 0 0 2px rgba(7, 4, 15, 0.8);
}
.thumb-used::before { content: "\2713"; margin-right: 3px; }

.thumb-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 4, 15, 0.72);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
}
.thumb-state.err { color: var(--red); }

.thumb-remove {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 21px;
  height: 21px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(7, 4, 15, 0.9);
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.thumb:hover .thumb-remove { display: flex; }
.thumb-remove:hover { background: var(--red); border-color: var(--red); color: #fff; }

.thumb-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 6px;
  background: linear-gradient(transparent, rgba(7, 4, 15, 0.96));
  font-size: 9.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── queue ───────────────────────────────────────────────────────────── */

.queue-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.queue-head .row-actions { margin-top: 0; }
.queue-list { display: flex; flex-direction: column; gap: 13px; }

.job {
  position: relative;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: rgba(9, 5, 18, 0.5);
  padding: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.job:hover { border-color: var(--line-strong); }
.job.s-queued { border-left-color: var(--text-faint); }
.job.s-preparing, .job.s-submitted {
  border-left-color: var(--blue);
  box-shadow: 0 0 24px -14px rgba(96, 165, 250, 0.9);
}
.job.s-running {
  border-left-color: var(--violet);
  box-shadow: 0 0 28px -12px rgba(168, 85, 247, 0.95);
}
.job.s-succeeded {
  border-left-color: var(--green);
  background: linear-gradient(100deg, rgba(52, 211, 153, 0.07), rgba(9, 5, 18, 0.55));
  box-shadow: 0 0 26px -16px rgba(52, 211, 153, 0.9);
}
.job.s-retrying {
  border-left-color: var(--amber);
  box-shadow: 0 0 24px -14px rgba(251, 191, 36, 0.8);
}
.job.s-failed {
  border-left-color: var(--red);
  background: linear-gradient(100deg, rgba(251, 113, 133, 0.09), rgba(9, 5, 18, 0.6));
  box-shadow: 0 0 26px -14px rgba(251, 113, 133, 0.9);
}
.job.s-canceled { border-left-color: var(--text-faint); opacity: 0.6; }

.job-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 10px; }
.job-id {
  font-size: 11px;
  color: var(--text-faint);
  font-family: ui-monospace, Consolas, monospace;
  margin-left: auto;
}
.job-prompt {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.55;
  word-break: break-word;
  background: rgba(7, 4, 15, 0.55);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 13px;
  margin-bottom: 11px;
}
.job-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 11px; }
.job-err {
  font-size: 12.5px;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(251, 113, 133, 0.3);
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 11px;
  word-break: break-word;
}
.job-warn {
  font-size: 12px;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 11px;
}
.job-refs { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 11px; }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.job-result { margin-top: 12px; }
.job-result video, .job-result img {
  max-width: 100%;
  max-height: 360px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  display: block;
  background: #000;
  box-shadow: 0 16px 40px -20px rgba(0, 0, 0, 0.95);
}
.job-result a { color: var(--violet-3); font-size: 12.5px; }

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  text-align: center;
  padding: 38px 20px;
  color: var(--text-faint);
  font-size: 13.5px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(9, 5, 18, 0.3);
}

/* ── dialogs & toast ────────────────────────────────────────────────── */

.dialog {
  background: linear-gradient(168deg, rgba(32, 20, 58, 0.96), rgba(14, 8, 26, 0.97));
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 26px;
  width: min(580px, 93vw);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.95), 0 0 60px -30px rgba(168, 85, 247, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.dialog::backdrop { background: rgba(4, 2, 10, 0.78); backdrop-filter: blur(6px); }
.dialog h3 { font-size: 17px; margin-bottom: 8px; }
.dialog .row-actions { justify-content: flex-end; margin-top: 20px; }

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: linear-gradient(135deg, rgba(36, 22, 64, 0.97), rgba(18, 11, 32, 0.97));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 13.5px;
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, 0.95), 0 0 34px -14px rgba(168, 85, 247, 0.9);
  backdrop-filter: blur(18px);
  max-width: 90vw;
  animation: toast-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.toast.err { border-color: rgba(251, 113, 133, 0.42); color: var(--red); }
.toast.ok { border-color: rgba(52, 211, 153, 0.4); color: var(--green); }

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: rgba(7, 4, 15, 0.5); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.5), rgba(124, 58, 237, 0.5));
  border-radius: 999px;
  border: 2px solid rgba(7, 4, 15, 0.6);
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, rgba(192, 132, 252, 0.75), rgba(168, 85, 247, 0.75)); }

::selection { background: rgba(168, 85, 247, 0.4); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .aurora-blob, .hz-h, .tab-panel.active, .toast { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .layout { padding: 18px 14px 60px; }
  .panel { padding: 17px; }
  .tabs { width: 100%; }
  .tab-btn { flex: 1; justify-content: center; padding: 9px 12px; }
}
