/* ═══════════════════════════════════════════════════════════════════════════
   TranslatePDF — Enterprise design system
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --bg: #06080f;
  --bg-2: #0b0f18;
  --surface: #111827;
  --surface-2: #171f30;
  --surface-elevated: #1a2438;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #f1f5ff;
  --muted: #8b98b0;
  --accent: #5b8cff;
  --accent-2: #8b6cff;
  --accent-soft: rgba(91, 140, 255, 0.14);
  --accent-glow: rgba(91, 140, 255, 0.35);
  --success: #34d399;
  --danger: #fb7185;
  --warning: #fbbf24;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.35);
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --header-h: 60px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.32s;
  --focus: 0 0 0 3px rgba(91, 140, 255, 0.35);
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(1100px 520px at 8% -8%, rgba(91, 140, 255, 0.14), transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(139, 108, 255, 0.1), transparent 50%),
    var(--bg);
}

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 11.5px; }
.xs { font-size: 12px; }
.clip {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Motion ──────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .screen {
    animation: screenIn var(--dur) var(--ease) both;
  }
  .modal:not([hidden]) .modal-card {
    animation: modalIn 0.28s var(--ease) both;
  }
  .toast:not([hidden]) {
    animation: toastIn 0.25s var(--ease) both;
  }
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.xs { padding: 4px 8px; font-size: 11.5px; border-radius: 7px; }
.btn.lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; padding: 12px 16px; }

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 24px var(--accent-glow);
}
.btn.primary:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 10px 28px var(--accent-glow);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-arrow { opacity: 0.85; }

/* ── Fields ──────────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field select:not(.tool-input),
.field textarea {
  width: 100%;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(91, 140, 255, 0.55);
  box-shadow: var(--focus);
}
.form-error {
  color: var(--danger);
  font-size: 13px;
  margin: 10px 0 0;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card, .card-soft {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-soft { padding: 16px; margin-bottom: 18px; }

/* ── Landing ─────────────────────────────────────────────────────────────── */
.landing-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(6, 8, 15, 0.78);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.landing-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.landing-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.landing-links a:hover { color: var(--text); background: rgba(255,255,255,0.04); }

.landing-hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
  padding: 56px 28px 40px;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}
.landing-hero h1 {
  font-size: clamp(2rem, 4vw, 2.85rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 750;
  margin: 0 0 16px;
}
.lead {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 38rem;
  margin: 0 0 24px;
  line-height: 1.6;
}
.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(91, 140, 255, 0.22);
}
.landing-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}
.trust-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.trust-pills li {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.mock-window {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transform: perspective(1200px) rotateY(-4deg) rotateX(2deg);
}
.mock-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.mock-chrome span {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
}
.mock-chrome span:nth-child(1) { background: #fb7185; }
.mock-chrome span:nth-child(2) { background: #fbbf24; }
.mock-chrome span:nth-child(3) { background: #34d399; }
.mock-chrome em {
  margin-left: auto;
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}
.mock-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  min-height: 280px;
}
.mock-pane {
  background: var(--surface);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mock-pane.accent { background: linear-gradient(180deg, rgba(91,140,255,0.08), var(--surface)); }
.mock-line {
  height: 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
}
.mock-pane.accent .mock-line { background: rgba(91,140,255,0.22); }
.mock-line.w80 { width: 80%; }
.mock-line.w70 { width: 70%; }
.mock-line.w60 { width: 60%; }
.mock-line.w55 { width: 55%; }
.mock-line.w90 { width: 90%; }
.mock-line.w85 { width: 85%; }
.mock-line.w40 { width: 40%; }
.mock-line.w45 { width: 45%; }
.mock-card {
  margin-top: auto;
  height: 72px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}

.landing-section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 28px;
  width: 100%;
}
.landing-section.alt {
  background: rgba(255,255,255,0.015);
  border-block: 1px solid var(--border);
  max-width: none;
  padding-inline: max(28px, calc((100% - 1180px) / 2 + 28px));
}
.landing-section h2 {
  margin: 0 0 8px;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}
.section-lead {
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 36rem;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.2s, transform 0.2s;
}
.feature-card:hover {
  border-color: rgba(91, 140, 255, 0.35);
  transform: translateY(-2px);
}
.feature-icon {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 10px;
}
.feature-card h3 { margin: 0 0 8px; font-size: 0.98rem; }
.feature-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step;
}
.workflow-steps li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.workflow-steps strong { font-size: 0.95rem; }
.workflow-steps span { color: var(--muted); font-size: 13px; }

.security-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(91,140,255,0.12), rgba(139,108,255,0.08));
  border: 1px solid rgba(91,140,255,0.2);
}
.landing-footer {
  display: flex;
  justify-content: space-between;
  padding: 20px 28px 32px;
  color: var(--muted);
  font-size: 12.5px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ── App shell header ────────────────────────────────────────────────────── */
#app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
#app-shell[hidden] { display: none !important; }

.shell-header {
  height: var(--header-h);
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto minmax(200px, 1.4fr);
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 8, 15, 0.88);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
}
.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px var(--accent-glow);
  flex-shrink: 0;
}
.brand-title { font-weight: 700; font-size: 14px; letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; color: var(--muted); }
.brand-text { min-width: 0; }

.stepper { display: flex; align-items: center; gap: 6px; }
.step {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  opacity: 0.5;
  transition: opacity 0.2s, color 0.2s;
}
.step.active, .step.done { opacity: 1; color: var(--text); }
.step-num {
  width: 22px; height: 22px; border-radius: 999px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  border: 1px solid var(--border-strong);
  background: var(--surface);
}
.step.active .step-num {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff;
}
.step.done .step-num {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--success);
}
.step-line { width: 22px; height: 1px; background: var(--border-strong); }

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.user-chip {
  font-size: 12px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}

/* ── Screens ─────────────────────────────────────────────────────────────── */
.screen { flex: 1; display: none; }
.screen.active:not([hidden]) { display: flex; flex-direction: column; }
.screen[hidden] { display: none !important; }

.screen-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

/* Upload */
.upload-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 28px;
  align-items: start;
}
.hero-panel h1 {
  font-size: clamp(1.5rem, 2.5vw, 1.9rem);
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  line-height: 1.2;
}
.hero-copy { color: var(--muted); margin: 0 0 18px; max-width: 32rem; }
.feature-list {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feature-list li {
  padding-left: 22px;
  position: relative;
  color: var(--muted);
  font-size: 13.5px;
}
.feature-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 7px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.upload-card { padding: 20px; }
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  margin-bottom: 16px;
  background: rgba(255,255,255,0.015);
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragover {
  border-color: rgba(91, 140, 255, 0.55);
  background: var(--accent-soft);
  box-shadow: var(--focus);
  outline: none;
}
.dropzone.has-file {
  border-style: solid;
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.06);
}
.dz-icon {
  width: 48px; height: 48px; margin: 0 auto 12px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.dz-title { margin: 0; font-weight: 650; }
.dz-hint { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; }
.dz-file { display: flex; align-items: center; justify-content: center; gap: 10px; }
.file-chip {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

#target-lang[multiple] {
  min-height: 150px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px;
}
.estimate-box {
  margin: 12px 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid rgba(91, 140, 255, 0.25);
}
.estimate-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

/* Processing */
.processing-layout {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--header-h) - 40px);
}
.processing-card {
  width: min(440px, 100%);
  padding: 36px 28px;
  text-align: center;
}
.processing-card h2 { margin: 16px 0 8px; font-size: 1.25rem; }
.orbit {
  width: 72px; height: 72px; margin: 0 auto;
  position: relative;
}
.orbit-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-right-color: rgba(91,140,255,0.25);
  animation: spin 1s linear infinite;
}
.orbit-core {
  position: absolute; inset: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  opacity: 0.85;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-wrap { margin: 22px 0 18px; text-align: left; }
.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s var(--ease);
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.process-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
  display: grid;
  gap: 8px;
}
.process-steps li {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid transparent;
}
.process-steps li.active {
  color: var(--text);
  border-color: rgba(91,140,255,0.3);
  background: var(--accent-soft);
}
.process-steps li.done { color: var(--success); }

/* ── Editor (max space) ──────────────────────────────────────────────────── */
.editor-screen {
  height: calc(100vh - var(--header-h));
  max-height: calc(100vh - var(--header-h));
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.editor-screen[hidden] { display: none !important; }

.editor-chrome {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 24, 0.92);
  backdrop-filter: blur(10px);
  z-index: 20;
}
.page-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  min-height: 40px;
  flex-wrap: wrap;
}
.page-bar-left, .page-bar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.page-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
}
.page-indicator input {
  width: 48px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 4px 6px;
  font: inherit;
  text-align: center;
}
.page-bar-sep {
  width: 1px;
  height: 18px;
  background: var(--border-strong);
  margin: 0 4px;
}
.zoom-label {
  min-width: 42px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sync-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
  cursor: pointer;
}
.toolbar-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-right: 6px;
}

/* Inspector compact */
.block-inspector {
  border-top: 1px solid var(--border);
  padding: 8px 12px 10px;
  background: var(--surface);
  transition: max-height 0.28s var(--ease), opacity 0.2s, padding 0.2s;
}
.block-inspector.collapsed .inspector-body { display: none !important; }
.block-inspector.collapsed {
  padding-bottom: 6px;
}
.inspector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.inspector-head strong { font-size: 13px; }
.inspector-head .muted { margin: 2px 0 0; font-size: 11.5px; }
.inspector-head-actions { display: flex; gap: 4px; align-items: center; }
.inspector-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.inspector-cols textarea {
  width: 100%;
  resize: vertical;
  min-height: 52px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
}
.inspector-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.toolbar-group { display: inline-flex; align-items: center; gap: 3px; }
.toolbar-sep {
  width: 1px; height: 18px;
  background: var(--border);
  margin: 0 4px;
}
.toolbar-spacer { flex: 1; }
.tool {
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.tool:hover { background: rgba(255,255,255,0.06); }
.tool.active {
  background: var(--accent-soft);
  border-color: rgba(91,140,255,0.4);
  color: #cfe0ff;
}
.tool-label { font-size: 11px; color: var(--muted); margin-right: 2px; }
.tool-input {
  width: 52px;
  height: 28px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 0 6px;
  font: inherit;
  font-size: 12px;
}
.tool-select { width: auto; min-width: 6.5rem; }
.tool-color {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

/* Panes — fill remaining viewport */
.panes {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 6px 1fr;
  gap: 0;
  background: var(--bg);
  transition: grid-template-columns 0.28s var(--ease);
}
.panes.max-original {
  grid-template-columns: 1fr 6px 0fr;
}
.panes.max-original #pane-translated,
.panes.max-original .pane-resizer {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  width: 0;
  min-width: 0;
}
.panes.max-translated {
  grid-template-columns: 0fr 6px 1fr;
}
.panes.max-translated #pane-original,
.panes.max-translated .pane-resizer {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  width: 0;
  min-width: 0;
}

.pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  transition: opacity 0.25s var(--ease);
}
.pane-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.9);
}
.pane-header h3 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge.accent {
  background: var(--accent-soft);
  border-color: rgba(91,140,255,0.3);
  color: #c5d7ff;
}
.pane-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
  background:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
}
.page-stage {
  position: relative;
  display: inline-block;
  margin: 12px auto;
  min-width: min(100%, 400px);
  box-shadow: var(--shadow-sm);
}
.page-stage canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
}
.empty-pane {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  pointer-events: none;
  font-size: 13px;
}
.hit-layer { position: absolute; inset: 0; }
.hit-target {
  position: absolute;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  padding: 0;
  margin: 0;
  border-radius: 2px;
  transition: background 0.12s, outline 0.12s;
}
.hit-target:hover {
  background: rgba(91, 140, 255, 0.1);
  outline: 1px solid rgba(91, 140, 255, 0.35);
}
.hit-target.selected {
  outline: 2px solid var(--accent);
  background: rgba(91, 140, 255, 0.12);
}
.hit-target.multi-selected {
  outline: 2px solid var(--warning);
  background: rgba(251, 191, 36, 0.1);
}
.hit-target.dirty {
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.5);
}
.selection-box {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 3px;
  pointer-events: none;
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.18);
  z-index: 4;
}
.original-highlight {
  position: absolute;
  pointer-events: none;
  border: 2px solid var(--accent);
  background: rgba(91, 140, 255, 0.16);
  border-radius: 3px;
  box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.12);
  z-index: 5;
  transition: opacity 0.2s;
}

.pane-resizer {
  background: var(--border);
  cursor: col-resize;
  position: relative;
  z-index: 5;
  transition: background 0.15s;
}
.pane-resizer:hover,
.pane-resizer.dragging {
  background: rgba(91, 140, 255, 0.55);
}
.pane-resizer::after {
  content: "";
  position: absolute;
  inset: 0 -4px;
}

/* Focus mode: hide header + compact chrome */
body.focus-mode .shell-header { display: none; }
body.focus-mode .editor-screen {
  height: 100vh;
  max-height: 100vh;
}
body.focus-mode .block-inspector:not(.force-open) {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
}
body.focus-mode .pane-header { padding: 4px 8px; }

/* ── Dashboard ───────────────────────────────────────────────────────────── */
.dashboard-screen {
  flex: 1;
  min-height: calc(100vh - var(--header-h));
  overflow: auto;
}
.dash-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - var(--header-h));
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}
.dash-nav {
  border-right: 1px solid var(--border);
  background: var(--bg-2);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dash-nav-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 12px 10px;
  margin: 0;
}
.dash-nav-item {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.dash-nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.dash-nav-item.active {
  color: var(--text);
  background: var(--accent-soft);
}
.dash-back { margin-top: auto; }
.dash-main { padding: 22px 24px 40px; }
.dash-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.dash-panel-head h2 { margin: 0 0 4px; font-size: 1.3rem; letter-spacing: -0.02em; }
.plan-compare {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s, transform 0.2s;
}
.plan-card:hover { border-color: rgba(91,140,255,0.3); }
.plan-card.current {
  border-color: rgba(91, 140, 255, 0.5);
  box-shadow: 0 0 0 1px rgba(91, 140, 255, 0.2);
}
.plan-card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.plan-card h3 { margin: 0; font-size: 1rem; }
.plan-price strong { font-size: 1.25rem; }
.plan-feats {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  flex: 1;
}
.feature-diff h3 { margin-top: 0; font-size: 1rem; }
.simple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.simple-table th,
.simple-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.simple-table th { color: var(--muted); font-weight: 550; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.stat-n { font-size: 1.35rem; font-weight: 750; letter-spacing: -0.02em; }
.stat-l { font-size: 11px; color: var(--muted); margin-top: 2px; }
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  font-size: 11px;
  text-transform: lowercase;
}
.pill.ok { color: var(--success); border-color: rgba(52,211,153,0.35); }
.pill.bad { color: var(--danger); border-color: rgba(251,113,133,0.35); }
.pill.warn { color: var(--warning); border-color: rgba(251,191,36,0.35); }
.glossary-form .field-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.glossary-form .field.grow { flex: 1; min-width: 160px; }
.form-subhead { margin: 0 0 12px; font-size: 0.95rem; }
.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.listing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s;
}
.listing-card:hover { border-color: rgba(91,140,255,0.3); }
.listing-card h3 { margin: 0; font-size: 0.95rem; }
.listing-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.listing-card .btn { align-self: flex-start; margin-top: 4px; }
.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 140px;
}
.pipeline-hint { margin: -4px 0 14px; }

/* ── Modal / toast ───────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(8px);
  padding: 16px;
}
.modal[hidden] { display: none !important; }
.modal-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.modal-card.wide { width: min(520px, 100%); }
.modal-card.auth-card { width: min(440px, 100%); }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab {
  flex: 1;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 550;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tab.active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: rgba(91, 140, 255, 0.35);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 1100;
  max-width: min(480px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  color: var(--text);
}
.toast.error { border-color: rgba(251,113,133,0.45); color: #fecdd3; }
.toast.success { border-color: rgba(52,211,153,0.4); color: #a7f3d0; }

/* Live preview + shortcuts */
.live-preview-status {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.live-preview-status.is-busy {
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
}
.live-preview-status.is-ok {
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.08);
}
.live-preview-status.is-err {
  color: var(--danger);
  border-color: rgba(251, 113, 133, 0.35);
  background: rgba(251, 113, 133, 0.08);
}
#btn-live-preview.active {
  background: var(--accent-soft);
  border-color: rgba(91, 140, 255, 0.4);
  color: #cfe0ff;
}
.shortcuts-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 18px;
  align-items: center;
  font-size: 13.5px;
}
.shortcuts-grid kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-2);
  font-family: var(--mono);
  font-size: 11.5px;
  text-align: center;
  color: var(--text);
  box-shadow: 0 1px 0 rgba(0,0,0,0.25);
}

.usage-chip {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hit-target.review-accepted {
  outline: 1.5px solid rgba(52, 211, 153, 0.75);
  background: rgba(52, 211, 153, 0.12);
}
.hit-target.review-rejected {
  outline: 1.5px solid rgba(251, 113, 133, 0.8);
  background: rgba(251, 113, 133, 0.14);
}
.hit-target.review-needs {
  outline: 1.5px dashed rgba(251, 191, 36, 0.75);
  background: rgba(251, 191, 36, 0.1);
}
.hit-target.filter-hidden {
  opacity: 0.12;
  pointer-events: none;
}

.block-comments {
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.comments-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 6px 0 4px;
}
.comments-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  max-height: 120px;
  overflow-y: auto;
}
.comments-list li {
  font-size: 12.5px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  margin-bottom: 4px;
}
.comments-list .c-meta {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 2px;
}
.comment-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.comment-form input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
}

.block-review-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.block-mtqe {
  font-size: 12px;
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}
.block-mtqe.ok { color: var(--success); border-color: rgba(52,211,153,0.35); }
.block-mtqe.warn { color: var(--warning); border-color: rgba(251,191,36,0.4); }
.block-mtqe.bad { color: var(--danger); border-color: rgba(251,113,133,0.4); }
.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.review-actions .btn.active-accept {
  color: var(--success);
  border-color: rgba(52,211,153,0.45);
}
.review-actions .btn.active-reject {
  color: var(--danger);
  border-color: rgba(251,113,133,0.45);
}
.review-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.ocr-banner {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  margin-bottom: 14px;
  background: rgba(251, 191, 36, 0.08);
}
.ocr-banner.warn { border-color: rgba(251,191,36,0.4); }
.ocr-banner.danger {
  border-color: rgba(251,113,133,0.4);
  background: rgba(251,113,133,0.08);
}
.ocr-banner .check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
}
.checkbox-row .check-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  margin-top: 3px;
}
.usage-chip.warn {
  color: var(--warning);
  border-color: rgba(251,191,36,0.35);
}
.usage-chip.danger {
  color: var(--danger);
  border-color: rgba(251,113,133,0.4);
}

/* Estimate confirm modal */
.estimate-modal-body {
  max-height: min(50vh, 420px);
  overflow: auto;
  margin-bottom: 16px;
}
.estimate-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.estimate-stat {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.estimate-stat .n {
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.estimate-stat .l {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.estimate-lang-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 10px;
}
.estimate-lang-table th,
.estimate-lang-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.estimate-lang-table th { color: var(--muted); font-weight: 550; }
.estimate-notes {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
}
.estimate-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* Cloud connectors */
.cloud-import-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -4px 0 14px;
  flex-wrap: wrap;
}
.cloud-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.cloud-modal-card { width: min(760px, 100%); }
.cloud-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 14px;
  min-height: 360px;
}
.cloud-providers {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-right: 1px solid var(--border);
  padding-right: 12px;
}
.cloud-provider-btn {
  text-align: left;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.cloud-provider-btn:hover { background: rgba(255,255,255,0.04); }
.cloud-provider-btn.active {
  border-color: rgba(91,140,255,0.45);
  background: var(--accent-soft);
}
.cloud-provider-btn .cp-name { font-weight: 600; font-size: 13px; display: block; }
.cloud-provider-btn .cp-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cloud-provider-btn .cp-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.cloud-provider-btn .cp-badge.on {
  color: var(--success);
  border-color: rgba(52,211,153,0.35);
}
.cloud-browser {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.cloud-browser-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.cloud-browser-bar input[type="search"] {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}
.cloud-path { margin-bottom: 8px; min-height: 1.2em; }
.cloud-file-list {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-2);
  max-height: 320px;
}
.cloud-file-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s;
}
.cloud-file-row:hover { background: rgba(91,140,255,0.08); }
.cloud-file-row .cf-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}
.cloud-file-row .cf-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloud-file-row .cf-meta { font-size: 11px; color: var(--muted); }
.cloud-footer {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.cloud-footer .field { flex: 1; margin: 0; }

@media (max-width: 720px) {
  .cloud-layout { grid-template-columns: 1fr; }
  .cloud-providers {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 10px;
  }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .landing-hero { grid-template-columns: 1fr; }
  .mock-window { transform: none; max-width: 520px; margin: 0 auto; }
  .feature-grid, .workflow-steps { grid-template-columns: 1fr 1fr; }
  .upload-layout { grid-template-columns: 1fr; }
  .shell-header {
    grid-template-columns: 1fr;
    height: auto;
    padding: 10px 12px;
    gap: 8px;
  }
  .header-actions { justify-content: flex-start; }
  .step-label { display: none; }
  .dash-layout { grid-template-columns: 1fr; }
  .dash-nav {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
  }
  .dash-back { margin-top: 0; width: 100%; }
  .panes {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr 1fr;
  }
  .pane-resizer { display: none; }
  .editor-screen {
    height: auto;
    max-height: none;
    min-height: calc(100vh - 80px);
  }
  .pane-body { min-height: 40vh; }
  .inspector-cols { grid-template-columns: 1fr; }
  .security-band { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  .landing-links a { display: none; }
  .feature-grid, .workflow-steps { grid-template-columns: 1fr; }
  .landing-nav { padding: 12px 14px; }
  .landing-hero { padding: 32px 16px; }
}
