:root {
  --ink: #18212c;
  --muted: #687383;
  --soft: #f5f7fb;
  --line: #dfe5ec;
  --card: #ffffff;
  --coral: #ef6b4d;
  --coral-dark: #d9573a;
  --coral-wash: #fff0eb;
  --mint: #dff2eb;
  --shadow: 0 18px 45px rgba(31, 47, 65, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 85% 0%, rgba(239, 107, 77, 0.1), transparent 28rem),
    var(--soft);
  color: var(--ink);
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex="0"]:focus-visible {
  outline: 3px solid rgba(239, 107, 77, 0.35);
  outline-offset: 3px;
}

.site-header, main, .site-footer { width: min(1160px, calc(100% - 48px)); margin-inline: auto; }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 28px 0;
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-size: 15px; letter-spacing: -0.02em; text-decoration: none; }
.brand strong { font-weight: 750; }
.brand-mark { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; background: var(--coral); box-shadow: 0 5px 13px rgba(239,107,77,.22); }
.brand-mark svg { width: 24px; fill: none; stroke: #fffaf7; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.brand-mark svg circle { fill: #fffaf7; stroke: none; }
.privacy-pill { display: inline-flex; align-items: center; gap: 8px; color: #61706f; font-size: 12px; font-weight: 600; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #47a786; box-shadow: 0 0 0 4px rgba(71,167,134,.13); }

.hero { padding: 70px 0 42px; text-align: center; }
.eyebrow, .section-kicker { color: var(--coral-dark); font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.hero h1 { margin: 13px 0 16px; font-size: clamp(42px, 7vw, 76px); line-height: .98; letter-spacing: -.065em; font-weight: 760; }
.hero h1 em { color: var(--coral); font-style: normal; }
.hero-copy { max-width: 470px; margin: 0 auto; color: var(--muted); font-size: 17px; line-height: 1.55; }

.workspace { max-width: 900px; margin: 0 auto; }
.upload-card {
  position: relative;
  min-height: 280px;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 32px;
  border: 1.5px dashed #cfd8e2;
  border-radius: 22px;
  background: rgba(255,255,255,.62);
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.upload-card:hover, .upload-card.is-dragging { border-color: var(--coral); background: #fff9f6; }
.upload-card.is-dragging { transform: scale(1.008); }
.upload-icon { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 19px; background: var(--coral-wash); color: var(--coral); }
.upload-icon svg { width: 31px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; }
.upload-title { margin-top: 20px; font-size: 18px; font-weight: 750; letter-spacing: -.02em; }
.upload-subtitle { margin-top: 7px; color: var(--muted); font-size: 14px; }
.upload-link { color: var(--coral-dark); font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }
.notice { min-height: 0; color: #a64d34; font-size: 13px; line-height: 1.45; }
.notice:not(:empty) { margin: 12px 4px -1px; padding: 11px 13px; border-radius: 10px; background: #fff1ec; }

.results-panel { margin-top: 18px; padding: clamp(20px, 4vw, 32px); border: 1px solid rgba(220, 227, 235, .9); border-radius: 20px; background: var(--card); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading h2 { margin: 6px 0 0; font-size: 23px; letter-spacing: -.045em; }
.text-button { padding: 3px 0; border: 0; background: transparent; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 4px; }
.text-button:hover { color: var(--coral-dark); }

.select-wrap { position: relative; display: block; }
.select-wrap::after { position: absolute; top: 50%; right: 14px; color: var(--muted); content: "⌄"; pointer-events: none; transform: translateY(-56%); }
select { width: 100%; height: 43px; padding: 0 38px 0 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; }

.action-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 28px; }
.ready-count { margin-right: auto; color: var(--muted); font-size: 12px; }
.primary-button, .secondary-button { min-height: 42px; padding: 0 16px; border-radius: 10px; font-size: 13px; font-weight: 750; transition: .18s; }
.primary-button { border: 1px solid var(--coral); color: #fff; background: var(--coral); box-shadow: 0 7px 16px rgba(239,107,77,.18); }
.primary-button:hover:not(:disabled) { border-color: var(--coral-dark); background: var(--coral-dark); transform: translateY(-1px); }
.primary-button:disabled { opacity: .45; box-shadow: none; }
.button-icon { display: inline-block; margin-right: 6px; font-size: 16px; transform: rotate(-45deg); }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: #fff; }
.secondary-button:hover:not(:disabled) { border-color: #b7c1cd; background: #fafbfd; }

.results-panel { border-color: #d8e9e2; }
.results-heading { align-items: center; }
.results-list { display: grid; gap: 10px; margin-top: 22px; }
.result-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 13px; padding: 10px; border: 1px solid #e9edf0; border-radius: 12px; }
.result-name { overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.result-size { margin-top: 5px; color: var(--muted); font-size: 11px; }
.download-button { min-height: 34px; padding: 0 11px; border: 1px solid #d4e6df; border-radius: 8px; color: #377f69; background: #f4fbf8; font-size: 12px; font-weight: 750; }
.download-button:hover { background: var(--mint); }

.site-footer { display: flex; justify-content: space-between; padding: 22px 0 34px; border-top: 1px solid #dfe5ea; color: #89949f; font-size: 11px; }

.is-hidden { display: none !important; }
.is-busy .upload-card { pointer-events: none; opacity: .66; }

@media (max-width: 680px) {
  .site-header, main, .site-footer { width: min(100% - 28px, 560px); }
  .site-header { padding: 18px 0; }
  .privacy-pill { font-size: 0; }
  .privacy-pill .status-dot { margin-right: 2px; }
  .hero { padding: 52px 0 30px; }
  .hero h1 { font-size: clamp(40px, 13vw, 58px); }
  .hero-copy { font-size: 15px; }
  .upload-card { min-height: 245px; }
  .action-row { align-items: stretch; flex-wrap: wrap; }
  .ready-count { width: 100%; margin: 0 0 1px; }
  .primary-button, .secondary-button { flex: 1; }
  .results-heading { align-items: flex-start; flex-direction: column; }
  .results-heading .secondary-button { width: 100%; flex: initial; }
  .site-footer { align-items: flex-start; flex-direction: column; gap: 8px; }
}

/* ============ Extended tokens (redesign) ============ */
:root {
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-md: var(--shadow);
  --shadow-lg: 0 24px 60px rgba(20, 30, 45, .2);
  --success: #1f9d6b;
  --success-dark: #16794f;
  --success-wash: #e7f7ef;
  --warning: #b8790a;
  --warning-wash: #fff4e0;
  --danger: var(--coral-dark);
  --danger-wash: var(--coral-wash);
  --info: #3563e0;
  --info-wash: #eaf1ff;
  --sidebar-w: 228px;
  --sidebar-w-collapsed: 66px;
  --header-h: 58px;
}

/* ============ App shell ============ */
.app-shell { display: flex; align-items: stretch; min-height: 100vh; }

.sidebar {
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-inline-end: 1px solid var(--line);
  background: #fff;
  transition: width .18s ease, transform .2s ease;
}
.sidebar.is-collapsed { width: var(--sidebar-w-collapsed); }
.sidebar-header { display: flex; align-items: center; padding: 16px 14px; min-height: var(--header-h); border-bottom: 1px solid var(--line); }
.sidebar-nav { flex: 1; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-section-label { margin: 12px 12px 4px; color: #9aa5b1; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.sidebar.is-collapsed .sidebar-section-label { display: none; }
.sidebar-link {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 11px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted);
  font-size: 13.5px; font-weight: 650; text-decoration: none; text-align: start; cursor: pointer;
}
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link:hover { background: var(--soft); color: var(--ink); }
.sidebar-link.is-active { background: var(--coral-wash); color: var(--coral-dark); }
.sidebar-link.is-disabled { color: #b1b9c2; cursor: not-allowed; }
.sidebar-link.is-disabled:hover { background: transparent; color: #b1b9c2; }
.sidebar-link .soon-tag { margin-inline-start: auto; flex-shrink: 0; padding: 2px 6px; border-radius: 999px; background: #eef1f4; color: #9aa5b1; font-size: 9px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.sidebar.is-collapsed .link-label, .sidebar.is-collapsed .soon-tag, .sidebar.is-collapsed .sidebar-header .brand-text { display: none; }
.sidebar.is-collapsed .sidebar-link { justify-content: center; }
.sidebar-footer { padding: 10px; border-top: 1px solid var(--line); }
.sidebar-collapse-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 650; }
.sidebar-collapse-btn svg { width: 17px; height: 17px; flex-shrink: 0; transition: transform .18s ease; }
.sidebar.is-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.sidebar-collapse-btn:hover { background: var(--soft); color: var(--ink); }
.sidebar-backdrop { display: none; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: var(--header-h); padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(8px);
}
.app-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mobile-menu-button { display: none; }
.page-title { font-size: 14px; font-weight: 750; letter-spacing: -.01em; white-space: nowrap; }
.page-title-crumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; min-width: 0; }
.page-title-crumb svg { width: 13px; height: 13px; flex-shrink: 0; }
.app-header-right { display: flex; align-items: center; gap: 8px; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #fff; color: var(--muted);
}
.icon-button svg { width: 17px; height: 17px; }
.icon-button:hover { color: var(--ink); border-color: #b7c1cd; }
.icon-button.is-active { color: var(--coral-dark); border-color: var(--coral); background: var(--coral-wash); }

.app-content { flex: 1; padding: 22px 24px 64px; }
.content-inner { max-width: 1320px; margin: 0 auto; }

/* ============ Step indicator ============ */
.step-indicator { display: flex; align-items: center; flex-wrap: wrap; gap: 0; margin-bottom: 22px; list-style: none; padding: 0; }
.step-indicator li { display: flex; align-items: center; gap: 8px; }
.step-indicator .step-num {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 21px; height: 21px; border-radius: 50%; border: 1.5px solid var(--line);
  font-size: 10.5px; font-weight: 800; color: var(--muted); background: #fff;
}
.step-indicator .step-num svg { width: 11px; height: 11px; }
.step-indicator .step-label { font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.step-indicator li.is-done .step-num { background: var(--success); border-color: var(--success); color: #fff; }
.step-indicator li.is-active .step-num { border-color: var(--coral); color: var(--coral-dark); }
.step-indicator li.is-active .step-label { color: var(--ink); }
.step-connector { width: 22px; height: 1.5px; background: var(--line); margin: 0 8px; flex-shrink: 0; }
.step-indicator li.is-done + .step-connector { background: var(--success); }

/* ============ Toggle switch ============ */
.switch { position: relative; display: inline-flex; align-items: center; width: 34px; height: 20px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: #d7dde4; transition: background .15s; }
.switch .thumb { position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(15,23,32,.3); transition: transform .15s; }
.switch input:checked ~ .track { background: var(--coral); }
.switch input:checked ~ .thumb { transform: translateX(14px); }
[dir="rtl"] .switch input:checked ~ .thumb { transform: translateX(-14px); }
.switch input:focus-visible ~ .track { outline: 3px solid rgba(239,107,77,.35); outline-offset: 2px; }
.switch input:disabled ~ .track { opacity: .5; cursor: not-allowed; }

/* ============ Toasts ============ */
.toast-region { position: fixed; inset-inline-end: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 9px; width: min(340px, calc(100vw - 36px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 13px; border-radius: var(--radius-md); background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 600; line-height: 1.4; box-shadow: var(--shadow-lg); animation: toast-in .18s ease; }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.toast.is-success { background: #12281f; }
.toast.is-error { background: #3a1712; }
.toast.is-leaving { animation: toast-out .15s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ============ Misc shared ============ */
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line); background: #fbfcfd; box-shadow: 0 1px 0 var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 650; color: var(--muted); }

.popover-panel { position: absolute; z-index: 60; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-lg); overflow: hidden; }

@media (max-width: 900px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50; transform: translateX(-101%); box-shadow: var(--shadow-lg); }
  [dir="rtl"] .sidebar { transform: translateX(101%); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar.is-collapsed { width: var(--sidebar-w); }
  .sidebar.is-collapsed .link-label, .sidebar.is-collapsed .soon-tag, .sidebar.is-collapsed .sidebar-header .brand-text { display: initial; }
  .sidebar-footer { display: none; }
  .sidebar-backdrop.is-visible { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(15,23,32,.35); }
  .mobile-menu-button { display: inline-flex; }
  .app-header { padding: 0 14px; }
  .app-content { padding: 16px 14px 90px; }
  .page-title-crumb span:first-child { display: none; }
}
