/* ABP Document Translator
 * Theme: Adjuvo-grade structural polish, ABP News palette
 *  - Primary red:  #d71920  (ABP brand)
 *  - Navbar:       jet-black with red underline (news bar)
 *  - Body:         soft warm-white, news-paper feel
 *  - Typography:   Inter (UI) + Source Serif 4 (display accents)
 *  - Layout:       fluid full-width on desktop, responsive on mobile
 */

:root {
  /* ABP News palette */
  --abp-red: #d71920;
  --abp-red-600: #b8141a;
  --abp-red-700: #931017;
  --abp-red-50: #fdecec;

  --abp-black: #111111;
  --abp-black-soft: #1d1d1d;
  --abp-black-line: #2a2a2a;

  --primary: var(--abp-red);
  --primary-rgb: 215, 25, 32;

  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f7f6f4;

  --text-primary: #131313;
  --text-secondary: #4a4a4a;
  --text-muted: #818181;

  --gray-50: #fafafa;
  --gray-100: #f3f3f3;
  --gray-150: #ececec;
  --gray-200: #e2e2e2;
  --gray-300: #cecece;
  --gray-400: #a8a8a8;
  --gray-500: #757575;

  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #ca8a04;
  --warning-bg: #fef9c3;
  --danger:  #dc2626;
  --danger-bg: #fee2e2;
  --info: #0369a1;
  --info-bg: #e0f2fe;

  --shadow-1: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-2: 0 4px 14px rgba(0,0,0,0.07);
  --shadow-3: 0 18px 50px rgba(0,0,0,0.12);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --transition: 200ms cubic-bezier(.4,0,.2,1);
}

* { margin:0; padding:0; box-sizing:border-box; }
html { overflow-x: hidden; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.55;
}

/* ─── Navigation (news-bar style) ─────────────────────── */
.navbar {
  background: var(--abp-black);
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 0 var(--abp-red), 0 6px 18px rgba(0,0,0,0.18);
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: #fff;
  margin-right: 2.25rem;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
}
.navbar-brand .logo-wrap {
  width: 128px;
  height: 48px;
  background: #fff;
  border-radius: 6px;
  padding: 5px 7px;
  display: flex; align-items: center; justify-content: center;
}
.navbar-brand .logo-wrap img { width: 100%; height: 100%; object-fit: contain; }
.navbar-brand-text {
  display: flex; flex-direction: column; line-height: 1.15;
}
.navbar-brand-text .b1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: 0.02em;
  color: var(--abp-red);
}
.navbar-brand-text .b1 em { font-style: normal; color: var(--abp-red); }
.navbar-brand-text .b2 {
  color: #c5c5c5;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
}

.nav-links { display: flex; gap: 0.25rem; flex: 1; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  color: #d8d8d8;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.91rem;
  font-weight: 500;
  position: relative;
  transition: var(--transition);
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-link.active { color: #fff; }
.nav-link.active::after {
  content: '';
  position: absolute;
  left: 0.5rem; right: 0.5rem; bottom: -22px;
  height: 3px;
  background: var(--abp-red);
}

.nav-right { display: flex; align-items: center; gap: 0.85rem; }
.nav-user { color: #b8b8b8; font-size: 0.85rem; }
.nav-user strong { color: #fff; font-weight: 600; }
.btn-logout {
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 0.42rem 0.95rem;
  border-radius: 4px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: var(--transition);
}
.btn-logout:hover { background: var(--abp-red); border-color: var(--abp-red); }
.nav-hamburger {
  display: none; background: none; border: 0;
  color: #fff; font-size: 1.4rem; cursor: pointer;
  margin-left: auto;
}

/* ─── Layout ──────────────────────────────────────────── */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 1.6rem 1.75rem 2.4rem;
}
.fade-in { animation: fadeIn .35s ease-out; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.site-footer {
  margin-top: auto;
  padding: 1.1rem 1.5rem;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
  background: #fff;
  border-top: 1px solid var(--gray-200);
}
.site-footer a { color: var(--abp-red); text-decoration: none; font-weight: 500; }
.site-footer a:hover { text-decoration: underline; }
.footer-powered,
.footer-brand {
  display: inline;
}
.footer-brand {
  color: var(--abp-red);
  font-weight: 700;
}
.footer-copyright {
  display: block;
  margin-top: 0.2rem;
}

/* ─── Card ────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.85rem 2rem;
  box-shadow: var(--shadow-1);
  margin-bottom: 1.25rem;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-2); }
.card-h {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 0.4rem;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  color: var(--text-primary);
}
.card-h i { color: var(--abp-red); font-size: 1.05rem; }
.card-sub {
  color: var(--text-secondary);
  font-size: 0.93rem;
  margin-bottom: 1.5rem;
  max-width: 70ch;
}

/* ─── Forms ──────────────────────────────────────────── */
.field {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=url],
.field input[type=search],
.field input[type=number],
.field input[type=tel],
.field input[type=date],
.field input:not([type]),
.field select,
.field textarea {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.78rem 0.95rem;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--abp-red);
  box-shadow: 0 0 0 3px rgba(215,25,32,0.10);
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23757575' d='M6 8.5L2 4.5h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 12px;
  padding-right: 2.2rem;
}

/* ─── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.7rem 1.2rem;
  font-family: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--abp-red);
  color: #fff;
  border-color: var(--abp-red);
  box-shadow: 0 2px 4px rgba(215,25,32,0.20);
}
.btn-primary:hover:not(:disabled) {
  background: var(--abp-red-600);
  border-color: var(--abp-red-600);
  box-shadow: 0 4px 10px rgba(215,25,32,0.28);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) {
  background: var(--abp-red-700);
  transform: translateY(0);
}
.btn-secondary {
  background: #fff;
  color: var(--text-primary);
  border-color: var(--gray-300);
}
.btn-secondary:hover:not(:disabled) { background: var(--gray-50); border-color: var(--gray-400); }
.btn-google {
  background: #fff;
  color: var(--text-primary);
  border-color: var(--gray-300);
}
.btn-google:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
  box-shadow: 0 3px 8px rgba(18,18,18,0.08);
}
.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: rgba(220,38,38,0.4);
}
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); border-color: var(--danger); }
.btn-block { width: 100%; padding: 0.95rem 1rem; font-size: 0.98rem; }
.btn-lg { padding: 1.05rem 1.4rem; font-size: 1rem; }

/* ─── Dropzone (polished) ────────────────────────────── */
.dropzone {
  position: relative;
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 2.6rem 1.4rem;
  text-align: center;
  cursor: pointer;
  background: linear-gradient(180deg, #fff 0%, var(--gray-50) 100%);
  transition: var(--transition);
  margin-top: 0.6rem;
}
.dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(215,25,32,0.04) 0%, transparent 60%);
  border-radius: var(--radius);
  opacity: 0;
  transition: var(--transition);
  pointer-events: none;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--abp-red);
  border-style: solid;
}
.dropzone:hover::before, .dropzone.over::before { opacity: 1; }
.dropzone.has-files {
  border-style: solid;
  border-color: var(--success);
  background: linear-gradient(180deg, #fff 0%, var(--success-bg) 100%);
}
.dz-icon {
  font-size: 2.6rem;
  color: var(--abp-red);
  margin-bottom: 0.6rem;
  transition: var(--transition);
}
.dropzone.has-files .dz-icon { color: var(--success); }
.dropzone:hover .dz-icon, .dropzone.over .dz-icon { transform: translateY(-2px); }
.dz-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}
.dz-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.file-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 1.05rem;
  justify-content: center;
}
.file-pill {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: 0.32rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}
.file-pill i.fa-file-pdf { color: var(--abp-red); }
.file-pill .pill-x {
  cursor: pointer;
  color: var(--gray-400);
  font-size: 0.75rem;
  margin-left: 0.25rem;
  padding: 0.15rem;
  border-radius: 50%;
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.file-pill .pill-x:hover { background: var(--danger-bg); color: var(--danger); }

/* ─── Progress card ──────────────────────────────────── */
.progress-card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.85rem 2rem;
  box-shadow: var(--shadow-2);
  margin-top: 1.5rem;
}
.progress-track {
  width: 100%;
  height: 12px;
  background: var(--gray-100);
  border-radius: 6px;
  overflow: hidden;
  margin: 0.7rem 0 0.85rem;
  position: relative;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--abp-red) 0%, #ff7a45 100%);
  border-radius: 6px;
  transition: width 0.4s ease-out;
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.5) 50%, transparent 100%);
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

.progress-step {
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 1.4rem;
}
.progress-step .spinner {
  width: 16px;
  height: 16px;
  border: 2.5px solid var(--gray-200);
  border-top-color: var(--abp-red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  margin-top: 0.5rem;
}
.progress-status .pct {
  color: var(--abp-red);
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}
.progress-status .badge {
  padding: 0.22rem 0.72rem;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
}
.progress-status .badge.running { background: var(--warning-bg); color: var(--warning); }
.progress-status .badge.done    { background: var(--success-bg); color: var(--success); }
.progress-status .badge.failed  { background: var(--danger-bg);  color: var(--danger); }

/* ─── Tables ─────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  overflow: auto;
  box-shadow: var(--shadow-1);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
thead th {
  background: var(--gray-50);
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}
tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: 0; }
.lang-cap { text-transform: capitalize; }
.table-actions { display: flex; gap: 0.35rem; }
.icon-btn {
  background: #fff;
  border: 1px solid var(--gray-200);
  width: 32px; height: 32px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.82rem;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { color: var(--abp-red); border-color: var(--abp-red); background: var(--abp-red-50); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }

.s-badge {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.s-badge.queued  { background: var(--gray-100); color: var(--text-secondary); }
.s-badge.running { background: var(--warning-bg); color: var(--warning); }
.s-badge.done    { background: var(--success-bg); color: var(--success); }
.s-badge.failed  { background: var(--danger-bg);  color: var(--danger); }

/* ─── Toasts ─────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 1rem;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.toast {
  background: #fff;
  border-left: 4px solid var(--abp-red);
  box-shadow: var(--shadow-3);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  gap: 0.7rem;
  min-width: 300px;
  max-width: 400px;
  animation: slideIn 0.25s ease-out;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast > i:first-child { font-size: 1.1rem; padding-top: 0.05rem; }
.toast.success > i:first-child { color: var(--success); }
.toast.error   > i:first-child { color: var(--danger); }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); }
.toast-msg   { font-size: 0.83rem; color: var(--text-secondary); margin-top: 0.18rem; }
.toast-close { color: var(--gray-400); cursor: pointer; padding-top: 0.2rem; }
.toast-close:hover { color: var(--text-primary); }

/* ─── Login: split layout (left brand panel · right form) ── */
.login-wrap {
  flex: 1;
  display: flex;
  min-height: calc(100vh - 56px);
  background: #fff;
}
.login-brand {
  flex: 1.05;
  background: var(--abp-black);
  background-image: linear-gradient(135deg, var(--abp-black) 0%, var(--abp-black-soft) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 4rem;
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 6px;
  background: var(--abp-red);
}
.login-brand::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 10%, rgba(215,25,32,0.18) 0%, transparent 45%),
    radial-gradient(circle at 10% 90%, rgba(215,25,32,0.12) 0%, transparent 45%);
  pointer-events: none;
}
.login-brand-inner { position: relative; z-index: 1; max-width: 520px; }

.login-logo {
  width: 230px;
  height: 120px;
  background: #fff;
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 2rem;
  box-shadow: 0 14px 40px rgba(0,0,0,0.25);
}
.login-logo img { width: 100%; height: 100%; object-fit: contain; }

.login-brand h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 2.6rem;
  line-height: 1.1;
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}
.login-brand h1 em { color: var(--abp-red); font-style: normal; }
.login-brand h1 .brand-sub { font-size: 1.6rem; color: #d8d8d8; letter-spacing: 0.02em; }
.login-brand .tagline {
  font-size: 1.05rem;
  color: #cdcdcd;
  line-height: 1.6;
  margin-bottom: 2.2rem;
  max-width: 38ch;
}
.login-brand .feature-list {
  list-style: none;
  margin-top: 1rem;
}
.login-brand .feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: #d8d8d8;
}
.login-brand .feature-list i {
  color: var(--abp-red);
  font-size: 0.95rem;
  margin-top: 0.18rem;
}

.login-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 2.5rem;
  background: var(--surface);
}
.login-form-card {
  width: 100%;
  max-width: 420px;
}
.login-form-card .lf-eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--abp-red);
  font-weight: 700;
  margin-bottom: 0.45rem;
}
.login-form-card h2 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}
.login-form-card .sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}
.login-form-card .err {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.5rem;
  border-left: 3px solid var(--danger);
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 1.1rem 0;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}
.password-login {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
}
.password-login summary {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  min-height: 48px;
  padding: 0 0.95rem;
  cursor: pointer;
  list-style: none;
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 700;
}
.password-login summary::-webkit-details-marker { display: none; }
.password-login summary span {
  grid-column: 2;
}
.password-login summary i {
  grid-column: 3;
  justify-self: end;
  color: var(--text-muted);
  transition: transform 0.18s ease;
}
.password-login[open] summary {
  border-bottom: 1px solid var(--gray-200);
}
.password-login[open] summary i {
  transform: rotate(180deg);
}
.password-login form {
  padding: 1rem 0.95rem 0.95rem;
}

/* ─── Convert page split layout (70 / 30) ───────────── */
.convert-grid {
  display: grid;
  grid-template-columns: minmax(0, 70fr) minmax(320px, 30fr);
  gap: 1.4rem;
  align-items: flex-start;
}
.convert-right { position: sticky; top: 80px; }

.activity-card { padding: 1.4rem 1.5rem; }
.activity-list-wrap { display: flex; flex-direction: column; gap: 0.85rem; }

.activity-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 0.95rem 1rem;
  background: var(--surface-2);
  transition: var(--transition);
}
.activity-item.running {
  border-left: 3px solid var(--abp-red);
  background: linear-gradient(180deg, #fff 0%, var(--abp-red-50) 100%);
}
.activity-item.done    { border-left: 3px solid var(--success); }
.activity-item.failed  { border-left: 3px solid var(--danger);  }
.activity-item.queued  { border-left: 3px solid var(--gray-300); }

.activity-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.activity-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.activity-meta .lang-cap { color: var(--abp-red); font-weight: 600; }

.mini-progress-track {
  width: 100%;
  height: 6px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.3rem;
}
.mini-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--abp-red) 0%, #ff7a45 100%);
  border-radius: 3px;
  transition: width 0.4s ease-out;
  position: relative;
}
.mini-progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.5) 50%, transparent 100%);
  animation: shimmer 1.6s linear infinite;
}
.mini-step {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mini-pct { font-weight: 700; color: var(--abp-red); font-variant-numeric: tabular-nums; }

.activity-actions { display: flex; gap: 0.4rem; margin-top: 0.6rem; flex-wrap: wrap; }
.activity-actions .btn-mini {
  padding: 0.32rem 0.7rem;
  font-size: 0.78rem;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 1px solid var(--gray-200);
  background: #fff;
  color: var(--text-secondary);
  transition: var(--transition);
  cursor: pointer;
}
.activity-actions .btn-mini:hover { color: var(--abp-red); border-color: var(--abp-red); }
.activity-actions .btn-mini.primary {
  background: var(--abp-red);
  color: #fff;
  border-color: var(--abp-red);
}
.activity-actions .btn-mini.primary:hover { background: var(--abp-red-600); }

.activity-item .err {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 0.4rem;
  background: var(--danger-bg);
  padding: 0.4rem 0.55rem;
  border-radius: 4px;
}

@media (max-width: 1100px) {
  .convert-grid { grid-template-columns: 1fr; }
  .convert-right { position: static; }
}

/* ─── Run History — tiles + preview drawer ────────── */
.rh-toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}
.rh-search {
  flex: 1;
  min-width: 240px;
  position: relative;
}
.rh-search i {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 0.92rem;
  pointer-events: none;
}
.rh-search input {
  width: 100%;
  padding: 0.7rem 0.95rem 0.7rem 2.4rem;
  font-size: 0.92rem;
  font-family: inherit;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
  transition: var(--transition);
}
.rh-search input:focus {
  border-color: var(--abp-red);
  box-shadow: 0 0 0 3px rgba(215,25,32,0.10);
}

.rh-filter {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.rh-filter button {
  background: #fff;
  border: 0;
  padding: 0.55rem 0.95rem;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-right: 1px solid var(--gray-200);
  transition: var(--transition);
}
.rh-filter button:last-child { border-right: 0; }
.rh-filter button.active {
  background: var(--abp-red);
  color: #fff;
}
.rh-filter button:not(.active):hover { background: var(--gray-50); color: var(--text-primary); }

.rh-summary {
  font-size: 0.83rem;
  color: var(--text-muted);
  font-weight: 500;
}

.rh-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 0.95rem;
  margin-bottom: 1.2rem;
}
.rh-tile {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.rh-tile:hover {
  border-color: var(--abp-red);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}
.rh-tile.selected {
  border-color: var(--abp-red);
  box-shadow: 0 0 0 3px rgba(215,25,32,0.10);
}
.rh-tile-row1 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.rh-tile-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--abp-red-50);
  color: var(--abp-red);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.rh-tile.failed .rh-tile-icon { background: var(--danger-bg); color: var(--danger); }
.rh-tile.running .rh-tile-icon { background: var(--warning-bg); color: var(--warning); }
.rh-tile-fname {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.rh-tile-when {
  font-size: 0.74rem;
  color: var(--text-muted);
}
.rh-tile-row2 {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.rh-chip {
  background: var(--gray-100);
  border-radius: 4px;
  padding: 0.18rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.rh-chip.lang  { background: var(--abp-red-50); color: var(--abp-red); }

.rh-tile-row3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.rh-tile-actions { display: flex; gap: 0.3rem; }

.rh-pagination {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 1rem 0 1.5rem;
}
.rh-pagination button {
  background: #fff;
  border: 1px solid var(--gray-200);
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition);
}
.rh-pagination button:hover:not(:disabled) { background: var(--gray-50); border-color: var(--abp-red); color: var(--abp-red); }
.rh-pagination button.active {
  background: var(--abp-red);
  color: #fff;
  border-color: var(--abp-red);
}
.rh-pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Right-side preview drawer */
.rh-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  transition: grid-template-columns 0.3s ease;
}
.rh-layout.has-preview {
  grid-template-columns: minmax(0, 1fr) minmax(420px, 45%);
}
.rh-preview {
  display: none;
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow: hidden;
  flex-direction: column;
}
.rh-layout.has-preview .rh-preview { display: flex; }

.rh-preview-h {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
}
.rh-preview-h i { color: var(--abp-red); font-size: 1rem; }
.rh-preview-h .close-x {
  margin-left: auto;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 1.05rem;
  color: var(--gray-400);
  width: 30px; height: 30px;
  border-radius: 5px;
  transition: var(--transition);
}
.rh-preview-h .close-x:hover { background: var(--gray-100); color: var(--text-primary); }

.rh-preview-meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1.1rem;
}
.rh-preview-meta dt { font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.06em; align-self: center; }
.rh-preview-meta dd { color: var(--text-primary); font-size: 0.86rem; word-break: break-word; }

.rh-action-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}

.rh-doc-frame {
  flex: 1;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: auto;
  padding: 1.2rem 1.4rem;
  font-family: 'Calibri', 'Segoe UI', sans-serif;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-primary);
  min-height: 240px;
}
.rh-doc-frame.loading { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.86rem; }
.rh-doc-frame h1, .rh-doc-frame h2, .rh-doc-frame h3 {
  font-family: 'Source Serif 4', Georgia, serif;
  margin-top: 0.7rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}
.rh-doc-frame h1 { font-size: 1.4rem; }
.rh-doc-frame h2 { font-size: 1.15rem; }
.rh-doc-frame h3 { font-size: 1rem; }
.rh-doc-frame p  { margin-bottom: 0.75rem; }
.rh-doc-frame table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0;
  font-size: 0.86rem;
}
.rh-doc-frame table td, .rh-doc-frame table th {
  border: 1px solid var(--gray-300);
  padding: 0.5rem 0.65rem;
  vertical-align: top;
  background: #fff;
}
.rh-doc-frame table th { background: var(--gray-50); font-weight: 600; }

@media (max-width: 1100px) {
  .rh-layout.has-preview { grid-template-columns: 1fr; }
  .rh-preview { position: static; max-height: none; }
}

/* ─── Helpers ────────────────────────────────────────── */
.row {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr;
}
.muted { color: var(--text-muted); }
.kbd {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  padding: 0.05rem 0.45rem;
  font-family: 'SFMono-Regular', Consolas, Monaco, monospace;
  font-size: 0.82rem;
}
.empty {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
}
.empty i { font-size: 2.4rem; color: var(--gray-300); margin-bottom: 0.7rem; }
hr.sep { border: 0; border-top: 1px solid var(--gray-200); margin: 1.4rem 0; }

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 1024px) {
  .main-content { padding: 1.5rem 1.25rem 2.5rem; }
}

@media (max-width: 880px) {
  .nav-hamburger { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--abp-black);
    flex-direction: column;
    padding: 0.6rem;
    gap: 0;
    border-top: 1px solid var(--abp-black-line);
    box-shadow: var(--shadow-3);
    z-index: 99;
  }
  .nav-links.open { display: flex; }
  .nav-link { padding: 0.85rem 1rem; }
  .nav-link.active::after { display: none; }
  .nav-link.active { background: rgba(215,25,32,0.18); }

  /* Login becomes single column */
  .login-wrap { flex-direction: column; min-height: auto; }
  .login-brand {
    flex: 0 0 auto;
    padding: 2.2rem 1.75rem;
  }
  .login-brand::before { width: 100%; height: 4px; bottom: auto; }
  .login-logo { width: 178px; height: 92px; padding: 10px 12px; margin-bottom: 1.1rem; }
  .login-brand h1 { font-size: 1.7rem; }
  .login-brand .tagline { font-size: 0.92rem; margin-bottom: 0.5rem; }
  .login-brand .feature-list { display: none; }
  .login-form-side { padding: 2rem 1.5rem 3rem; }

  /* Stack form rows */
  .row { grid-template-columns: 1fr; }

  /* Tables horizontally scrollable */
  .table-wrap { overflow-x: auto; }
  thead th, tbody td { font-size: 0.85rem; padding: 0.65rem 0.75rem; }

  .card { padding: 1.4rem 1.25rem; }
  .card-h { font-size: 1.2rem; }
  .progress-card { padding: 1.5rem 1.25rem; }
}

@media (max-width: 540px) {
  .navbar { padding: 0 1rem; }
  .navbar-brand { margin-right: auto; gap: 0.55rem; }
  .navbar-brand-text .b1 { font-size: 0.95rem; }
  .navbar-brand-text .b2 { display: none; }
  .nav-right .nav-user { display: none; }
  .main-content { padding: 1.1rem 0.85rem 2rem; }
  .card { padding: 1.1rem; }
  .toast-container { left: 0.5rem; right: 0.5rem; }
  .toast { min-width: auto; max-width: 100%; }
}
