/* OUP Translation Platform — premium workflow demo */

:root {
  --oup-navy: #011e41;
  --oup-navy-light: #02305f;
  --oup-navy-deep: #000f24;
  --oup-accent: #fd5821;
  --oup-accent-hover: #e04812;
  --oup-accent-glow: rgba(253, 88, 33, 0.35);
  --oup-tertiary: #c8dc00;
  --oup-cream: #f4f4f4;
  --bg-primary: #ffffff;
  --bg-secondary: #eef2f7;
  --bg-subtle: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-default: #e2e8f0;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --info: #2563eb;
  --info-bg: #eff6ff;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(1, 30, 65, 0.07);
  --shadow-lg: 0 20px 50px rgba(1, 30, 65, 0.14);
  --shadow-glow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 24px 48px rgba(1, 30, 65, 0.18);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── Inline stroke line icons (icons.js) ── */
.line-icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.icon-inline-left {
  margin-right: 0.35rem;
}

.icon-inline-right {
  margin-left: 0.35rem;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text-primary);
  background: linear-gradient(165deg, #eef2f7 0%, #e8edf4 40%, #f8fafc 100%);
}

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Floating info panel (dismiss until reload) ── */
.info-float-panel {
  position: fixed;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  width: min(calc(100vw - 1.5rem), 1280px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.info-float-panel.is-dismissed {
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-10px);
  pointer-events: none;
}

.info-float-panel-inner {
  position: relative;
  background: linear-gradient(90deg, var(--oup-navy-deep), var(--oup-navy));
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.72rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.35);
  padding: 0.65rem 2.35rem 0.65rem 1rem;
  animation: infoFloatIn 0.35s ease;
}

@keyframes infoFloatIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.info-float-close {
  position: absolute;
  top: 0.35rem;
  right: 0.45rem;
  width: 1.65rem;
  height: 1.65rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.info-float-close:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.info-float-panel .info-bar-inner {
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
}

.info-float-panel .info-bar-inner span { display: inline-flex; align-items: center; gap: 0.35rem; }
.info-float-panel .sep { opacity: 0.35; }
.info-float-panel strong { color: var(--oup-tertiary); font-weight: 600; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Top info bar (legacy) ── */
.info-bar {
  background: linear-gradient(90deg, var(--oup-navy-deep), var(--oup-navy));
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.72rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.info-bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.55rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
}

.info-bar-inner span { display: inline-flex; align-items: center; gap: 0.35rem; }
.info-bar .sep { opacity: 0.35; }
.info-bar strong { color: var(--oup-tertiary); font-weight: 600; }

/* ── Header ── */
.app-header {
  background: linear-gradient(135deg, var(--oup-navy) 0%, var(--oup-navy-light) 100%);
  color: #fff;
  padding: 0 1.5rem;
  position: relative;
  overflow: hidden;
}

.app-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 120% at 100% 0%, rgba(253, 88, 33, 0.12), transparent 55%);
  pointer-events: none;
}

.app-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.35rem 0 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.brand-block h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-block .tagline {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.78);
  max-width: 36rem;
  line-height: 1.45;
}

.badge-demo {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(253, 88, 33, 0.45);
  color: #ffc9ad;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  backdrop-filter: blur(8px);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn-header-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-header-link:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.55);
}

button.btn-header-link {
  cursor: pointer;
  font-family: inherit;
}

/* ── Floating lock screen control (after sign-in) ── */
.access-lock-float {
  position: fixed;
  top: 0.9rem;
  left: 1rem;
  z-index: 1100;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem 0.55rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(135deg, var(--oup-navy), var(--oup-navy-light));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(1, 30, 65, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.access-lock-float:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(1, 30, 65, 0.42);
  filter: brightness(1.04);
}

.access-lock-float .line-icon {
  width: 0.95rem;
  height: 0.95rem;
}

@media (max-width: 640px) {
  .access-lock-float {
    top: auto;
    bottom: 5.5rem;
    left: 1rem;
    padding: 0.65rem 0.85rem;
  }

  .access-lock-label {
    font-size: 0.72rem;
  }
}

/* ── E2E workflow rail (10 steps) ── */
.workflow-rail-wrap {
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border-bottom: 2px solid var(--border-default);
  box-shadow: 0 6px 28px rgba(1, 30, 65, 0.08);
}

.workflow-rail-head {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.5rem 0.4rem;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--oup-accent);
}

.workflow-rail {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem 1.35rem;
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.wf-step {
  flex: 1;
  min-width: 108px;
  text-align: center;
  position: relative;
  padding: 0.15rem 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
  transition: background 0.25s ease;
}

.wf-step::after {
  content: "";
  position: absolute;
  top: 1.15rem;
  left: 55%;
  width: calc(100% - 10px);
  height: 3px;
  background: var(--border-default);
  z-index: 0;
  border-radius: 999px;
}

.wf-step:last-child::after { display: none; }

.wf-dot {
  width: 2.1rem;
  height: 2.1rem;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 2px solid var(--border-default);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  transition: all 0.35s ease;
}

.wf-label {
  margin-top: 0.55rem;
  font-size: 0.72rem;
  line-height: 1.32;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0 0.2rem;
  transition: color 0.25s ease, font-weight 0.25s ease, font-size 0.25s ease;
}

.wf-step.active {
  background: linear-gradient(180deg, rgba(255, 107, 53, 0.06) 0%, rgba(255, 255, 255, 0) 100%);
}

.wf-step.active .wf-dot {
  width: 2.45rem;
  height: 2.45rem;
  font-size: 0.92rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--oup-accent), #ff7a45);
  border-color: var(--oup-accent);
  color: #fff;
  box-shadow: 0 0 0 5px var(--oup-accent-glow), 0 6px 18px rgba(255, 107, 53, 0.35);
  transform: scale(1.08);
}

.wf-step.active .wf-label {
  color: var(--oup-navy);
  font-weight: 800;
  font-size: 0.8rem;
}

.wf-step.done .wf-dot {
  width: 1.9rem;
  height: 1.9rem;
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.wf-step.done .wf-label {
  color: var(--success);
  font-weight: 600;
}

.wf-step.done::after { background: var(--success); opacity: 0.55; }

/* ── UI stepper ── */
.stepper-wrap {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--border-default);
  box-shadow: 0 6px 24px rgba(1, 30, 65, 0.07);
  position: sticky;
  top: 0;
  z-index: 30;
}

.stepper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.5rem 1.2rem;
  display: flex;
  gap: 0.65rem;
}

.step-pill {
  flex: 1;
  min-width: 148px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.9rem 1.05rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-default);
  background: rgba(248, 250, 252, 0.95);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  transition: all 0.25s ease;
}

.step-pill .num {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: #fff;
  border: 1px solid var(--border-default);
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.step-pill.active {
  background: linear-gradient(180deg, #fff 0%, #fff9f6 100%);
  border: 2px solid var(--oup-accent);
  color: var(--oup-navy);
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 32px rgba(255, 107, 53, 0.2), 0 0 0 1px rgba(255, 107, 53, 0.1);
  transform: translateY(-2px);
}

.step-pill.active .num {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.92rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--oup-accent), #ff7a45);
  border: none;
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 107, 53, 0.42);
}

.step-pill.done {
  background: rgba(240, 253, 244, 0.85);
  border-color: #bbf7d0;
  color: #15803d;
  font-weight: 600;
}

.step-pill.done .num {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

@media (max-width: 900px) {
  .stepper {
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 1rem;
  }

  .step-pill {
    flex: 0 0 auto;
    min-width: 132px;
  }

  .step-pill.active {
    min-width: 148px;
  }

  .wf-step {
    min-width: 96px;
  }

  .wf-step.active .wf-label {
    font-size: 0.74rem;
  }
}

/* ── Demo control dock (collapsed floating button, expands on click) ── */
.demo-dock {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 100;
  display: flex;
  align-items: stretch;
  max-width: min(22rem, calc(100vw - 2.5rem));
  filter: drop-shadow(0 10px 28px rgba(1, 30, 65, 0.28));
}

.demo-dock-toggle {
  flex-shrink: 0;
  width: 2.85rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(1, 30, 65, 0.94);
  backdrop-filter: blur(16px);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font: inherit;
  transition: border-radius 0.22s ease, background 0.22s ease, transform 0.1s ease;
}

.demo-dock-toggle:active { transform: scale(0.96); }

.demo-dock-toggle-icon {
  font-size: 0.82rem;
  line-height: 1;
}

.demo-dock-label {
  display: none;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.demo-dock.open .demo-dock-toggle {
  border-radius: 999px 0 0 999px;
  border-right: none;
}

.demo-dock.running .demo-dock-toggle {
  background: linear-gradient(160deg, rgba(1, 30, 65, 0.98), rgba(253, 88, 33, 0.35));
  box-shadow: 0 0 0 3px rgba(253, 88, 33, 0.18);
}

.demo-controls {
  display: none;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.55rem 0.4rem 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: none;
  border-radius: 0 999px 999px 0;
  background: rgba(1, 30, 65, 0.94);
  backdrop-filter: blur(16px);
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  pointer-events: none;
  transition: max-width 0.28s ease, opacity 0.22s ease, padding 0.22s ease;
}

.demo-dock.open .demo-controls {
  display: flex;
  max-width: 18rem;
  opacity: 1;
  pointer-events: auto;
  padding: 0.4rem 0.65rem 0.4rem 0.35rem;
}

.demo-controls .ctrl-label {
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.55);
  padding: 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.demo-controls .btn-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  border: none;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s, opacity 0.2s;
}

.demo-controls .btn-ctrl:active { transform: scale(0.96); }
.demo-controls .btn-play { background: var(--oup-accent); color: #fff; }
.demo-controls .btn-pause { background: #fff; color: var(--oup-navy); }
.demo-controls .btn-pause.hidden,
.demo-controls .btn-play.hidden { display: none; }

.demo-dock-minimize {
  width: 1.65rem;
  height: 1.65rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.demo-dock-minimize:hover { background: rgba(255, 255, 255, 0.14); }

.demo-status {
  font-size: 0.68rem;
  color: var(--oup-tertiary);
  padding: 0 0.25rem;
  min-width: 3.5rem;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .demo-dock { left: 0.75rem; bottom: 0.75rem; }
  .demo-controls .ctrl-label { display: none; }
}

/* ── Guided tour callouts (guided demo only) ── */
.demo-callout-layer {
  position: fixed;
  inset: 0;
  z-index: 220;
  pointer-events: none;
}

.demo-callout-layer:not(.hidden) {
  pointer-events: auto;
}

.demo-callout-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 30, 65, 0.28);
  backdrop-filter: blur(1px);
}

.demo-callout {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(28rem, calc(100vw - 2rem));
  padding: 1.25rem 1.35rem 1.15rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(253, 88, 33, 0.22);
  background: linear-gradient(160deg, #fff, #fffaf7);
  box-shadow: 0 18px 50px rgba(1, 30, 65, 0.22);
  z-index: 2;
}

.demo-callout-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 1.85rem;
  height: 1.85rem;
  border: none;
  border-radius: 50%;
  background: rgba(1, 30, 65, 0.06);
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}

.demo-callout-close .line-icon {
  width: 1rem;
  height: 1rem;
}

.demo-callout-close:hover {
  background: rgba(1, 30, 65, 0.1);
  color: var(--oup-navy);
}

.demo-callout-centered {
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
}

.demo-callout-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--oup-accent);
}

.demo-callout-title {
  margin: 0 0 0.55rem;
  font-size: 1.35rem;
  line-height: 1.3;
  color: var(--oup-navy);
}

.demo-callout-body {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.demo-callout-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.demo-callout-next {
  width: 100%;
  padding: 0.72rem 0.95rem;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--oup-accent), #ff7a45);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.demo-callout-exit {
  width: 100%;
  padding: 0.5rem 0.85rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.demo-callout-exit:hover { color: var(--oup-navy); }

.demo-callout-next:active { transform: scale(0.98); }

.demo-callout-arrow {
  position: fixed;
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 11px solid #fff;
  filter: drop-shadow(0 -2px 2px rgba(1, 30, 65, 0.08));
  z-index: 1;
  pointer-events: none;
}

.demo-callout-layer.hidden {
  display: none;
}

/* ── Main ── */
.app-main {
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 2.5rem;
  width: 100%;
}

.panel { display: none; animation: panelIn 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
.panel.active { display: block; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-head { margin-bottom: 1.35rem; }

.panel-head h2 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--oup-navy);
  letter-spacing: -0.03em;
}

.panel-head p {
  margin: 0.4rem 0 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 52rem;
  line-height: 1.55;
}

.card {
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.card + .card { margin-top: 1.1rem; }

.card-title {
  margin: 0 0 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--oup-accent);
}

.card-glass {
  background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(248,250,252,0.9));
  backdrop-filter: blur(12px);
}

/* Progress master */
.progress-master { margin-bottom: 1.25rem; }

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.progress-header strong { font-size: 0.88rem; color: var(--oup-navy); }
.progress-header span { font-size: 0.78rem; color: var(--text-muted); }

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--oup-navy-light), var(--oup-accent));
  transition: width 0.35s ease;
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: shimmer 1.8s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-fill.done { background: linear-gradient(90deg, var(--success), #22c55e); }
.progress-fill.done::after { animation: none; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0;
}

@media (max-width: 768px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, var(--bg-subtle), #fff);
  border: 1px solid var(--border-default);
  text-align: center;
}

.stat-card .val {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--oup-navy);
  font-variant-numeric: tabular-nums;
}

.stat-card .lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Drop zone */
.dropzone {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #fafbfc, var(--bg-subtle));
  padding: 2.25rem 1.5rem;
  text-align: center;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
}

.dropzone.dropzone-empty {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(165deg, #fff7ed 0%, #ffedd5 42%, #fff 100%);
  border: 2px dashed #f97316;
  box-shadow: 0 0 0 5px rgba(249, 115, 22, 0.12), 0 12px 36px rgba(249, 115, 22, 0.14);
  animation: dropzonePulse 2.8s ease-in-out infinite;
}

.dropzone.dropzone-empty h3 {
  color: #9a3412;
  font-size: 1.12rem;
}

.dropzone.dropzone-empty p {
  color: #c2410c;
  max-width: 28rem;
}

.dropzone.dropzone-empty p strong {
  color: #9a3412;
}

.dropzone.dropzone-empty .dropzone-icon {
  background: linear-gradient(135deg, #ea580c, #fb923c);
  box-shadow: 0 10px 28px rgba(234, 88, 12, 0.38);
  animation: dropzoneIconBounce 2.8s ease-in-out infinite;
}

.dropzone.dropzone-empty .ft-tag {
  background: rgba(234, 88, 12, 0.12);
  color: #9a3412;
  border: 1px solid rgba(249, 115, 22, 0.25);
}

@keyframes dropzonePulse {
  0%, 100% { box-shadow: 0 0 0 5px rgba(249, 115, 22, 0.12), 0 12px 36px rgba(249, 115, 22, 0.14); }
  50% { box-shadow: 0 0 0 9px rgba(249, 115, 22, 0.18), 0 16px 42px rgba(249, 115, 22, 0.2); }
}

@keyframes dropzoneIconBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.dropzone.dropzone-has-files {
  min-height: auto;
  padding: 1.15rem 1.25rem;
  padding-top: 3.5rem;
  background: linear-gradient(180deg, #fff, #f8fafc);
  border: 1px dashed #cbd5e1;
  box-shadow: none;
  animation: none;
}

.dropzone-upload-badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
  max-width: min(17rem, 60%);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #eff6ff 0%, #fff 100%);
  border: 1px solid #93c5fd;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.14);
  text-align: right;
  pointer-events: none;
}

.dropzone-upload-badge.hidden { display: none; }

.dropzone-badge-total {
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
  color: #1d4ed8;
  line-height: 1.2;
}

.dropzone-badge-count {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #2563eb;
  line-height: 1.3;
}

.dropzone-badge-containers {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #3b82f6;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dropzone-badge-types {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.67rem;
  font-weight: 600;
  color: #1e40af;
  line-height: 1.4;
}

.dropzone-badge-selection {
  margin-top: 0.25rem;
  font-size: 0.64rem;
  color: #64748b;
  line-height: 1.35;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dropzone.dropzone-has-files h3 {
  font-size: 0.92rem;
  color: var(--oup-navy);
}

.dropzone.dropzone-has-files p {
  font-size: 0.78rem;
}

.dropzone.dropzone-has-files .dropzone-icon {
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.55rem;
  font-size: 1.1rem;
  animation: none;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--oup-accent);
  background: linear-gradient(180deg, #fff7f3, #fff);
  box-shadow: 0 0 0 4px rgba(253, 88, 33, 0.08);
}

.dropzone.dropzone-empty:hover,
.dropzone.dropzone-empty.dragover {
  border-color: #ea580c;
  background: linear-gradient(165deg, #ffedd5 0%, #fed7aa 50%, #fff 100%);
  box-shadow: 0 0 0 8px rgba(249, 115, 22, 0.2), 0 16px 40px rgba(234, 88, 12, 0.22);
}

.dropzone-icon {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 0.85rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--oup-navy), var(--oup-navy-light));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  box-shadow: 0 8px 24px rgba(1, 30, 65, 0.25);
}

.dropzone-icon .line-icon {
  width: 1.45rem;
  height: 1.45rem;
}

.dropzone h3 { margin: 0; font-size: 1.05rem; color: var(--oup-navy); font-weight: 600; }
.dropzone p { margin: 0.4rem 0 0; font-size: 0.82rem; color: var(--text-muted); }

.file-types-note {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1rem;
}

.ft-tag {
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(1, 30, 65, 0.06);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--oup-navy-light);
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.1rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: var(--info-bg);
  border: 1px solid #93c5fd;
  color: var(--info);
  font-size: 0.82rem;
  font-weight: 600;
}

.file-chip.hidden { display: none; }

.upload-inventory {
  margin-top: 1rem;
  text-align: left;
  width: 100%;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border-default);
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.upload-inventory.hidden { display: none; }

.upload-inventory-summary {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--oup-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.upload-inventory-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.upload-item + .upload-item { margin-top: 0.35rem; }

.upload-item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.upload-item-name {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
}

.seg-btn .seg-status-icon {
  width: 0.85rem;
  height: 0.85rem;
  margin-left: 0.35rem;
}

.upload-item-icon {
  flex-shrink: 0;
  width: 0.95rem;
  height: 0.95rem;
  color: var(--oup-navy-light);
}

.upload-item-size {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #2563eb;
  white-space: nowrap;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.upload-item-file .upload-item-name {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.upload-item-children {
  margin: 0.3rem 0 0.15rem 0.85rem;
  padding: 0 0 0 0.75rem;
  list-style: none;
  border-left: 2px solid rgba(1, 30, 65, 0.1);
}

.zip-contents {
  margin-top: 1rem;
  text-align: left;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border-default);
  font-size: 0.78rem;
}

.zip-contents.hidden { display: none; }
.zip-contents h4 { margin: 0 0 0.5rem; font-size: 0.72rem; color: var(--oup-accent); text-transform: uppercase; letter-spacing: 0.06em; }
.zip-contents ul { margin: 0; padding-left: 1.1rem; color: var(--text-secondary); }
.zip-contents li { margin: 0.2rem 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field > label[for] {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.field-head label[for] {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.field {
  position: relative;
}

.field-help-wrap {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}

.field-help {
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: linear-gradient(135deg, var(--oup-navy), var(--oup-navy-light));
  color: #fff;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(1, 30, 65, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field-help .line-icon {
  width: 0.72rem;
  height: 0.72rem;
}

.field-help:hover,
.field-help[aria-expanded="true"] {
  background: linear-gradient(135deg, var(--oup-accent), #ff6b35);
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(253, 88, 33, 0.35);
}

.field-help-popover {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  width: min(17.5rem, calc(100vw - 2rem));
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border-default);
  box-shadow: 0 14px 40px rgba(1, 30, 65, 0.16);
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
}

.field-help-popover.open {
  display: block;
  animation: fieldHelpIn 0.2s ease;
}

.field-help-popover::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #fff;
  border-left: 1px solid var(--border-default);
  border-top: 1px solid var(--border-default);
}

.field-help-popover strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--oup-navy);
  margin-bottom: 0.35rem;
  line-height: 1.35;
}

.field-help-popover p {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.5;
}

@keyframes fieldHelpIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 640px) {
  .field-help-popover {
    left: auto;
    right: -0.5rem;
    transform: none;
  }

  .field-help-popover::before {
    left: auto;
    right: 1rem;
    transform: rotate(45deg);
  }

  @keyframes fieldHelpIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.auto-detect-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.auto-detect-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.auto-detect-ui {
  width: 2rem;
  height: 1.15rem;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  transition: background 0.2s ease;
}

.auto-detect-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.auto-detect-toggle input:checked + .auto-detect-ui {
  background: linear-gradient(135deg, var(--oup-accent), #ff7a45);
}

.auto-detect-toggle input:checked + .auto-detect-ui::after {
  transform: translateX(0.85rem);
}

.auto-detect-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--oup-navy);
  text-transform: none;
  letter-spacing: 0;
}

.auto-detect-hint {
  margin: 0.4rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: #0d9488;
  font-weight: 500;
}

.auto-detect-hint.hidden { display: none; }

.field.field-auto input,
.field.field-auto select {
  background: #f8fafc;
  border-color: rgba(13, 148, 136, 0.28);
  color: var(--oup-navy);
}

.field input, .field select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--oup-navy);
  box-shadow: 0 0 0 3px rgba(1, 30, 65, 0.12);
}

.field.full { grid-column: 1 / -1; }

.doc-types-hint {
  margin-top: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Pipeline */
.pipeline { display: flex; flex-direction: column; gap: 0.55rem; }

.pipeline-item {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: #fff;
  overflow: hidden;
  transition: border-color 0.4s ease, background 0.4s ease, box-shadow 0.4s ease;
}

.pipeline-item-body {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.1rem 0.8rem;
}

.pipeline-item.running {
  border-color: #93c5fd;
  background: linear-gradient(180deg, var(--info-bg), #fff);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.1);
}

.pipeline-item.done {
  border-color: #86efac;
  background: var(--success-bg);
}

.pipeline-item .status-dot {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--bg-subtle);
  border: 2px solid var(--border-default);
  flex-shrink: 0;
}

.pipeline-item.running .status-dot {
  border-color: var(--info);
  animation: pulseRing 1.2s ease infinite;
}

@keyframes pulseRing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0); }
}

.pipeline-item.done .status-dot {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.pipeline-item.done .status-dot .line-icon {
  width: 1rem;
  height: 1rem;
}

.pipeline-item .pi-text { flex: 1; min-width: 0; }
.pipeline-item .pi-text strong { display: block; font-size: 0.92rem; color: var(--oup-navy); }
.pipeline-item .pi-text span { display: block; font-size: 0.78rem; color: var(--text-muted); }

.pipeline-item .mini-bar {
  width: 100%;
  height: 5px;
  border-radius: 0;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
  flex-shrink: 0;
}

.pipeline-item .mini-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--oup-accent), #fb923c);
  transition: width 0.3s linear;
}

.pipeline-item.running .mini-bar {
  background: rgba(253, 88, 33, 0.12);
}

.pipeline-item.done .mini-bar {
  background: rgba(34, 197, 94, 0.15);
}

.pipeline-item.done .mini-bar-fill {
  width: 100% !important;
  background: linear-gradient(90deg, var(--success), #22c55e);
}

.log-panel {
  margin-top: 1.1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  background: #0a1628;
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  max-height: 180px;
  overflow-y: auto;
  line-height: 1.65;
  border: 1px solid rgba(255,255,255,0.06);
}

.log-panel .log-ok { color: #86efac; }
.log-panel .log-warn { color: #fcd34d; }
.log-panel .log-info { color: #93c5fd; }

.log-line.log-progress .log-dots {
  display: inline-block;
  min-width: 1.4em;
  color: var(--oup-accent, #fd5821);
  letter-spacing: 0.12em;
}

.log-detail {
  margin: 0.15rem 0 0.85rem 0.15rem;
  padding-left: 0.75rem;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-size: 0.68rem;
  line-height: 1.6;
}

.log-panel .log-detail.log-ok { color: #86efac; opacity: 0.92; }
.log-panel .log-detail.log-info { color: #93c5fd; opacity: 0.92; }
.log-panel .log-detail.log-warn { color: #fcd34d; opacity: 0.92; }

.security-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex: 1;
}

.sec-pill {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #eef4ff, #f8fafc);
  border: 1px solid rgba(1, 30, 65, 0.12);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--oup-navy);
}

.qa-intro {
  margin: -0.15rem 0 1rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.context-pack-section {
  margin-bottom: 1.75rem;
  padding: 1.35rem 1.4rem 1.45rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 55%, #faf5ff 100%);
  border: 1px solid #c7d2fe;
  box-shadow: 0 10px 36px rgba(99, 102, 241, 0.1);
}

.card-title-context {
  color: #4338ca;
  font-size: 0.78rem;
  margin-bottom: 0.4rem;
}

.context-pack-intro {
  margin: 0 0 1.2rem;
  font-size: 0.84rem;
  color: #4f46e5;
  line-height: 1.5;
  max-width: 42rem;
}

.qa-section {
  padding-top: 1.65rem;
  border-top: 2px dashed #cbd5e1;
}

.card-title-qa {
  color: var(--oup-navy);
  font-size: 0.76rem;
  margin-bottom: 0.35rem;
}

.qa-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (max-width: 768px) { .qa-check-grid { grid-template-columns: 1fr; } }

.qa-check {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: #f8fafc;
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.35s ease;
}

.qa-check.visible { opacity: 1; transform: translateY(0); }
.qa-check.hidden { display: none; }
.qa-check.qa-ok { border-color: #86efac; background: var(--success-bg, #f0fdf4); }
.qa-check.qa-warn { border-color: #fcd34d; background: #fffbeb; }

.qa-check-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.25rem;
}

.qa-icon {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--bg-subtle);
}

.qa-check.qa-ok .qa-icon { background: #86efac; color: #14532d; }
.qa-check.qa-warn .qa-icon { background: #fcd34d; color: #713f12; }

.qa-check-head strong { font-size: 0.8rem; color: var(--oup-navy); }
.qa-result { font-size: 0.74rem; color: var(--text-secondary); }

.qa-recap-card { margin-bottom: 1rem; }

.qa-recap {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (max-width: 900px) { .qa-recap { grid-template-columns: repeat(2, 1fr); } }

.qa-recap-item {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  font-size: 0.74rem;
  background: #fff;
}

.qa-recap-item.qa-ok strong { color: #15803d; }
.qa-recap-item.qa-warn strong { color: #b45309; }

.mqm-grid { display: grid; gap: 0.55rem; margin-bottom: 0.85rem; }

.mqm-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: #fff;
}

.mqm-label strong { display: block; font-size: 0.8rem; color: var(--oup-navy); }
.mqm-label span { display: block; font-size: 0.68rem; color: var(--text-muted); margin-top: 0.1rem; }

.mqm-actions { display: flex; gap: 0.35rem; }

.mqm-btn {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-secondary);
}

.mqm-btn.active.mqm-pass { background: var(--success-bg, #f0fdf4); border-color: #86efac; color: #15803d; }
.mqm-btn.active.mqm-flag { background: #fff7ed; border-color: #fdba74; color: #c2410c; }
.mqm-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.compact-confidence { margin-top: 0.35rem; }

/* ── Split ingestion layout (index2) ── */
.layout-split-ingest {
  --ingest-panel-height: 660px;
}

.layout-split-ingest .ingest-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1rem;
  align-items: start;
}

.layout-split-ingest .ingest-split > .card + .card {
  margin-top: 0;
}

.layout-split-ingest .ingest-progress-card,
.layout-split-ingest .ingest-terminal-card {
  height: var(--ingest-panel-height);
  max-height: var(--ingest-panel-height);
  min-width: 0;
  overflow: hidden;
}

.layout-split-ingest .ingest-progress-card {
  display: flex;
  flex-direction: column;
}

.layout-split-ingest .ingest-progress-card .progress-master,
.layout-split-ingest .ingest-progress-card > .stats-grid,
.layout-split-ingest .ingest-progress-card > .card-title {
  flex-shrink: 0;
}

.layout-split-ingest .ingest-progress-card > .pipeline {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.2rem;
}

.layout-split-ingest .ingest-terminal-card {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.layout-split-ingest .terminal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-default);
  background: linear-gradient(180deg, #fff, var(--bg-subtle));
  flex-shrink: 0;
}

.layout-split-ingest .terminal-head strong {
  font-size: 0.82rem;
  color: var(--oup-navy);
}

.layout-split-ingest .terminal-head span {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.throughput-panel {
  display: none;
  padding: 1rem 1.1rem;
  background: #fff;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.throughput-panel.active { display: block; }

.throughput-panel.active.throughput-panel-settled {
  background: linear-gradient(180deg, #fff, var(--bg-subtle));
}

.throughput-panel-inline {
  margin-top: 1rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border-default);
}

.throughput-kicker {
  margin: 0 0 0.65rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.throughput-stats {
  margin: 0 0 0.75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .throughput-stats { grid-template-columns: repeat(2, 1fr); }
}

.stat-card-hero {
  border-color: rgba(253, 88, 33, 0.28);
  background: linear-gradient(160deg, #fff7f3, #fff);
}

.stat-card-hero .val-accent {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--oup-accent);
}

.throughput-bulk {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--oup-navy);
  line-height: 1.5;
}

.throughput-eta {
  margin: 0;
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.throughput-thread-bar {
  margin: 0 0 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}

.throughput-thread-label {
  margin: 0 0 0.5rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.throughput-threads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.thread-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  padding: 0.22rem 0.45rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.thread-pill.active {
  color: #fff;
  background: linear-gradient(160deg, var(--oup-accent), #e04a12);
  border-color: rgba(253, 88, 33, 0.35);
  box-shadow: 0 0 0 2px rgba(253, 88, 33, 0.12);
  animation: threadPulse 1.8s ease-in-out infinite;
}

.thread-pill.spare {
  color: var(--text-muted);
  background: #fff;
  border-color: var(--border-default);
  border-style: dashed;
}

.throughput-thread-note {
  margin: 0.55rem 0 0;
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

@keyframes threadPulse {
  0%, 100% { opacity: 1; transform: translateY(0); }
  50% { opacity: 0.82; transform: translateY(-1px); }
}

.layout-split-ingest .terminal-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #16a34a !important;
}

.layout-split-ingest .terminal-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
  animation: terminalPulse 1.6s ease-in-out infinite;
}

@keyframes terminalPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.layout-split-ingest .log-panel-side {
  margin-top: 0;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: scroll;
  overflow-x: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
  border-radius: 0;
  border: none;
  padding: 1rem 1.15rem 1.25rem;
  font-size: 0.72rem;
  scroll-behavior: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.55) rgba(255, 255, 255, 0.06);
}

.layout-split-ingest .log-panel-side::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.layout-split-ingest .log-panel-side::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}

.layout-split-ingest .log-panel-side::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  border: 2px solid #0a1628;
}

.layout-split-ingest .log-panel-side::-webkit-scrollbar-corner {
  background: #0a1628;
}

.layout-split-ingest .log-panel-side .log-line {
  color: #e2e8f0;
  font-weight: 600;
}

.layout-split-ingest .log-panel-side .log-detail {
  margin: 0.15rem 0 0.95rem 0.15rem;
  padding-left: 0.75rem;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-size: 0.68rem;
  line-height: 1.6;
  font-weight: 400;
}

.layout-split-ingest .log-panel-side .log-detail.log-ok { color: #86efac; opacity: 0.92; }
.layout-split-ingest .log-panel-side .log-detail.log-info { color: #93c5fd; opacity: 0.92; }
.layout-split-ingest .log-panel-side .log-detail.log-warn { color: #fcd34d; opacity: 0.92; }

/* ── Split translation layout ── */
.translate-split {
  --translate-panel-height: 660px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.translate-split > .card + .card {
  margin-top: 0;
}

.translate-ops-card,
.translate-terminal-card {
  height: var(--translate-panel-height);
  max-height: var(--translate-panel-height);
  min-width: 0;
  overflow: hidden;
}

.translate-ops-card {
  display: flex;
  flex-direction: column;
}

.translate-ops-card .progress-master,
.translate-ops-card > .stats-grid,
.translate-ops-card > .card-title {
  flex-shrink: 0;
}

.translate-ops-card > .pipeline {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.2rem;
}

.translate-terminal-card {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.card-title-translate {
  color: #6366f1;
}

.progress-fill-translate {
  background: linear-gradient(90deg, #6366f1, #818cf8);
}

.progress-fill-translate.done {
  background: linear-gradient(90deg, #0891b2, #22d3ee);
}

.translate-stats .stat-card:nth-child(1) .val { color: #4f46e5; }
.translate-stats .stat-card:nth-child(2) .val { color: #0d9488; }
.translate-stats .stat-card:nth-child(3) .val { color: #7c3aed; }
.translate-stats .stat-card:nth-child(4) .val { color: #0284c7; }

.translate-pipeline .pipeline-item {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fff, #fafaff);
}

.translate-pipeline .pipeline-item-body {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.1rem 0.8rem;
}

.translate-pipeline .pipeline-item .mini-bar {
  width: 100%;
  height: 5px;
  border-radius: 0;
  background: rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
}

.translate-pipeline .pipeline-item.running {
  border-color: #a5b4fc;
  background: linear-gradient(180deg, #eef2ff, #fff);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.12);
}

.translate-pipeline .pipeline-item.running .status-dot {
  border-color: #6366f1;
  animation: pulseRingTranslate 1.2s ease infinite;
}

@keyframes pulseRingTranslate {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
}

.translate-pipeline .pipeline-item.done {
  border-color: #5eead4;
  background: linear-gradient(180deg, #f0fdfa, #fff);
}

.translate-pipeline .pipeline-item.done .status-dot {
  background: #0d9488;
  border-color: #0d9488;
}

.translate-pipeline .mini-bar-fill {
  background: linear-gradient(90deg, #6366f1, #818cf8);
}

.translate-pipeline .pipeline-item.running .mini-bar {
  background: rgba(99, 102, 241, 0.12);
}

.translate-pipeline .pipeline-item.done .mini-bar {
  background: rgba(13, 148, 136, 0.15);
}

.translate-pipeline .pipeline-item.done .mini-bar-fill {
  width: 100% !important;
  background: linear-gradient(90deg, #0d9488, #2dd4bf);
}

.terminal-head-translate {
  background: linear-gradient(180deg, #fff, #f5f3ff);
}

.terminal-status-translate {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #6366f1 !important;
}

.terminal-status-translate::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16);
}

.translate-terminal-card:has(#translate-terminal-status) .terminal-status-translate::before {
  animation: terminalPulseTranslate 1.6s ease-in-out infinite;
}

@keyframes terminalPulseTranslate {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.translate-job-panel {
  display: none;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-default);
  background: linear-gradient(180deg, #faf5ff, #fff);
  flex-shrink: 0;
}

.translate-job-panel.active { display: block; }

.throughput-panel-translate {
  background: linear-gradient(180deg, #faf5ff, #fff);
}

.throughput-panel-translate .throughput-kicker {
  color: #6366f1;
}

.val-accent-translate {
  color: #6366f1 !important;
}

.translate-throughput-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.translate-throughput-note {
  margin: 0.65rem 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.translate-job-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (max-width: 900px) {
  .translate-job-grid { grid-template-columns: 1fr; }
}

.translate-job-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.translate-job-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.translate-job-item strong {
  font-size: 0.72rem;
  color: var(--oup-navy);
  line-height: 1.35;
}

.log-panel-translate {
  margin-top: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
  border-radius: 0;
  border: none;
  padding: 1rem 1.15rem 1.25rem;
  font-size: 0.72rem;
  background: #111827;
  color: #94a3b8;
  scrollbar-width: thin;
  scrollbar-color: rgba(129, 140, 248, 0.45) rgba(255, 255, 255, 0.05);
}

.log-panel-translate .log-line { color: #e2e8f0; font-weight: 600; }
.log-panel-translate .log-detail {
  margin: 0.15rem 0 0.95rem 0.15rem;
  padding-left: 0.75rem;
  border-left: 2px solid rgba(129, 140, 248, 0.25);
  color: #94a3b8;
  font-size: 0.68rem;
  line-height: 1.6;
}
.log-panel-translate .log-detail.log-ok { color: #6ee7b7; opacity: 0.92; }
.log-panel-translate .log-detail.log-info { color: #a5b4fc; opacity: 0.92; }
.log-panel-translate .log-detail.log-warn { color: #fde68a; opacity: 0.92; }
.log-panel-translate .log-line.log-progress .log-dots { color: #818cf8; }

.translate-results-card {
  margin-top: 0;
}

@media (max-width: 980px) {
  .translate-split {
    grid-template-columns: 1fr;
    --translate-panel-height: auto;
  }

  .translate-ops-card,
  .translate-terminal-card {
    height: auto;
    max-height: none;
  }

  .translate-terminal-card {
    min-height: 380px;
  }

  .log-panel-translate {
    flex: none;
    min-height: 260px;
    max-height: 320px;
  }
}

@media (max-width: 980px) {
  .layout-split-ingest .ingest-split {
    grid-template-columns: 1fr;
  }

  .layout-split-ingest {
    --ingest-panel-height: auto;
  }

  .layout-split-ingest .ingest-progress-card,
  .layout-split-ingest .ingest-terminal-card {
    height: auto;
    max-height: none;
  }

  .layout-split-ingest .ingest-terminal-card {
    min-height: 420px;
  }

  .layout-split-ingest .log-panel-side {
    flex: none;
    min-height: 280px;
    max-height: 320px;
  }
}

.context-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem;
}

@media (max-width: 900px) { .context-grid { grid-template-columns: 1fr; } }

.snippet-card {
  position: relative;
  padding: 1.2rem 1.25rem 1.3rem;
  padding-top: 1.35rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.86rem;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.45s ease;
  min-height: 8.5rem;
}

.snippet-card.visible { opacity: 1; transform: translateY(0); }
.snippet-card.hidden { display: none; }

.snippet-icon {
  position: absolute;
  top: 0.85rem;
  right: 0.9rem;
  font-size: 1.15rem;
  opacity: 0.55;
}

.snippet-icon .line-icon {
  width: 1.15rem;
  height: 1.15rem;
}

.snippet-body {
  margin: 0.55rem 0 0;
  color: var(--text-primary);
  font-weight: 500;
}

.snippet-card .tag {
  display: inline-block;
  margin-bottom: 0;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  color: #fff;
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.snippet-card--style {
  background: linear-gradient(165deg, #fff 0%, #eef2ff 100%);
  border-color: #a5b4fc;
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.14);
}

.snippet-card--style .tag {
  background: linear-gradient(135deg, #6366f1, #818cf8);
}

.snippet-card--style .snippet-body { color: #312e81; }

.snippet-card--worksheet {
  background: linear-gradient(165deg, #fff 0%, #ecfdf5 100%);
  border-color: #5eead4;
  box-shadow: 0 6px 22px rgba(13, 148, 136, 0.12);
}

.snippet-card--worksheet .tag {
  background: linear-gradient(135deg, #0d9488, #14b8a6);
}

.snippet-card--worksheet .snippet-body { color: #134e4a; }

.snippet-card--glossary {
  background: linear-gradient(165deg, #fff 0%, #fefce8 100%);
  border-color: #fde047;
  box-shadow: 0 6px 22px rgba(202, 138, 4, 0.12);
}

.snippet-card--glossary .tag {
  background: linear-gradient(135deg, #ca8a04, #eab308);
  color: #422006;
}

.snippet-card--glossary .snippet-body {
  color: #713f12;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 600;
}

.glossary-term {
  background: rgba(200, 220, 0, 0.35);
  padding: 0 0.2rem;
  border-radius: 3px;
  font-weight: 600;
}

.draft-box {
  margin-top: 0.75rem;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--oup-accent);
  background: linear-gradient(90deg, #fff7f3, #fff);
  font-size: 1.05rem;
  color: var(--oup-navy);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.5s ease;
}

.draft-box.visible { opacity: 1; transform: translateY(0); }

.workbench {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 240px;
}

@media (max-width: 768px) { .workbench { grid-template-columns: 1fr; } }

.wb-col { padding: 1.25rem 1.35rem; }
.wb-col + .wb-col { border-left: 1px solid var(--border-default); background: linear-gradient(180deg, #fafbfc, #fff); }

.wb-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.wb-text { font-size: 1.05rem; line-height: 1.6; color: var(--text-primary); }

.segment-nav { display: flex; gap: 0.5rem; margin: 0 0 1rem; flex-wrap: wrap; }

.seg-btn {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.seg-btn.active { background: var(--oup-navy); border-color: var(--oup-navy); color: #fff; box-shadow: var(--shadow); }
.seg-btn.approved { background: var(--success-bg); border-color: #86efac; color: var(--success); }
.seg-btn.rejected { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--oup-accent), #ff6b35);
  color: #fff;
  box-shadow: 0 4px 14px var(--oup-accent-glow);
}

.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }

.btn-secondary { background: #fff; color: var(--oup-navy); border: 1px solid var(--border-default); }
.btn-navy { background: var(--oup-navy); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-success:hover:not(:disabled),
.btn-danger:hover:not(:disabled) { filter: brightness(1.03); }
.btn-success:disabled,
.btn-danger:disabled,
.btn-success.btn-muted-disabled:disabled,
.btn-danger.btn-muted-disabled:disabled {
  opacity: 1;
  background: #e5e7eb;
  color: #9ca3af;
  box-shadow: none;
  filter: none;
  border: 1px solid #d1d5db;
  cursor: not-allowed;
}

.review-action-hint {
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 0.8rem;
  line-height: 1.45;
}

.review-action-hint.hidden { display: none; }

.btn-ghost { background: transparent; color: var(--oup-navy); border: 1px dashed var(--border-default); }

.panel-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.75rem;
  flex-wrap: wrap;
}

.meta-strip { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

.meta-pill {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border-default);
  font-size: 0.75rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow);
}

.meta-pill strong { color: var(--oup-navy); }

.action-row { display: flex; gap: 0.65rem; flex-wrap: wrap; margin-top: 1.1rem; }

/* ── Linguist review: quality assessment & control loop ── */
.review-split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1rem;
  margin-top: 1rem;
}

.review-assessment-intro,
.review-loop-intro {
  margin: -0.35rem 0 1rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.quality-grid {
  display: grid;
  gap: 1rem;
}

.quality-field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--oup-navy);
}

.quality-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.quality-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--oup-accent);
}

.quality-max {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.1rem;
}

.quality-field input[type="range"] {
  width: 100%;
  accent-color: var(--oup-accent);
  cursor: pointer;
}

.quality-field input[type="range"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.quality-hint {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.review-assessment-card textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.82rem;
  resize: vertical;
  min-height: 64px;
}

.review-assessment-card textarea:disabled {
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.feedback-loop {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.loop-step {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: #fff;
  transition: all 0.35s ease;
}

.loop-step.active {
  border-color: rgba(253, 88, 33, 0.35);
  background: linear-gradient(90deg, #fff7f3, #fff);
  box-shadow: 0 4px 14px rgba(1, 30, 65, 0.06);
}

.loop-step.done {
  border-color: #86efac;
  background: var(--success-bg);
}

.loop-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--bg-subtle);
  color: var(--oup-navy);
}

.loop-step.active .loop-icon {
  background: var(--oup-accent);
  color: #fff;
}

.loop-step.done .loop-icon {
  background: var(--success);
  color: #fff;
}

.loop-body strong {
  display: block;
  font-size: 0.82rem;
  color: var(--oup-navy);
  margin-bottom: 0.2rem;
}

.loop-body span {
  display: block;
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.loop-summary {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px dashed var(--border-default);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.loop-summary.has-data {
  border-style: solid;
  border-color: rgba(253, 88, 33, 0.25);
  background: linear-gradient(90deg, #fff7f3, #fff);
  color: var(--oup-navy);
}

@media (max-width: 980px) {
  .review-split { grid-template-columns: 1fr; }
}

.success-banner {
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius);
  background: var(--success-bg);
  border: 1px solid #86efac;
  color: #166534;
}

.audit-list { margin: 0.75rem 0 0; padding-left: 1.1rem; font-size: 0.85rem; color: var(--text-secondary); }

.app-footer {
  border-top: 1px solid var(--border-default);
  background: #fff;
  padding: 1rem 1.5rem;
}

.app-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hidden { display: none !important; }

/* ── OUP Content Library page ── */
.library-page {
  background: var(--bg-subtle);
}

.library-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.library-banner {
  margin-bottom: 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: #ecfdf5;
  border: 1px solid #86efac;
  color: #166534;
  font-size: 0.88rem;
  line-height: 1.45;
}

.library-intro {
  margin-bottom: 0;
  padding: 1.35rem 1.4rem 1.15rem;
  background: linear-gradient(135deg, #ffffff 0%, #eef6ff 42%, #fff4eb 100%);
  border: 1px solid rgba(1, 30, 65, 0.1);
  box-shadow: var(--shadow);
}

.library-intro-copy {
  max-width: 52rem;
}

.library-intro-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--oup-accent);
}

.library-intro h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  color: var(--oup-navy);
}

.library-intro p {
  margin: 0 0 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.library-intro-points {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.library-intro .library-stats {
  margin: 1.05rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(1, 30, 65, 0.08);
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
}

.stat-card-lib {
  text-align: left;
  padding: 0.8rem 0.9rem;
  border: 1px solid transparent;
  box-shadow: 0 2px 10px rgba(1, 30, 65, 0.06);
}

.stat-card-lib .val {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-card-lib .lbl {
  margin-top: 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.stat-card-lib-titles {
  background: linear-gradient(160deg, #eef2ff, #fff);
  border-color: rgba(1, 30, 65, 0.12);
}

.stat-card-lib-chunks {
  background: linear-gradient(160deg, #ecfdf5, #fff);
  border-color: rgba(13, 148, 136, 0.18);
}

.stat-card-lib-vectors {
  background: linear-gradient(160deg, #eef2ff, #f5f3ff);
  border-color: rgba(99, 102, 241, 0.18);
}

.stat-card-lib-active {
  background: linear-gradient(160deg, #fff7ed, #fff);
  border-color: rgba(253, 88, 33, 0.22);
}

.stat-card-lib-reference {
  background: linear-gradient(160deg, #eff6ff, #fff);
  border-color: rgba(2, 132, 199, 0.18);
}

.library-stats .stat-card-lib-titles .val { color: var(--oup-navy); }
.library-stats .stat-card-lib-chunks .val { color: #0d9488; }
.library-stats .stat-card-lib-vectors .val { color: #6366f1; }
.library-stats .stat-card-lib-active .val { color: var(--oup-accent); }
.library-stats .stat-card-lib-reference .val { color: #0284c7; }

.library-toolbar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0;
}

.library-search-field input {
  width: 100%;
}

.library-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 1rem;
  align-items: start;
}

.library-list-intro,
.library-chunks-intro {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.library-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 620px;
  overflow-y: auto;
}

.library-row {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 0.85rem 0.95rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.library-row:hover {
  border-color: #93c5fd;
  box-shadow: var(--shadow);
}

.library-row.selected {
  border-color: var(--oup-accent);
  background: linear-gradient(180deg, #fff9f6, #fff);
  box-shadow: 0 8px 24px rgba(255, 107, 53, 0.12);
}

.library-row-main strong {
  display: block;
  font-size: 0.92rem;
  color: var(--oup-navy);
  line-height: 1.35;
}

.library-row-file {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  word-break: break-word;
}

.library-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.library-row-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.45rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.library-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.library-pill-active { background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; }
.library-pill-ref { background: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; }
.library-pill-indexed { background: #ecfdf5; color: #15803d; border: 1px solid #86efac; }
.library-pill-new { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

.library-detail-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.library-detail-title {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  color: var(--oup-navy);
}

.library-detail-file {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-word;
}

.library-detail-ingested {
  margin: 0.35rem 0 1rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.library-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1rem;
  margin-bottom: 1rem;
}

.library-detail-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.library-detail-grid strong {
  font-size: 0.84rem;
  color: var(--oup-navy);
  line-height: 1.35;
}

.library-detail-retrieval {
  margin: 0 0 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--info-bg);
  border: 1px solid #93c5fd;
  color: var(--info);
  font-size: 0.82rem;
  line-height: 1.45;
}

.card-title-sub {
  margin-top: 0.35rem;
  font-size: 0.78rem;
}

.library-pipeline {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.library-pipeline-step {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.library-pipeline-step.done {
  color: #15803d;
  font-weight: 600;
}

.library-pipeline-dot {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  background: #ecfdf5;
  border: 1px solid #86efac;
  flex-shrink: 0;
}

.library-pipeline-dot .line-icon {
  width: 0.75rem;
  height: 0.75rem;
}

.library-chunks-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.library-chunk-item {
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-subtle);
}

.library-chunk-item strong {
  display: block;
  font-size: 0.84rem;
  color: var(--oup-navy);
  margin-bottom: 0.2rem;
}

.library-chunk-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.library-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .library-toolbar {
    grid-template-columns: 1fr;
  }

  .library-intro .library-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-split {
    grid-template-columns: 1fr;
  }

  .library-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .library-intro .library-stats {
    grid-template-columns: 1fr;
  }
}

/* ── Secure access gate ── */
body.access-locked {
  overflow: hidden;
}

body.access-locked .info-float-panel {
  visibility: hidden;
  pointer-events: none;
}

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  pointer-events: auto;
}

.access-gate--closing {
  pointer-events: none !important;
  visibility: hidden;
  animation: accessGateOut 0.28s ease forwards;
}

@keyframes accessGateOut {
  to { opacity: 0; }
}

.access-gate-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 30, 65, 0.72);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.access-gate-card {
  position: relative;
  z-index: 1;
  width: min(100%, 28rem);
  padding: 2rem 1.75rem 1.65rem;
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 28px 80px rgba(1, 30, 65, 0.35);
  text-align: center;
  pointer-events: auto;
}

.access-gate-lock {
  width: 5.5rem;
  height: 5.5rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--oup-navy), var(--oup-navy-light));
  color: #fff;
  box-shadow: 0 16px 40px rgba(1, 30, 65, 0.28);
}

.access-gate-lock svg,
.access-gate-lock .line-icon {
  width: 2.35rem;
  height: 2.35rem;
}

.access-gate-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--oup-accent);
}

.access-gate-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
  color: var(--oup-navy);
}

.access-gate-intro {
  margin: 0 0 1.35rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.access-gate-field {
  text-align: left;
  margin-bottom: 1rem;
}

.access-gate-field label,
.access-gate-code-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
}

.access-gate-field input[type="text"][readonly] {
  width: 100%;
  background: #f1f5f9;
  color: var(--oup-navy);
  font-weight: 600;
}

.access-code-inputs {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
}

.access-code-digit {
  width: 2.85rem;
  height: 3.2rem;
  border-radius: 0.75rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.02em;
  color: var(--oup-navy);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.access-code-digit::placeholder {
  color: #cbd5e1;
}

.access-code-digit:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.access-code-digit--error {
  border-color: #ef4444;
  background: #fef2f2;
}

.access-gate-error {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #b91c1c;
  text-align: center;
}

.access-gate-submit {
  width: 100%;
  margin-top: 1.15rem;
}

.access-gate-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.access-gate-badges li {
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 0.64rem;
  font-weight: 700;
  color: #1d4ed8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
