:root {
  --ink: #17343a;
  --ink-soft: #587078;
  --brand: #0e7180;
  --brand-dark: #0b5964;
  --brand-pale: #e7f3f3;
  --accent: #ee8d5d;
  --canvas: #f3f6f5;
  --surface: #ffffff;
  --line: #dce6e4;
  --line-dark: #c8d5d3;
  --danger: #c9504e;
  --shadow: 0 18px 48px rgba(35, 73, 78, .09);
  --sidebar-width: 226px;
  --header-height: 76px;
  font-family: Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 92% 10%, rgba(14, 113, 128, .07), transparent 28rem),
    var(--canvas);
  color: var(--ink);
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.svg-sprite {
  width: 0;
  height: 0;
  position: absolute;
  overflow: hidden;
}

.hidden { display: none !important; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--header-height) minmax(calc(100vh - var(--header-height)), auto);
}

.topbar {
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid rgba(200, 213, 211, .75);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.4px;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ink);
  display: grid;
  place-items: center;
  position: relative;
  transform: rotate(-3deg);
}

.brand-mark span {
  position: absolute;
  width: 14px;
  height: 10px;
  border: 2px solid white;
  border-radius: 3px;
}

.brand-mark span:first-child { transform: translate(-3px, -3px); }
.brand-mark span:last-child { transform: translate(3px, 3px); border-color: #8ad1d2; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.theme-button,
.language-button {
  height: 42px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: white;
  cursor: pointer;
  font-weight: 800;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

.theme-button {
  width: 42px;
  padding: 0;
}

.language-button { min-width: 70px; }

.theme-button:hover,
.language-button:hover {
  border-color: var(--brand);
  box-shadow: 0 7px 18px rgba(35, 73, 78, .09);
  transform: translateY(-1px);
}

.theme-button svg,
.language-button svg { width: 19px; height: 19px; }

.theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
html[data-theme="dark"] .theme-icon-moon { display: none; }

.language-picker { position: relative; }

.language-chevron {
  width: 14px !important;
  height: 14px !important;
  margin-left: -2px;
  transition: transform .2s;
}

.language-button[aria-expanded="true"] .language-chevron { transform: rotate(180deg); }

.language-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 9px);
  right: 0;
  width: 164px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 16px 38px rgba(20, 53, 58, .17);
  animation: menu-in .18s ease both;
}

@keyframes menu-in { from { opacity: 0; transform: translateY(-5px); } }

.language-menu button {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
}

.language-menu button:hover { color: var(--ink); background: var(--brand-pale); }
.language-menu button.active { color: var(--brand-dark); background: var(--brand-pale); }
.menu-check { visibility: hidden; color: var(--brand); font-weight: 900; }
.language-menu button.active .menu-check { visibility: visible; }

.mobile-menu { display: none; }

.sidebar {
  grid-column: 1;
  grid-row: 2;
  position: sticky;
  top: var(--header-height);
  align-self: start;
  height: calc(100vh - var(--header-height));
  padding: 32px 20px 24px;
  background: #fbfcfc;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 12;
}

.sidebar-heading {
  padding: 0 12px 13px;
  color: #91a1a5;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.35px;
  text-transform: uppercase;
}

.category-nav { display: flex; flex-direction: column; gap: 7px; }

.category-button {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 15px;
  border: 0;
  border-radius: 14px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-weight: 750;
  text-align: left;
  transition: background .2s, color .2s, transform .2s;
}

.category-button:hover { background: #eff4f3; color: var(--ink); }
.category-button:active { transform: scale(.985); }
.category-button svg { width: 23px; height: 23px; flex: none; }

.category-button.active {
  color: var(--brand-dark);
  background: var(--brand-pale);
  box-shadow: inset 3px 0 var(--brand);
}

.sidebar-note {
  margin-top: auto;
  padding: 14px 12px 2px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #8a9a9e;
  font-size: 11px;
  line-height: 1.5;
}

.privacy-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  background: #63ad8c;
  box-shadow: 0 0 0 4px rgba(99, 173, 140, .12);
}

.main-content {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
}

.mode-bar {
  min-height: 76px;
  padding: 13px clamp(24px, 4vw, 62px);
  display: flex;
  align-items: center;
  gap: 24px;
  background: rgba(255, 255, 255, .65);
  border-bottom: 1px solid var(--line);
}

.mode-label {
  flex: none;
  color: #8b9a9e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .7px;
}

.mode-tabs {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.mode-tabs::-webkit-scrollbar { display: none; }

.mode-tab {
  flex: none;
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
  transition: all .2s;
}

.mode-tab:hover { color: var(--ink); background: #edf3f2; }
.mode-tab.active {
  color: var(--brand-dark);
  background: white;
  border-color: var(--line);
  box-shadow: 0 6px 18px rgba(34, 71, 76, .07);
}

.workspace {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.workspace-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 30px;
  margin-bottom: 30px;
}

.eyebrow, .section-kicker, .result-kicker {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.6px;
}

.workspace-heading h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(30px, 4vw, 45px);
  line-height: 1.15;
  letter-spacing: -1.5px;
}

.page-description {
  max-width: 580px;
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.7;
}

.back-button {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.back-button span:first-child { margin-right: 4px; font-size: 17px; }

.step-indicator {
  flex: none;
  display: flex;
  align-items: flex-start;
  padding-bottom: 5px;
}

.step { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #a6b3b5; }

.step span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  background: var(--canvas);
  font-size: 11px;
  font-weight: 800;
}

.step em { font-size: 10px; font-style: normal; font-weight: 700; }
.step.active { color: var(--brand); }
.step.active span { color: white; border-color: var(--brand); background: var(--brand); }

.step-indicator > i {
  width: 42px;
  height: 1px;
  margin: 14px 6px 0;
  background: var(--line-dark);
}

.dropzone {
  width: 100%;
  min-height: 390px;
  padding: 50px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed #a9bfbd;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 45%, rgba(14, 113, 128, .055), transparent 15rem),
    rgba(255, 255, 255, .8);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color .2s, transform .2s, background .2s;
}

.dropzone:hover, .dropzone.dragging {
  border-color: var(--brand);
  background-color: #faffff;
  transform: translateY(-2px);
}

.drop-illustration {
  width: 92px;
  height: 88px;
  display: block;
  position: relative;
  margin-bottom: 26px;
}

.file-sheet {
  position: absolute;
  width: 58px;
  height: 70px;
  border-radius: 10px;
}

.sheet-back {
  top: 2px;
  left: 14px;
  background: #cae2e1;
  border: 1px solid #9fc9c7;
  transform: rotate(-9deg);
}

.sheet-front {
  right: 8px;
  bottom: 2px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: white;
  box-shadow: 0 12px 24px rgba(14, 113, 128, .22);
  transform: rotate(4deg);
}

.sheet-front::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-style: solid;
  border-width: 0 15px 15px 0;
  border-color: transparent rgba(255, 255, 255, .55) transparent transparent;
}

.sheet-front svg { width: 27px; height: 27px; }

.dropzone strong { font-size: 22px; letter-spacing: -.3px; }
.drop-or { margin: 8px 0; color: #9aa9ac; font-size: 12px; }

.browse-pill {
  padding: 10px 20px;
  border-radius: 11px;
  color: var(--brand-dark);
  background: var(--brand-pale);
  font-size: 13px;
  font-weight: 850;
}

.dropzone small { margin-top: 22px; color: #899a9e; }

.pending-files {
  margin-top: 18px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}

.pending-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.pending-header strong { font-size: 13px; }

.pending-header button {
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.pending-list { display: flex; gap: 8px; margin-top: 13px; overflow-x: auto; }

.pending-item {
  max-width: 220px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #f2f6f5;
  color: var(--ink-soft);
  font-size: 12px;
}

.pending-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-item button { border: 0; background: transparent; color: #899a9e; cursor: pointer; font-size: 16px; }

.primary-action-row { display: flex; justify-content: center; margin-top: 26px; }

.primary-button {
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 10px 25px rgba(14, 113, 128, .22);
  transition: background .2s, transform .2s, box-shadow .2s;
}

.primary-button:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 13px 27px rgba(14, 113, 128, .26); }
.primary-button:active { transform: translateY(0) scale(.985); }
.primary-button:disabled { cursor: not-allowed; color: #a3aeaf; background: #dfe6e5; box-shadow: none; transform: none; }
.primary-button svg { width: 18px; height: 18px; }

.convert-view { animation: fade-in .32s ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(7px); } }

.files-section, .options-section {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: white;
  box-shadow: 0 14px 38px rgba(35, 73, 78, .06);
}

.options-section { margin-top: 22px; }

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-kicker { display: block; margin-bottom: 5px; }
.section-title-row h2 { margin: 0; font-size: 19px; letter-spacing: -.35px; }

.file-count {
  min-width: 34px;
  height: 30px;
  padding: 0 10px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--brand-pale);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
}

.file-cards {
  display: flex;
  align-items: stretch;
  gap: 13px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  min-height: 166px;
  scrollbar-color: #c9d6d4 transparent;
}

.file-card {
  width: 166px;
  min-width: 166px;
  position: relative;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfc;
  cursor: grab;
  user-select: none;
  transition: opacity .2s, border-color .2s, transform .2s, box-shadow .2s;
}

.file-card:hover { border-color: #aec7c4; transform: translateY(-2px); box-shadow: 0 9px 22px rgba(35, 73, 78, .08); }
.file-card.dragging { opacity: .4; border-color: var(--brand); }
.file-card.drag-over { transform: translateX(7px); }

.file-preview {
  height: 86px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, #e8f2f1, #f3f6f5);
  color: var(--brand);
}

.file-preview img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.file-preview svg { width: 38px; height: 38px; }

.file-details { min-width: 0; padding-top: 10px; }
.file-name { overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.file-size { margin-top: 3px; color: #91a0a3; font-size: 10px; }

.more-button {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 13px rgba(20, 53, 58, .11);
}

.more-button svg { width: 17px; height: 17px; }

.file-menu {
  position: absolute;
  z-index: 5;
  top: 51px;
  right: 13px;
  width: 112px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  box-shadow: 0 12px 30px rgba(20, 53, 58, .16);
}

.file-menu button {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.file-menu button:hover { background: #fff0ef; }

.option-list { display: flex; flex-direction: column; gap: 10px; }

.markdown-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.markdown-setting-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, #fff, #f9fbfb);
}

.markdown-setting-card.page-number-setting,
.markdown-setting-card.markdown-preset-card,
.markdown-setting-card.font-setting { grid-column: 1 / -1; }

.markdown-setting-card h3 {
  margin: 0 0 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 13px;
}

.markdown-setting-card h3 span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--brand);
  background: var(--brand-pale);
  font-size: 9px;
  letter-spacing: .3px;
}

.layout-choice-row { display: grid; gap: 8px; }
.orientation-choices { grid-template-columns: repeat(2, 1fr); }
.preset-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.column-choices, .margin-choices { grid-template-columns: repeat(3, 1fr); }
.page-number-choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.font-choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.layout-choice {
  min-height: 48px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink-soft);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color .18s, color .18s, background .18s, box-shadow .18s, transform .18s;
}

.layout-choice:hover { border-color: #9bbfbe; transform: translateY(-1px); }
.layout-choice strong { display: block; color: inherit; font-size: 12px; line-height: 1.3; }
.layout-choice small { display: block; margin-top: 4px; color: #8b9a9d; font-size: 9px; }

.layout-choice.active {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: #eef8f7;
  box-shadow: 0 0 0 3px rgba(14, 113, 128, .06);
}

.markdown-custom-margin {
  width: min(210px, 100%);
  height: 42px;
  margin-top: 10px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--brand);
  border-radius: 11px;
  background: var(--surface);
}

.markdown-custom-margin input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 750;
}

.markdown-custom-margin span { color: var(--ink-soft); font-size: 11px; font-weight: 750; }

.option-row {
  min-height: 66px;
  padding: 11px 14px 11px 17px;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s;
}

.option-row:hover { border-color: #aac3c0; }
.option-row.selected { border-color: var(--brand); background: #f5fbfa; box-shadow: 0 0 0 3px rgba(14, 113, 128, .06); }

.radio-dot {
  width: 20px;
  height: 20px;
  border: 1.5px solid #aebdbc;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}

.radio-dot::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
  transform: scale(0);
  transition: transform .17s;
}

.selected .radio-dot { border-color: var(--brand); }
.selected .radio-dot::after { transform: scale(1); }

.option-copy { min-width: 0; flex: 1; }
.option-copy strong { display: block; font-size: 14px; }
.option-copy small { display: block; margin-top: 3px; color: #8a9a9d; font-size: 11px; }

.custom-field {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
}

.custom-field input {
  width: 105px;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  outline: none;
  color: var(--ink);
  background: white;
  text-align: right;
  font-weight: 750;
  transition: border-color .2s, box-shadow .2s;
}

.custom-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 113, 128, .1); }
.custom-field span { min-width: 34px; color: var(--ink-soft); font-size: 12px; font-weight: 750; }

.single-option {
  min-height: 92px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid #bad1cf;
  border-radius: 15px;
  background: #f4faf9;
}

.single-option-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--brand-pale);
  color: var(--brand);
}

.single-option-icon svg { width: 25px; height: 25px; }
.single-option strong { display: block; margin-bottom: 5px; }
.single-option p { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }

.convert-action-row {
  margin-top: 24px;
  padding: 19px 0 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
}

.selection-summary { min-width: 0; text-align: right; }
.selection-summary span { display: block; color: #92a1a4; font-size: 10px; font-weight: 800; letter-spacing: .7px; }
.selection-summary strong { display: block; max-width: 350px; margin-top: 4px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.convert-button { min-width: 158px; }

.toast-region {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  width: min(360px, calc(100vw - 44px));
  pointer-events: none;
}

.toast {
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid #f0cac7;
  border-radius: 13px;
  background: #fff8f7;
  color: #8f3633;
  box-shadow: 0 12px 30px rgba(69, 42, 40, .14);
  font-size: 13px;
  font-weight: 700;
  animation: toast-in .25s ease both;
}

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.modal-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(14, 38, 42, .58);
  backdrop-filter: blur(7px);
}

.modal-card {
  width: min(460px, 100%);
  padding: 42px;
  border-radius: 25px;
  background: white;
  box-shadow: 0 30px 80px rgba(6, 29, 33, .25);
  text-align: center;
  animation: modal-in .28s ease both;
}

@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

.spinner {
  width: 68px;
  height: 68px;
  margin: 0 auto 24px;
  padding: 7px;
  border-radius: 50%;
  background: conic-gradient(var(--brand), #cae3e1, var(--brand));
  animation: spin 1s linear infinite;
}

.spinner span { display: block; width: 100%; height: 100%; border-radius: 50%; background: white; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal-card h2 { margin: 0; font-size: 25px; }
.modal-card p { margin: 12px auto 0; color: var(--ink-soft); font-size: 13px; line-height: 1.65; }

.progress-details {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--ink-soft);
  font-size: 11px;
  text-align: left;
}

.progress-details span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-details strong { flex: none; color: var(--brand); font-size: 13px; }
.progress-track { height: 7px; margin-top: 9px; overflow: hidden; border-radius: 4px; background: #e5eceb; }
.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #61c4c6);
  box-shadow: 0 0 12px rgba(78, 175, 185, .34);
  transition: width .28s ease;
}

.success-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e5f5ed;
  color: #3b986e;
}

.success-icon svg { width: 34px; height: 34px; }
.result-kicker { display: block; margin-bottom: 8px; color: #3b986e; }
.result-card p { word-break: break-word; }
.download-button { width: 100%; margin-top: 25px; }

.text-button {
  margin-top: 16px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 900px) {
  :root { --sidebar-width: 190px; }
  .workspace { width: min(100% - 36px, 1040px); padding-top: 36px; }
  .workspace-heading { align-items: flex-start; }
  .step-indicator { display: none; }
  .mode-bar { padding-inline: 26px; }
}

@media (max-width: 700px) {
  :root { --header-height: 65px; }
  .app-shell { display: block; }
  .topbar { height: var(--header-height); padding: 0 17px; }
  .brand { font-size: 17px; }
  .brand-mark { width: 30px; height: 30px; }
  .topbar-actions { gap: 6px; }
  .theme-button { width: 39px; height: 39px; }
  .language-button { min-width: 62px; height: 39px; padding: 0 9px; gap: 5px; }

  .mobile-menu {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: #f0f4f3;
    cursor: pointer;
  }

  .mobile-menu span { width: 17px; height: 1.5px; background: var(--ink); }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: min(270px, 80vw);
    height: calc(100vh - var(--header-height));
    transform: translateX(-105%);
    transition: transform .25s ease;
    box-shadow: 18px 0 38px rgba(20, 53, 58, .13);
  }

  .sidebar.open { transform: translateX(0); }
  .main-content { min-height: calc(100vh - var(--header-height)); }
  .mode-bar { min-height: auto; padding: 10px 17px; display: block; }
  .mode-label { margin: 0 0 6px 4px; font-size: 9px; }
  .mode-tab { min-height: 38px; padding: 0 13px; font-size: 12px; }
  .workspace { width: calc(100% - 30px); padding: 28px 0 48px; }
  .workspace-heading { margin-bottom: 22px; }
  .workspace-heading h1 { font-size: 30px; letter-spacing: -.8px; }
  .page-description { margin-top: 8px; font-size: 13px; }
  .dropzone { min-height: 335px; padding: 38px 15px; border-radius: 20px; }
  .dropzone strong { font-size: 19px; }
  .files-section, .options-section { padding: 20px 16px; border-radius: 18px; }
  .file-card { width: 148px; min-width: 148px; }
  .option-row { align-items: flex-start; flex-wrap: wrap; }
  .markdown-options { grid-template-columns: 1fr; }
  .markdown-setting-card.page-number-setting,
  .markdown-setting-card.markdown-preset-card,
  .markdown-setting-card.font-setting { grid-column: auto; }
  .margin-choices { grid-template-columns: 1fr; }
  .page-number-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preset-choices, .font-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .custom-field { width: 100%; padding-left: 33px; }
  .custom-field input { flex: 1; text-align: left; }
  .convert-action-row { align-items: stretch; flex-direction: column; gap: 13px; }
  .selection-summary { text-align: left; }
  .selection-summary strong { max-width: 100%; }
  .convert-button { width: 100%; }
  .modal-card { padding: 34px 23px; }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e7f1f0;
  --ink-soft: #9db0b3;
  --brand: #4eafb9;
  --brand-dark: #79cbd3;
  --brand-pale: #19383d;
  --accent: #f09a70;
  --canvas: #0d171a;
  --surface: #152226;
  --line: #293b3f;
  --line-dark: #3a5054;
  --danger: #ff817d;
  --shadow: 0 18px 50px rgba(0, 0, 0, .23);
}

html[data-theme="dark"] body {
  background: radial-gradient(circle at 92% 10%, rgba(78, 175, 185, .09), transparent 28rem), var(--canvas);
}

html[data-theme="dark"] .topbar { background: rgba(16, 28, 31, .92); border-bottom-color: var(--line); }
html[data-theme="dark"] .brand-mark { background: #28555c; }
html[data-theme="dark"] .theme-button,
html[data-theme="dark"] .language-button { color: var(--ink); background: var(--surface); }
html[data-theme="dark"] .language-menu { box-shadow: 0 18px 42px rgba(0, 0, 0, .34); }
html[data-theme="dark"] .sidebar { background: #111d20; }
html[data-theme="dark"] .category-button:hover { background: #19282c; }
html[data-theme="dark"] .category-button.active { color: #85d2d9; }
html[data-theme="dark"] .mode-bar { background: rgba(18, 30, 33, .72); }
html[data-theme="dark"] .mode-tab:hover { background: #18282b; }
html[data-theme="dark"] .mode-tab.active { color: #8bd7de; background: var(--surface); box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
html[data-theme="dark"] .dropzone {
  border-color: #3d5a5e;
  background: radial-gradient(circle at 50% 45%, rgba(78, 175, 185, .07), transparent 15rem), rgba(20, 34, 38, .82);
}
html[data-theme="dark"] .dropzone:hover,
html[data-theme="dark"] .dropzone.dragging { background-color: #142529; }
html[data-theme="dark"] .sheet-back { background: #285158; border-color: #3c737a; }
html[data-theme="dark"] .sheet-front { background: #218693; }
html[data-theme="dark"] .pending-files,
html[data-theme="dark"] .files-section,
html[data-theme="dark"] .options-section { background: var(--surface); box-shadow: 0 14px 38px rgba(0, 0, 0, .16); }
html[data-theme="dark"] .pending-item { background: #1d2d31; }
html[data-theme="dark"] .primary-button { color: white; background: #168796; box-shadow: 0 10px 25px rgba(0, 0, 0, .24); }
html[data-theme="dark"] .primary-button:hover { background: #1b98a7; }
html[data-theme="dark"] .primary-button:disabled { color: #6f8083; background: #26363a; }
html[data-theme="dark"] .file-card { background: #111e21; }
html[data-theme="dark"] .file-preview { background: linear-gradient(145deg, #1c3439, #18282c); }
html[data-theme="dark"] .more-button { color: var(--ink); background: rgba(22, 36, 40, .94); box-shadow: 0 4px 13px rgba(0, 0, 0, .24); }
html[data-theme="dark"] .file-menu { background: #19272b; box-shadow: 0 12px 30px rgba(0, 0, 0, .32); }
html[data-theme="dark"] .file-menu button:hover { background: #382729; }
html[data-theme="dark"] .option-row.selected { border-color: var(--brand); background: #142b2f; }
html[data-theme="dark"] .markdown-setting-card { background: linear-gradient(145deg, #17262a, #132125); }
html[data-theme="dark"] .layout-choice { background: #111e21; }
html[data-theme="dark"] .layout-choice.active { color: #8bd7de; background: #142b2f; }
html[data-theme="dark"] .markdown-custom-margin { background: #101c1f; }
html[data-theme="dark"] .custom-field input { color: var(--ink); background: #101c1f; }
html[data-theme="dark"] .single-option { border-color: #345c61; background: #142b2f; }
html[data-theme="dark"] .toast { border-color: #694143; background: #2d2224; color: #ffaaa6; }
html[data-theme="dark"] .modal-backdrop { background: rgba(3, 10, 12, .72); }
html[data-theme="dark"] .modal-card { background: var(--surface); box-shadow: 0 30px 80px rgba(0, 0, 0, .48); }
html[data-theme="dark"] .spinner span { background: var(--surface); }
html[data-theme="dark"] .progress-track { background: #26383c; }
html[data-theme="dark"] .success-icon { background: #17382e; }
html[data-theme="dark"] .mobile-menu { background: #1c2c30; }
html[data-theme="dark"] .mobile-menu span { background: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
