:root {
  --ink: #102536;
  --ink-soft: #526474;
  --navy: #08263a;
  --blue: #0e4967;
  --red: #8f151b;
  --red-bright: #ae2026;
  --cream: #f5f3ef;
  --white: #fff;
  --line: #dfe5e8;
  --success: #197d5b;
  --shadow: 0 24px 70px rgba(15, 39, 54, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(174, 32, 38, .07), transparent 28rem),
    linear-gradient(180deg, #fbfcfc 0, var(--cream) 72%, #eceae6 100%);
  font-family: "DM Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  height: 76px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,.82);
  border-bottom: 1px solid rgba(16,37,54,.08);
  backdrop-filter: blur(16px);
}
.brand { display: flex; gap: 11px; align-items: center; color: var(--navy); text-decoration: none; letter-spacing: -.02em; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--navy); }
.brand-mark svg { width: 22px; fill: none; stroke: white; stroke-width: 1.7; }
.brand strong { font-family: Manrope, sans-serif; font-weight: 800; }
.privacy-pill { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 13px; }
.privacy-pill span { width: 8px; height: 8px; border-radius: 50%; background: #2daf7d; box-shadow: 0 0 0 4px rgba(45,175,125,.12); }

.page-shell { width: min(1100px, calc(100% - 36px)); margin: 0 auto; }
.hero { padding: 82px 20px 46px; text-align: center; }
.eyebrow, .section-kicker { color: var(--red); font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.hero h1 { margin: 15px 0 18px; font: 800 clamp(39px, 7vw, 68px)/1.02 Manrope, sans-serif; letter-spacing: -.055em; }
.hero h1 em { color: var(--red); font-style: normal; }
.hero p { max-width: 680px; margin: 0 auto; color: var(--ink-soft); font-size: clamp(16px, 2vw, 19px); line-height: 1.6; }

.workspace-card, .results-card, .progress-card {
  border: 1px solid rgba(16,37,54,.09);
  border-radius: 26px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow);
}
.workspace-card { padding: clamp(18px, 3vw, 34px); }
.source-tabs { margin: 0 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 5px; border-radius: 14px; background: #eef1f2; }
.source-tab { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 10px; color: var(--ink-soft); background: transparent; font-weight: 700; cursor: pointer; transition: color .2s, background .2s, box-shadow .2s; }
.source-tab svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.source-tab.is-active { color: var(--navy); background: white; box-shadow: 0 4px 14px rgba(15,39,54,.08); }
.dropzone {
  padding: clamp(44px, 7vw, 78px) 24px;
  text-align: center;
  border: 1.5px dashed #afbbc2;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(247,249,250,.95), rgba(241,244,245,.72));
  transition: border-color .2s, background .2s, transform .2s;
  cursor: pointer;
  outline: none;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-dragging { border-color: var(--red); background: #fff9f8; transform: translateY(-2px); }
.upload-icon { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 18px; color: var(--red); background: rgba(174,32,38,.09); }
.upload-icon svg { width: 30px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dropzone h2, .section-heading h2, .settings-block h2, .success-heading h2 { margin: 0; font: 700 clamp(21px, 3vw, 28px)/1.2 Manrope, sans-serif; letter-spacing: -.035em; }
.dropzone p { margin: 10px 0 24px; color: var(--ink-soft); }
.upload-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.spreadsheet-help { display: block; margin-top: 18px; color: var(--ink-soft); }
.spreadsheet-icon { color: var(--blue); background: rgba(14,73,103,.09); }
.button { min-height: 46px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 11px; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--red); box-shadow: 0 9px 24px rgba(143,21,27,.18); }
.button-primary:hover { background: var(--red-bright); }
.button-secondary { color: var(--ink); border-color: var(--line); background: white; }

.queue { padding: 34px 4px 6px; }
.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 16px; }
.section-heading h2, .settings-block h2 { margin-top: 6px; font-size: 22px; }
.text-button { border: 0; color: var(--red); background: transparent; cursor: pointer; font-weight: 700; }
.queue-list { max-height: 225px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.queue-item { padding: 11px 14px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); }
.queue-item:last-child { border-bottom: 0; }
.file-thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; background: #eef1f2; }
.remote-thumb { display: grid; place-items: center; color: var(--blue); }
.remote-thumb svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.file-info { min-width: 0; }
.file-info strong, .file-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info strong { font-size: 14px; }
.file-info span { color: var(--ink-soft); font-size: 12px; margin-top: 2px; }
.file-target { color: var(--ink-soft); font-size: 12px; }
.remove-file { width: 30px; height: 30px; border: 0; border-radius: 8px; color: var(--ink-soft); background: transparent; cursor: pointer; font-size: 20px; }
.remove-file:hover { color: var(--red); background: rgba(174,32,38,.07); }

.settings-grid { padding: 34px 4px 28px; display: grid; grid-template-columns: .85fr 1.15fr; gap: clamp(28px, 6vw, 70px); border-bottom: 1px solid var(--line); }
.mode-switch { margin-top: 22px; display: grid; gap: 10px; }
.mode-switch label { cursor: pointer; }
.mode-switch input { position: absolute; opacity: 0; }
.mode-switch label > span { padding: 13px 14px; display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--line); border-radius: 12px; transition: border .2s, background .2s; }
.mode-switch input:checked + span { border-color: var(--red); background: rgba(174,32,38,.045); box-shadow: inset 3px 0 var(--red); }
.mode-switch small, .check-field small { color: var(--ink-soft); }
.advanced-settings { display: grid; gap: 18px; align-content: start; transition: opacity .2s; }
.advanced-settings.is-disabled { opacity: .45; pointer-events: none; }
.field { display: grid; gap: 8px; font-weight: 600; font-size: 14px; }
.field select { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: white; }
.range-field > span:first-child { display: flex; justify-content: space-between; }
.range-field output { color: var(--red); }
.range-field input { accent-color: var(--red); }
.range-ends { display: flex; justify-content: space-between; color: var(--ink-soft); font-weight: 400; }
.check-field { display: flex; gap: 12px; align-items: start; cursor: pointer; }
.check-field input { margin-top: 3px; accent-color: var(--red); }
.check-field span { display: flex; flex-direction: column; gap: 2px; }

.naming-rule { margin: 22px 4px; padding: 14px 16px; display: flex; align-items: center; gap: 13px; border-radius: 12px; background: #f4f6f7; }
.rule-icon { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--blue); background: white; font-weight: 800; }
.naming-rule div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 24px; width: 100%; font-size: 13px; }
.naming-rule span:last-child { color: var(--ink-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.optimize-button { width: 100%; min-height: 57px; display: flex; justify-content: center; align-items: center; gap: 10px; border: 0; border-radius: 13px; color: white; background: var(--navy); font: 700 16px Manrope, sans-serif; cursor: pointer; transition: background .2s, transform .15s; }
.optimize-button:hover:not(:disabled) { background: var(--blue); transform: translateY(-1px); }
.optimize-button:disabled { cursor: not-allowed; opacity: .4; }
.optimize-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 2; }

.progress-card { margin-top: 24px; padding: 25px 28px; display: grid; grid-template-columns: auto 1fr; gap: 8px 15px; align-items: center; }
.spinner { grid-row: span 2; width: 42px; height: 42px; border: 4px solid #e3e7e9; border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
.progress-copy { display: flex; justify-content: space-between; gap: 20px; }
.progress-copy span { color: var(--ink-soft); font-size: 13px; }
.progress-track { height: 7px; overflow: hidden; border-radius: 99px; background: #e9edef; }
.progress-track span { display: block; width: 4%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--red), #d24a4f); transition: width .25s; }
@keyframes spin { to { transform: rotate(360deg); } }

.results-card { margin-top: 28px; padding: clamp(23px, 4vw, 42px); }
.success-heading { display: flex; align-items: center; gap: 15px; }
.success-heading h2 { margin-top: 5px; }
.success-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; color: var(--success); background: rgba(25,125,91,.1); }
.success-icon svg { width: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.stats-grid { margin: 28px 0; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.stats-grid > div { padding: 19px; display: flex; flex-direction: column; gap: 5px; border-right: 1px solid var(--line); }
.stats-grid > div:last-child { border: 0; }
.stats-grid span { color: var(--ink-soft); font-size: 12px; }
.stats-grid strong { font: 700 23px Manrope, sans-serif; }
.stats-grid .highlight-stat { background: rgba(25,125,91,.07); }
.stats-grid .highlight-stat strong { color: var(--success); }
.result-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 15px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--ink-soft); background: #f6f7f7; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { max-width: 270px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.saving { color: var(--success); font-weight: 700; }
.error-row { color: var(--red); }
.download-one { color: var(--red); font-weight: 700; text-decoration: none; }
.result-actions { margin-top: 24px; display: flex; justify-content: space-between; gap: 12px; }
.download-all svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.expiry-notice { margin: 16px 0 0; text-align: right; color: var(--ink-soft); font-size: 12px; }

.benefits { padding: 72px 0 86px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px; }
.benefits article { position: relative; padding-top: 21px; border-top: 1px solid #bec7cb; }
.benefits article > span { position: absolute; top: -9px; right: 0; padding-left: 10px; color: var(--red); background: var(--cream); font-size: 11px; font-weight: 700; }
.benefits h3 { margin: 0 0 8px; font: 700 17px Manrope, sans-serif; }
.benefits p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
footer { min-height: 82px; padding: 22px clamp(20px,5vw,72px); display: flex; justify-content: space-between; align-items: center; gap: 20px; color: rgba(255,255,255,.68); background: var(--navy); font-size: 12px; }
footer span:first-child { color: white; font: 700 15px Manrope, sans-serif; }
.toast { position: fixed; z-index: 10; right: 22px; bottom: 22px; max-width: min(390px, calc(100% - 44px)); padding: 13px 16px; border-radius: 11px; color: white; background: var(--navy); box-shadow: 0 15px 40px rgba(0,0,0,.18); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .25s; }
.toast.is-visible { opacity: 1; transform: none; }
.toast.is-error { background: var(--red); }
.hidden { display: none !important; }

@media (max-width: 760px) {
  .topbar { height: 66px; }
  .privacy-pill { display: none; }
  .brand { font-size: 14px; }
  .hero { padding: 58px 6px 35px; }
  .settings-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid > div:nth-child(2) { border-right: 0; }
  .stats-grid > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .benefits { grid-template-columns: 1fr; padding: 55px 0; }
  .queue-item { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .file-target { display: none; }
  .result-actions { flex-direction: column-reverse; }
  .result-actions .button { width: 100%; }
  footer { flex-direction: column; align-items: start; }
}

@media (max-width: 480px) {
  .page-shell { width: min(100% - 20px, 1100px); }
  .workspace-card { padding: 10px; border-radius: 19px; }
  .dropzone { padding: 40px 12px; }
  .source-tabs { grid-template-columns: 1fr; }
  .upload-actions { flex-direction: column; }
  .upload-actions .button { width: 100%; }
  .settings-grid, .queue { padding-left: 8px; padding-right: 8px; }
  .stats-grid { grid-template-columns: 1fr; }
  .stats-grid > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .progress-card { grid-template-columns: auto 1fr; padding: 20px; }
  .progress-copy { flex-direction: column; gap: 2px; }
}
