/* ===========================================================================
   Upscaler — app shell styles
   Inherits colors/type tokens from assets/colors_and_type.css
   =========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  background: var(--bg-2);
  color: var(--fg-1);
  font-family: var(--font-ui);
  overflow: hidden;
}

button { font-family: inherit; }

/* --- Accent strip (firm signature) --- */
.accent-strip {
  position: fixed; inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg,
    var(--knowledgeable-blue) 0%,
    var(--knowledgeable-blue) 40%,
    var(--victory-red) 62%,
    var(--victory-red) 100%);
  z-index: 10000;
  pointer-events: none;
}

/* =============================================================================
   LOGIN
   =========================================================================== */
.login-shell {
  position: fixed; inset: 0;
  display: grid;
  grid-template-columns: 30fr 70fr;
  background: var(--bg-1);
  animation: loginIn 0.6s var(--ease-smooth) both;
}
@keyframes loginIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.login-left {
  position: relative;
  background:
    radial-gradient(1200px 600px at 15% 10%, rgba(29,50,66,0.05) 0%, transparent 60%),
    radial-gradient(900px 500px at 85% 90%, rgba(220,32,21,0.04) 0%, transparent 55%),
    linear-gradient(180deg, #fff 0%, #fafbfc 100%);
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border);
}

.login-logo {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  width: 100%;
}
.login-logo img {
  height: 480px;
  width: auto;
  max-width: 100%;
  display: block;
  object-fit: contain;
}

.login-welcome {
  max-width: 460px;
}
.login-welcome .eyebrow {
  color: var(--victory-red);
  margin-bottom: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
.login-welcome .eyebrow::before {
  content: ""; width: 24px; height: 2px;
  background: var(--victory-red);
  display: inline-block;
}
.login-welcome h1 {
  font-family: var(--font-display);
  font-size: 44px; line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.9px;
  color: var(--knowledgeable-blue);
  margin: 0 0 18px;
  text-wrap: balance;
}
.login-welcome h1 em {
  font-style: normal;
  color: var(--victory-red);
}
.login-welcome p {
  font-size: 15px; line-height: 1.65;
  color: var(--fg-2);
  margin: 0;
  max-width: 420px;
}

.login-footer {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--fg-3);
  letter-spacing: 0.1px;
}
.login-footer .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #16a34a; display: inline-block;
  margin-right: 8px;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.18);
  animation: pulse 2.2s var(--ease-smooth) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(22,163,74,0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(22,163,74,0.04); }
}

.login-right {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  background-color: var(--knowledgeable-blue);
  background-image:
    /* fine grid pattern overlay, baked into the panel so it sits
       directly on the photo (below the gradient + noise pseudos) */
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    /* the photo, anchored to the right side of the panel */
    url('bg.webp');
  background-size: 48px 48px, 48px 48px, cover;
  background-position: 0 0, 0 0, right center;
  background-repeat: repeat, repeat, no-repeat;
  overflow: hidden;
}
.login-right::before {
  content: "";
  position: absolute; inset: 0;
  background:
    /* thin victory-red accent ribbon at the very top edge */
    linear-gradient(
      to bottom,
      var(--victory-red) 0,
      var(--victory-red) 3px,
      transparent 3px,
      transparent 100%
    ),
    /* secondary diagonal wedge reinforcing the corner weight */
    linear-gradient(
      to top left,
      rgba(4, 10, 16, 0.75) 0%,
      rgba(12, 22, 32, 0.45) 28%,
      rgba(20, 38, 52, 0.18) 52%,
      rgba(29, 50, 66, 0) 72%
    ),
    /* primary radial vignette anchored at bottom-right, widened */
    radial-gradient(
      ellipse 170% 170% at 100% 100%,
      rgba(4, 10, 16, 0.98) 0%,
      rgba(10, 20, 30, 0.90) 14%,
      rgba(16, 30, 42, 0.72) 30%,
      rgba(24, 44, 58, 0.48) 48%,
      rgba(29, 50, 66, 0.22) 68%,
      rgba(29, 50, 66, 0) 92%
    );
  pointer-events: none;
  z-index: 0;
}
.login-right::after {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.95 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
  opacity: 0.45;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 0;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 14px;
  padding: 40px 40px 34px;
  box-shadow:
    0 40px 80px rgba(10,20,30,0.35),
    0 12px 30px rgba(10,20,30,0.22),
    0 1px 0 rgba(255,255,255,0.08) inset;
  z-index: 1;
}
.login-card::before {
  content: "";
  position: absolute; top: 0; left: 22px; right: 22px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--victory-red), transparent);
  border-radius: 2px;
}

.login-card h2 {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--fg-1);
  margin: 0 0 4px;
}
.login-card .sub {
  font-size: 13px; color: var(--fg-3);
  margin: 0 0 28px;
}

.field {
  display: flex; flex-direction: column;
  margin-bottom: 16px;
}
.field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  font-family: var(--font-display);
}
.field .input-wrap {
  position: relative;
}
.field input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 42px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-ui);
  color: var(--fg-1);
  transition: all 0.18s var(--ease-standard);
  outline: none;
}
.field input:hover { border-color: var(--border-strong); }
.field input:focus {
  border-color: var(--victory-red);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(220,32,21,0.12);
}
.field .input-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--fg-3);
  display: flex;
  transition: color 0.18s var(--ease-standard);
}
.field input:focus + .input-icon,
.field .input-wrap:focus-within .input-icon {
  color: var(--victory-red);
}
.field .toggle-pw {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: 0;
  color: var(--fg-3);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  transition: all 0.15s;
}
.field .toggle-pw:hover { color: var(--fg-1); background: var(--bg-3); }

.login-row {
  display: flex; justify-content: space-between; align-items: center;
  margin: 8px 0 22px;
  font-size: 13px;
}
.login-row label {
  display: flex; align-items: center; gap: 8px;
  color: var(--fg-2);
  cursor: pointer;
  user-select: none;
}
.login-row label input { accent-color: var(--victory-red); }
.login-row a {
  color: var(--victory-red);
  font-weight: 600;
  font-size: 13px;
}
.login-row a:hover { color: var(--link-hover); text-decoration: underline; }

.btn-primary {
  width: 100%;
  height: 46px;
  background: var(--victory-red);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.2px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px;
  transition: all 0.18s var(--ease-standard);
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 2px 8px rgba(220,32,21,0.18);
}
.btn-primary::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.22) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s var(--ease-smooth);
}
.btn-primary:hover { background: var(--victory-red-hover); box-shadow: 0 2px 4px rgba(0,0,0,0.06), 0 6px 14px rgba(220,32,21,0.28); transform: translateY(-1px); }
.btn-primary:hover::before { transform: translateX(100%); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0,0,0,0.05), 0 2px 8px rgba(220,32,21,0.18); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary .arrow { transition: transform 0.2s var(--ease-smooth); }
.btn-primary:hover .arrow { transform: translateX(3px); }

.login-error {
  font-size: 13px;
  color: var(--victory-red);
  background: rgba(220,32,21,0.08);
  border: 1px solid rgba(220,32,21,0.2);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
  animation: shake 0.4s var(--ease-standard);
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* Feature badges on left panel */
.feature-list { display: flex; flex-direction: column; gap: 14px; margin-top: 36px; }
.feature-item {
  display: flex; align-items: flex-start; gap: 14px;
  font-size: 13px; color: var(--fg-2);
  line-height: 1.5;
}
.feature-item .dot {
  width: 24px; height: 24px; flex-shrink: 0;
  border-radius: 6px;
  background: rgba(220,32,21,0.08);
  color: var(--victory-red);
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.feature-item b { color: var(--fg-1); font-weight: 600; }

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-left { display: none; }
}

/* =============================================================================
   APP SHELL
   =========================================================================== */
.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  background: var(--bg-2);
  animation: appIn 0.5s var(--ease-smooth) both;
}
@keyframes appIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px 0 0;
  gap: 20px;
  min-height: 112px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  z-index: 20;
  position: relative;
}

/* Crest plaque — dedicated heraldic panel anchoring the top-left corner.
   Warm stationery cream, architectural right border, a faint red accent rule
   that echoes the accent-strip across the top of the shell. */
.topbar .brand {
  flex: 0 0 112px;
  align-self: stretch;
  display: flex; align-items: center; justify-content: center;
  padding: 14px;
  background:
    linear-gradient(180deg, #fdfbf6 0%, #f4efe4 100%);
  border-right: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.8),
    inset 0 -8px 14px -12px rgba(29,50,66,0.08);
  position: relative;
  overflow: hidden;
}
.topbar .brand::before {
  /* Faint interior rule — a quiet frame inside the plaque */
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(29,50,66,0.06);
  border-radius: 2px;
  pointer-events: none;
}
.topbar .brand::after {
  /* Victory-red accent on the plaque's right edge, echoing .accent-strip */
  content: "";
  position: absolute;
  right: -1px; top: 22%; bottom: 22%;
  width: 2px;
  background: linear-gradient(180deg,
    transparent 0%,
    var(--victory-red) 45%,
    var(--victory-red) 55%,
    transparent 100%);
  opacity: 0.5;
}
.topbar .brand img {
  position: relative;
  height: 84px;
  width: auto;
  max-width: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(29,50,66,0.08));
}

/* The generic topbar divider is redundant next to the plaque —
   the plaque's own right border handles separation. */
.topbar .brand + .divider { display: none; }
.topbar .divider {
  width: 1px; height: 22px; background: var(--border);
}
.topbar .title-block {
  display: flex; flex-direction: column; line-height: 1.15;
  padding-left: 4px;
}
.topbar .product {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  color: var(--fg-1);
  letter-spacing: -0.1px;
}
.topbar .subtitle {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--fg-3);
  font-weight: 600;
  font-family: var(--font-display);
}

.topbar .spacer { flex: 1; }

.topbar-action {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s var(--ease-standard);
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar-action:hover {
  border-color: var(--border-strong);
  background: var(--bg-2);
  color: var(--fg-1);
}

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px 4px 6px;
  border: 1px solid transparent;
  border-radius: 20px;
  background: var(--bg-2);
  cursor: pointer;
  transition: all 0.15s;
}
.user-chip:hover { background: var(--bg-3); border-color: var(--border); }
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--knowledgeable-blue), var(--victory-red));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.2px;
}
.user-chip .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-1);
}
.user-chip .sub {
  font-size: 11px;
  color: var(--fg-3);
}
.user-chip .info { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }

/* =============================================================================
   WORKSPACE
   =========================================================================== */
.workspace {
  display: grid;
  grid-template-columns: 320px 1fr 340px;
  overflow: hidden;
  min-height: 0;
}

.panel {
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel.right { border-right: none; border-left: 1px solid var(--border); }

.panel-header {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fff 0%, #fcfcfd 100%);
}
.panel-header .eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 1.3px;
  font-family: var(--font-display);
  display: flex; align-items: center; gap: 8px;
}
.panel-header .eyebrow::before {
  content: ""; width: 16px; height: 2px;
  background: var(--victory-red);
  display: inline-block;
}
.panel-header h3 {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700;
  color: var(--fg-1);
  letter-spacing: -0.2px;
  margin: 6px 0 0;
}

.panel-body {
  flex: 1;
  overflow: auto;
  padding: 16px 20px 24px;
  min-height: 0;
}

/* Queue list */
.queue-empty {
  text-align: center;
  color: var(--fg-3);
  font-size: 13px;
  padding: 36px 12px;
  line-height: 1.6;
}
.queue-empty .icon {
  width: 42px; height: 42px;
  margin: 0 auto 12px;
  border-radius: 10px;
  background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-3);
}

.queue-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s var(--ease-standard);
  border: 1px solid transparent;
  margin-bottom: 6px;
  position: relative;
}
.queue-item:hover { background: var(--bg-2); }
.queue-item.is-active {
  background: #fff;
  border-color: var(--border);
  box-shadow: 0 2px 6px rgba(29,50,66,0.06);
}
.queue-item.is-active::before {
  content: ""; position: absolute;
  left: -1px; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--victory-red);
  border-radius: 2px;
}

.queue-thumb {
  width: 48px; height: 48px;
  border-radius: 8px;
  background: var(--bg-3);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  border: 1px solid var(--border);
}
.queue-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.queue-thumb .badge-ok {
  position: absolute; bottom: -2px; right: -2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #16a34a;
  color: #fff;
  border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
}
.queue-thumb .spinner-tiny {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.8);
}

.queue-meta { flex: 1; min-width: 0; }
.queue-meta .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-meta .sub {
  font-size: 11.5px;
  color: var(--fg-3);
  margin-top: 2px;
  display: flex; align-items: center; gap: 6px;
}
.queue-status {
  font-size: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 7px;
  border-radius: 999px;
}
.queue-status.queued    { color: var(--fg-3);    background: var(--bg-3); }
.queue-status.running   { color: var(--victory-red); background: rgba(220,32,21,0.10); }
.queue-status.done      { color: #166534; background: rgba(22,101,52,0.10); }
.queue-status.error     { color: var(--victory-red); background: rgba(220,32,21,0.10); }

/* =============================================================================
   CANVAS (middle)
   =========================================================================== */
.canvas {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background:
    linear-gradient(180deg, #f3f4f6 0%, #e9ecef 100%);
  position: relative;
  overflow: hidden;
}
.canvas::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(29,50,66,0.06) 1px, transparent 1px);
  background-size: 18px 18px;
  pointer-events: none;
}

.canvas-toolbar {
  position: relative;
  z-index: 3;
  padding: 14px 20px;
  background: rgba(255,255,255,0.75);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  gap: 10px;
  min-height: 54px;
}
.canvas-toolbar .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--fg-1);
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.canvas-toolbar .meta {
  font-size: 12px;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  display: flex; align-items: center; gap: 8px;
}
.canvas-toolbar .meta .sep { opacity: 0.4; }
.canvas-toolbar .spacer { flex: 1; }

.seg {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: 0; background: transparent;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-2);
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s;
  font-family: var(--font-display);
  letter-spacing: 0.1px;
}
.seg button:hover { color: var(--fg-1); }
.seg button.is-active {
  background: #fff;
  color: var(--knowledgeable-blue);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.icon-btn {
  height: 34px; width: 34px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  color: var(--fg-2);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.icon-btn:hover:not(:disabled) {
  color: var(--knowledgeable-blue);
  border-color: var(--border-strong);
  background: var(--bg-2);
}
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.canvas-stage {
  flex: 1;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 36px;
  min-height: 0;
  overflow: hidden;
}

/* Empty state */
.dropzone {
  width: min(760px, 100%);
  height: min(520px, 100%);
  border-radius: 16px;
  border: 2px dashed var(--border-strong);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0.6) 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 40px;
  transition: all 0.25s var(--ease-smooth);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.dropzone:hover,
.dropzone.is-drag {
  border-color: var(--victory-red);
  background: #fff;
  box-shadow:
    0 12px 34px rgba(29,50,66,0.08),
    0 0 0 6px rgba(220,32,21,0.06);
  transform: translateY(-2px);
}
.dropzone .icon-frame {
  width: 76px; height: 76px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(29,50,66,0.08), rgba(220,32,21,0.08));
  color: var(--knowledgeable-blue);
  margin-bottom: 22px;
  position: relative;
  transition: transform 0.3s var(--ease-smooth);
}
.dropzone:hover .icon-frame { transform: scale(1.04) rotate(-1.2deg); }
.dropzone .icon-frame::after {
  content: "";
  position: absolute; inset: -6px;
  border-radius: 22px;
  border: 1px dashed rgba(29,50,66,0.2);
  animation: spinSlow 24s linear infinite;
}
@keyframes spinSlow { to { transform: rotate(360deg); } }

.dropzone h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--knowledgeable-blue);
  margin: 0 0 6px;
}
.dropzone p {
  font-size: 13.5px;
  color: var(--fg-2);
  margin: 0 0 22px;
  max-width: 420px;
  line-height: 1.6;
}
.dropzone .btn-primary { width: auto; padding: 0 22px; }
.dropzone .accepted {
  font-size: 11px; color: var(--fg-3);
  margin-top: 18px;
  letter-spacing: 0.3px;
  display: flex; align-items: center; gap: 10px;
}
.dropzone .accepted .tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--knowledgeable-blue);
  background: var(--bg-3);
  border-radius: 4px;
  padding: 1px 6px;
  letter-spacing: 0;
}

/* Image stage */
.image-stage {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}
.image-frame {
  position: relative;
  max-width: 100%; max-height: 100%;
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 24px 60px rgba(10,20,30,0.22),
    0 8px 20px rgba(10,20,30,0.12),
    0 0 0 1px rgba(10,20,30,0.06);
  background: #1a202c;
  animation: frameIn 0.4s var(--ease-smooth) both;
}
@keyframes frameIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.image-frame img {
  display: block;
  max-width: calc(100vw - 760px);
  max-height: calc(100vh - 180px);
  width: auto; height: auto;
}

/* Before/after slider */
.compare {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 24px 60px rgba(10,20,30,0.22),
    0 8px 20px rgba(10,20,30,0.12),
    0 0 0 1px rgba(10,20,30,0.06);
  background: #1a202c;
  user-select: none;
  animation: frameIn 0.45s var(--ease-smooth) both;
}
.compare .before, .compare .after {
  display: block;
  max-width: calc(100vw - 760px);
  max-height: calc(100vh - 180px);
  width: auto; height: auto;
}
.compare .after-wrap {
  position: absolute; top: 0; left: 0; bottom: 0;
  overflow: hidden;
  will-change: width;
}
.compare .after-wrap img { max-width: none; }
.compare .handle {
  position: absolute; top: 0; bottom: 0;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3), 0 0 12px rgba(0,0,0,0.25);
  transform: translateX(-50%);
  cursor: ew-resize;
  z-index: 3;
}
.compare .handle::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.1);
  display: block;
}
.compare .handle::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 18px; height: 10px;
  background-image:
    linear-gradient(90deg, transparent 0, transparent 2px, var(--knowledgeable-blue) 2px, var(--knowledgeable-blue) 4px, transparent 4px, transparent 7px, var(--knowledgeable-blue) 7px, var(--knowledgeable-blue) 9px, transparent 9px, transparent 14px, var(--knowledgeable-blue) 14px, var(--knowledgeable-blue) 16px, transparent 16px);
  display: block;
  z-index: 1;
}
.compare .label {
  position: absolute; top: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2;
}
.compare .label.left {
  left: 14px;
  background: rgba(29,50,66,0.78);
  color: #fff;
}
.compare .label.right {
  right: 14px;
  background: rgba(220,32,21,0.88);
  color: #fff;
}

/* Processing overlay */
.processing {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(248,250,252,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 5;
  animation: fadeIn 0.25s var(--ease-smooth);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.processing-card {
  background: #fff;
  border-radius: 14px;
  padding: 28px 32px;
  width: min(420px, 92%);
  box-shadow: 0 24px 60px rgba(10,20,30,0.18), 0 8px 20px rgba(10,20,30,0.1);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.processing-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--victory-red), transparent);
}
.processing-card h4 {
  font-family: var(--font-display);
  font-weight: 700; font-size: 15px;
  color: var(--fg-1); margin: 0 0 4px;
  letter-spacing: -0.1px;
}
.processing-card .sub {
  font-size: 12.5px;
  color: var(--fg-3);
  margin: 0 0 16px;
}

.spinner-ring {
  width: 18px; height: 18px;
  border: 2px solid rgba(220,32,21,0.18);
  border-top-color: var(--victory-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
.spinner-ring.white { border-color: rgba(255,255,255,0.3); border-top-color: #fff; }
.spinner-ring.tiny { width: 12px; height: 12px; border-width: 1.5px; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress-track {
  height: 6px;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--victory-red), #ff6459);
  transform-origin: left;
  border-radius: 999px;
  transition: width 0.4s var(--ease-smooth);
}
.progress-fill::after {
  content: "";
  position: absolute; inset: 0;
  background-image: linear-gradient(
    45deg, rgba(255,255,255,0.28) 25%, transparent 25%,
    transparent 50%, rgba(255,255,255,0.28) 50%,
    rgba(255,255,255,0.28) 75%, transparent 75%, transparent);
  background-size: 14px 14px;
  animation: stripe 0.9s linear infinite;
  opacity: 0.8;
}
@keyframes stripe { to { background-position: 14px 0; } }

.processing-stages {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 16px;
}
.stage-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px;
  color: var(--fg-3);
  transition: color 0.2s;
}
.stage-row.done { color: var(--fg-1); }
.stage-row.active { color: var(--fg-1); font-weight: 600; }
.stage-row .stage-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  background: #fff;
}
.stage-row.done .stage-dot { border-color: #16a34a; background: #16a34a; color: #fff; }
.stage-row.active .stage-dot { border-color: var(--victory-red); }
.stage-row.active .stage-dot::after {
  content: ""; width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--victory-red);
  animation: pulseSmall 1.2s infinite;
}
@keyframes pulseSmall {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: 0.5; transform: scale(0.8); }
}
.stage-row .stage-time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}

/* =============================================================================
   RIGHT PANEL (Instructions / Settings)
   =========================================================================== */
.settings-group { margin-bottom: 22px; }
.settings-group label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--fg-3);
  font-family: var(--font-display);
  display: block;
  margin-bottom: 8px;
}
.settings-group label .hint {
  color: var(--fg-3);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.1px;
  font-size: 11px;
  margin-left: 6px;
}

textarea.prompt-ta {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.55;
  color: var(--fg-1);
  transition: all 0.18s var(--ease-standard);
  outline: none;
}
textarea.prompt-ta:focus {
  border-color: var(--victory-red);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(220,32,21,0.1);
}

.pill-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 6px;
}
.pill {
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--fg-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.pill:hover {
  background: #fff;
  color: var(--knowledgeable-blue);
  border-color: var(--border-strong);
}
.pill.is-active {
  background: rgba(220,32,21,0.08);
  color: var(--victory-red);
  border-color: rgba(220,32,21,0.25);
  font-weight: 600;
}

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.toggle-row:first-child { border-top: 0; }
.toggle-row .title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-1);
}
.toggle-row .desc {
  font-size: 11.5px;
  color: var(--fg-3);
  margin-top: 2px;
}

.switch {
  position: relative;
  width: 36px; height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
  transition: all 0.2s var(--ease-smooth);
  flex-shrink: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: all 0.22s var(--ease-smooth);
}
.switch.on { background: var(--victory-red); }
.switch.on::after { left: 18px; }

/* Action buttons */
.primary-action {
  margin-top: 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.btn-process {
  width: 100%;
  height: 46px;
  background: var(--victory-red);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px;
  transition: all 0.18s var(--ease-standard);
  box-shadow: 0 2px 4px rgba(0,0,0,0.04), 0 4px 14px rgba(220,32,21,0.28);
  position: relative;
  overflow: hidden;
}
.btn-process::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.3) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.65s var(--ease-smooth);
}
.btn-process:hover:not(:disabled) {
  background: var(--victory-red-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.06), 0 10px 22px rgba(220,32,21,0.35);
}
.btn-process:hover:not(:disabled)::before { transform: translateX(120%); }
.btn-process:active { transform: translateY(0); }
.btn-process:disabled {
  background: var(--border-strong);
  color: #fff;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.8;
}

.btn-ghost {
  width: 100%;
  height: 38px;
  background: #fff;
  color: var(--fg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-ghost:hover:not(:disabled) {
  color: var(--knowledgeable-blue);
  border-color: var(--border-strong);
  background: var(--bg-2);
}
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.meta-cell {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.meta-cell .k {
  font-size: 10px;
  font-weight: 700;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--font-display);
}
.meta-cell .v {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-1);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.meta-cell .v.muted { color: var(--fg-3); font-weight: 500; }

/* Scrollbars */
.panel-body::-webkit-scrollbar { width: 8px; }
.panel-body::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 4px; }
.panel-body::-webkit-scrollbar-thumb:hover { background: #a0aec0; }
.panel-body::-webkit-scrollbar-track { background: transparent; }

/* Toast */
.toast-rack {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2000;
  pointer-events: none;
}
.toast {
  background: var(--knowledgeable-blue);
  color: #fff;
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(10,20,30,0.3), 0 4px 10px rgba(10,20,30,0.18);
  animation: toastIn 0.3s var(--ease-smooth);
  display: flex; align-items: center; gap: 10px;
  min-width: 240px;
  pointer-events: auto;
  border-left: 3px solid var(--victory-red);
}
.toast.success { border-left-color: #16a34a; }
.toast.error   { border-left-color: var(--victory-red); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Kbd hint */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-2);
  font-weight: 600;
  line-height: 1;
}

/* =============================================================================
   BATCH MODE
   -----------------------------------------------------------------------------
   Toggle sits in the queue header at right; CTA + cost estimate appear above
   the queue list; banner under the topbar reports live OpenAI batch status.
   Language: calm, editorial, law-firm refined. Victory-red used sparingly
   as a state accent (the dot, the progress fill), never chrome.
   =========================================================================== */

/* Panel header needs to host the toggle at right. Title block stays at left. */
.panel-header { display: flex; align-items: baseline; gap: 10px; }
.panel-header .eyebrow + h3 { margin-right: auto; }

.batch-toggle {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--fg-3);
  cursor: pointer;
  transition: all 0.18s var(--ease-standard);
  margin-left: auto;
}
.batch-toggle:hover { border-color: var(--border-strong); color: var(--fg-2); }
.batch-toggle-label { line-height: 1; }
.batch-toggle-pill {
  width: 28px; height: 16px;
  border-radius: 999px;
  background: var(--bg-3);
  position: relative;
  transition: background 0.18s var(--ease-standard);
}
.batch-toggle-pip {
  position: absolute;
  left: 2px; top: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(29,50,66,0.35);
  transition: transform 0.22s var(--ease-smooth);
}
.batch-toggle.is-on {
  color: var(--knowledgeable-blue);
  border-color: var(--knowledgeable-blue);
  background: linear-gradient(180deg, #fff 0%, #fafbfc 100%);
}
.batch-toggle.is-on .batch-toggle-pill { background: var(--victory-red); }
.batch-toggle.is-on .batch-toggle-pip { transform: translateX(12px); }

/* CTA block in the queue when batch mode is engaged. */
.batch-cta {
  margin: 0 0 16px;
  padding: 14px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, #fdfbf6 0%, #f4efe4 100%);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.8),
    0 1px 2px rgba(29,50,66,0.04);
  animation: batchCtaIn 0.28s var(--ease-smooth) both;
}
@keyframes batchCtaIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.batch-cta-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px;
  gap: 10px;
}
.batch-cta-count {
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.3;
}
.batch-cta-count b {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--knowledgeable-blue);
  margin-right: 4px;
}
.batch-cta-cost {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-2);
  letter-spacing: -0.1px;
  white-space: nowrap;
}
.batch-cta-btn {
  width: 100%;
  height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 0.3px;
}
.batch-cta-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Banner reporting live OpenAI batch status beneath the topbar. */
.batch-banner {
  background: linear-gradient(180deg, #1D3242 0%, #243B4F 100%);
  color: #e6edf2;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: relative;
  animation: batchBannerIn 0.32s var(--ease-smooth) both;
}
@keyframes batchBannerIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.batch-banner-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 10px 28px;
  max-width: 1800px;
  margin: 0 auto;
}
.batch-banner-status {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.4px;
}
.batch-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--victory-red);
  box-shadow: 0 0 0 4px rgba(220,32,21,0.18);
  animation: batchPulse 1.6s var(--ease-smooth) infinite;
}
@keyframes batchPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(220,32,21,0.18); }
  50%      { box-shadow: 0 0 0 7px rgba(220,32,21,0.04); }
}
.batch-label { font-weight: 700; color: #fff; }
.batch-count { color: rgba(230,237,242,0.6); font-variant-numeric: tabular-nums; }
.batch-banner-progress {
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.batch-banner-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--victory-red) 0%, #ff6b61 100%);
  transition: width 0.6s var(--ease-smooth);
}
.batch-banner-id {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: rgba(230,237,242,0.55);
  letter-spacing: 0.1px;
}
.batch-banner-id code {
  color: rgba(230,237,242,0.85);
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10.5px;
}

/* Confirmation modal. Inherits .modal-backdrop/.modal-card; adds batch copy. */
.batch-confirm .modal-body { padding: 22px 24px 18px; }
.batch-confirm-lede {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fg-2);
  margin: 0 0 18px;
}
.batch-confirm-lede b {
  color: var(--knowledgeable-blue);
  font-weight: 700;
}
.batch-confirm-cost {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fafbfc;
  margin-bottom: 16px;
}
.batch-confirm-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.05px;
}
.batch-confirm-row + .batch-confirm-row { border-top: 1px dashed var(--border); }
.batch-confirm-total {
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid var(--border) !important;
  font-size: 13.5px;
  color: var(--knowledgeable-blue);
  border-style: solid !important;
}
.batch-confirm-total b { font-size: 15px; }
.batch-confirm-note {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--fg-3);
  margin: 0;
}

/* Queue status color overrides for new states. Reuse existing tokens. */
.queue-status.uploading,
.queue-status.submitted,
.queue-status.batch_pending {
  background: rgba(29,50,66,0.08);
  color: var(--knowledgeable-blue);
  border: 1px solid rgba(29,50,66,0.12);
}
.queue-status.uploading::before,
.queue-status.submitted::before,
.queue-status.batch_pending::before {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--victory-red);
  margin-right: 6px;
  vertical-align: 1px;
  animation: batchPulse 1.6s var(--ease-smooth) infinite;
}

@media (max-width: 720px) {
  .batch-banner-inner { grid-template-columns: 1fr; gap: 8px; padding: 10px 18px; }
  .batch-banner-id { display: none; }
}
