:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: rgba(255, 255, 255, .72);
  --surface-solid: #fff;
  --surface-muted: #f0f2f8;
  --text: #141720;
  --muted: #6f7483;
  --line: rgba(28, 31, 42, .1);
  --primary: #6957e8;
  --primary-2: #8a75ff;
  --primary-soft: rgba(105, 87, 232, .1);
  --danger: #dc4c64;
  --success: #279269;
  --shadow: 0 24px 70px rgba(31, 30, 56, .12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1018;
  --surface: rgba(25, 27, 39, .72);
  --surface-solid: #1a1c27;
  --surface-muted: #222531;
  --text: #f4f3f9;
  --muted: #a4a5b1;
  --line: rgba(255, 255, 255, .1);
  --primary: #8a75ff;
  --primary-2: #a996ff;
  --primary-soft: rgba(138, 117, 255, .14);
  --shadow: 0 24px 70px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background .25s, color .25s;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.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; }

.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(3px); pointer-events: none; opacity: .7; }
.ambient-one { width: 480px; height: 480px; top: -260px; left: -180px; background: radial-gradient(circle, rgba(117, 96, 244, .2), transparent 70%); }
.ambient-two { width: 520px; height: 520px; right: -260px; top: 28%; background: radial-gradient(circle, rgba(69, 180, 205, .14), transparent 70%); }
.glass { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }

.topbar { width: min(1180px, calc(100% - 40px)); height: 84px; margin: auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 17px; letter-spacing: -.02em; }
.brand strong { font-weight: 700; }
.brand-mark { width: 35px; height: 35px; display: inline-grid; place-items: center; border-radius: 11px; color: white; background: linear-gradient(145deg, var(--primary-2), #5542d2); font-weight: 800; box-shadow: 0 8px 20px rgba(105, 87, 232, .3); }
.brand-mark.large { width: 52px; height: 52px; border-radius: 15px; font-size: 22px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-button, .select-wrap { min-width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.icon-button:hover { background: var(--surface-solid); }
.icon-button .sun { display: none; }
[data-theme="dark"] .icon-button .sun { display: block; }
[data-theme="dark"] .icon-button .moon { display: none; }
.select-wrap select { border: 0; outline: 0; color: var(--text); background: transparent; cursor: pointer; font-weight: 650; font-size: 13px; padding: 0 8px; }

main { width: min(900px, calc(100% - 40px)); margin: 72px auto 0; }
.hero { text-align: center; }
.eyebrow { color: var(--primary); font-size: 12px; text-transform: uppercase; letter-spacing: .18em; font-weight: 750; }
.hero h1 { margin: 20px 0 18px; font-size: clamp(39px, 6vw, 64px); line-height: 1.04; letter-spacing: -.055em; font-weight: 760; }
.hero h1 span { color: var(--muted); font-weight: 570; }
.hero p { max-width: 590px; margin: auto; color: var(--muted); font-size: 17px; line-height: 1.65; }
.converter { width: min(740px, 100%); margin: 48px auto 0; padding: 18px; border-radius: 25px; }
.dropzone { min-height: 260px; border: 1.5px dashed rgba(105, 87, 232, .35); border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; background: linear-gradient(145deg, var(--primary-soft), transparent 65%); outline: none; transition: border .2s, transform .2s, background .2s; }
.dropzone:hover, .dropzone:focus, .dropzone.dragging { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.upload-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 17px; color: var(--primary); background: var(--surface-solid); box-shadow: 0 10px 30px rgba(65, 56, 124, .12); }
.upload-icon svg { width: 27px; }
.drop-title { margin: 20px 0 6px; font-weight: 700; font-size: 17px; }
.drop-subtitle { margin: 0; color: var(--muted); font-size: 14px; }
.browse { color: var(--primary); font-weight: 650; }
.limit { margin-top: 18px; color: var(--muted); font-size: 12px; }
.selection { padding: 8px; }
.file-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 15px; background: var(--surface-muted); border: 1px solid var(--line); }
.file-type { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 800; }
.file-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.file-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.file-info span { color: var(--muted); font-size: 12px; }
.remove-file { width: 34px; height: 34px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; font-size: 22px; }
.remove-file:hover { background: rgba(220, 76, 100, .1); color: var(--danger); }
.convert-row { display: flex; align-items: end; gap: 14px; margin-top: 18px; }
.format-field { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.format-field label, .login-card label, .settings-grid label { color: var(--muted); font-size: 12px; font-weight: 650; }
.format-field select, .login-card input, .settings-grid input { width: 100%; height: 48px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; outline: none; color: var(--text); background: var(--surface-solid); }
.format-field select:focus, .login-card input:focus, .settings-grid input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.primary-button, .secondary-button { height: 48px; padding: 0 20px; border: 0; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; font-weight: 700; font-size: 13px; }
.primary-button { color: white; background: linear-gradient(135deg, var(--primary-2), #5947d8); box-shadow: 0 10px 24px rgba(105, 87, 232, .22); }
.primary-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.primary-button svg { width: 18px; }
.secondary-button { color: var(--text); background: var(--surface-muted); border: 1px solid var(--line); }
.full { width: 100%; }
.progress-panel, .result-panel { padding: 30px 20px; }
.progress-head { display: flex; justify-content: space-between; font-size: 14px; }
.progress-head span { color: var(--primary); font-weight: 700; }
.progress-track { height: 8px; margin: 16px 0 12px; overflow: hidden; border-radius: 10px; background: var(--surface-muted); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .3s; }
.progress-panel p { margin: 0; color: var(--muted); font-size: 12px; }
.result-panel { align-items: center; gap: 15px; flex-wrap: wrap; }
.result-panel:not(.hidden) { display: flex; }
.result-panel > div:nth-child(2) { flex: 1; min-width: 180px; }
.result-panel p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.success-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; color: var(--success); background: rgba(39, 146, 105, .12); }
.text-button { width: 100%; border: 0; color: var(--primary); background: transparent; cursor: pointer; font-weight: 650; font-size: 13px; }
.error-message { margin: 12px 8px 0; padding: 12px; border-radius: 10px; color: var(--danger); background: rgba(220, 76, 100, .1); font-size: 13px; text-align: center; }
.trust-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 28px; margin: 26px auto 0; color: var(--muted); font-size: 12px; }
.trust-row > span { display: flex; align-items: center; gap: 7px; }
.trust-row svg { width: 15px; color: var(--primary); }
footer { width: min(1180px, calc(100% - 40px)); margin: 100px auto 0; padding: 30px 0; display: flex; justify-content: space-between; color: var(--muted); border-top: 1px solid var(--line); font-size: 12px; }
footer a:hover { color: var(--primary); }

.admin-main { width: min(1180px, calc(100% - 40px)); margin-top: 55px; padding-bottom: 80px; }
.login-card { width: min(420px, 100%); margin: 12vh auto 0; padding: 38px; border-radius: 24px; text-align: center; }
.login-card h1 { margin: 20px 0 8px; font-size: 28px; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 28px; color: var(--muted); font-size: 14px; }
.login-card form { display: flex; flex-direction: column; gap: 17px; text-align: left; }
.login-card label { display: flex; flex-direction: column; gap: 8px; }
.dashboard-title { display: flex; align-items: end; justify-content: space-between; margin-bottom: 28px; }
.dashboard-title h1 { margin: 8px 0 0; font-size: 36px; letter-spacing: -.04em; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card { padding: 22px; border-radius: 18px; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 12px; font-size: 28px; letter-spacing: -.04em; }
.admin-card { margin-top: 20px; padding: 25px; border-radius: 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 24px; }
.section-heading h2 { margin: 0; font-size: 19px; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 16px; }
.settings-grid label { display: flex; flex-direction: column; gap: 8px; }
.format-settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 25px; }
.format-group { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-muted); }
.format-group h3 { margin: 0 0 13px; font-size: 13px; text-transform: capitalize; }
.format-options { display: flex; flex-wrap: wrap; gap: 8px; }
.format-check input { position: absolute; opacity: 0; }
.format-check span { display: block; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--surface-solid); font-size: 11px; text-transform: uppercase; cursor: pointer; }
.format-check input:checked + span { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.save-notice { margin-top: 16px; color: var(--success); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 11px 12px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; text-align: left; }
td { padding: 15px 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
td.file-cell { max-width: 270px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.badge { padding: 5px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; }
.badge.completed { color: var(--success); background: rgba(39, 146, 105, .12); }
.badge.failed { color: var(--danger); background: rgba(220, 76, 100, .1); }
.badge.processing, .badge.queued { color: var(--primary); background: var(--primary-soft); }
.delete-job { border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.delete-job:hover { color: var(--danger); }
.empty-state { padding: 40px; color: var(--muted); text-align: center; font-size: 13px; }

@media (max-width: 760px) {
  .topbar { height: 70px; width: calc(100% - 28px); }
  .brand { font-size: 15px; }
  main { width: calc(100% - 24px); margin-top: 52px; }
  .hero h1 { font-size: 39px; }
  .hero p { font-size: 15px; }
  .converter { padding: 10px; margin-top: 35px; border-radius: 20px; }
  .dropzone { min-height: 235px; }
  .convert-row { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .result-panel { text-align: center; justify-content: center; }
  .result-panel > div:nth-child(2) { width: 100%; flex-basis: 100%; }
  .download-button { width: 100%; }
  .trust-row { gap: 15px; }
  footer { width: calc(100% - 28px); margin-top: 70px; }
  .admin-main { width: calc(100% - 24px); margin-top: 35px; }
  .login-card { padding: 28px 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .format-settings { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .section-heading button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

