:root {
  --ink: var(--tools-text);
  --muted: var(--tools-muted);
  --paper: var(--tools-bg);
  --surface: var(--tools-surface);
  --line: var(--tools-line);
  --green: var(--tools-green);
  --green-dark: var(--tools-green-strong);
  --green-soft: var(--tools-green-soft);
  --red: var(--tools-red);
  --shadow: var(--tools-shadow);
  color: var(--ink);
  background: var(--paper);
  font-family: var(--tools-sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(circle at 12% 15%, color-mix(in srgb, var(--green) 8%, transparent), transparent 25rem), var(--paper);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }
[v-cloak] { display: none; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 750;
  letter-spacing: -.02em;
  text-decoration: none;
}

main { width: min(1040px, calc(100% - 40px)); margin: 0 auto; }
.hero { max-width: 850px; margin: 42px auto 54px; text-align: center; }
.eyebrow, .step-label {
  margin: 0 0 12px;
  color: var(--green-dark);
  font: 700 .72rem/1.3 var(--tools-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 900px;
  margin: 0 auto;
  font-family: var(--tools-serif);
  font-size: clamp(2.7rem, 6vw, 4.9rem);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.055em;
}
.hero-copy { max-width: 680px; margin: 28px auto 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.16rem); line-height: 1.75; }
.hero-proof { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px 20px; margin: 22px 0 0; padding: 0; color: var(--green-dark); font-size: .77rem; font-weight: 750; list-style: none; }
.hero-proof li, .privacy-note, .local-note { display: inline-flex; align-items: center; gap: 7px; }
.hero-proof svg, .privacy-note svg, .local-note svg { width: 15px; height: 15px; flex: 0 0 auto; }

.workspace {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  transition: border-color .2s, transform .2s;
}
.workspace.is-dragging { border-color: var(--green); transform: scale(1.005); }
.empty-state {
  min-height: 430px;
  padding: 62px clamp(24px, 7vw, 78px);
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 24px 50px;
}
.empty-visual { width: 150px; height: auto; grid-column: 1; grid-row: 1 / -1; object-fit: contain; }
.empty-copy, .file-action, .privacy-note, .drop-hint, .empty-progress, .empty-error { grid-column: 2; }
.empty-state h2, .form-heading h2, .guide-heading h2 {
  margin: 0;
  font-family: var(--tools-serif);
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  font-weight: 500;
  letter-spacing: -.035em;
}
.empty-state p:not(.step-label), .guide-heading > p:last-child { max-width: 650px; margin: 10px 0 0; color: var(--muted); line-height: 1.65; }
.file-action {
  min-height: 92px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--tools-on-action);
  text-align: start;
  border: 1px solid var(--tools-action);
  border-radius: 14px;
  background: var(--tools-action);
  transition: transform .18s, background .18s, box-shadow .18s;
}
.file-action > span:last-child { display: grid; gap: 4px; }
.file-action strong { font-size: .96rem; }
.file-action small { font-size: .74rem; opacity: .82; }
.action-icon { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 11px; }
.action-icon svg { width: 23px; height: 23px; }
.privacy-note, .drop-hint { margin: -4px 0 0 !important; font-size: .74rem; }
.privacy-note { color: var(--green-dark) !important; font-weight: 700; }
.drop-hint { margin-top: -13px !important; color: var(--muted) !important; text-align: center; }

.work-form { padding: clamp(26px, 6vw, 62px); }
.form-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.local-note { max-width: 260px; color: var(--green-dark); font-size: .74rem; font-weight: 700; text-align: end; }
.source-toolbar { margin-top: 30px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.source-toolbar > strong { min-width: 0; overflow-wrap: anywhere; font-size: .9rem; }

.file-list { margin-top: 18px; display: grid; gap: 12px; }
.file-card {
  min-width: 0;
  min-height: 92px;
  padding: 14px;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--tools-surface-soft);
}
.file-preview, .pdf-icon { width: 62px; height: 62px; border: 1px solid color-mix(in srgb, var(--green) 25%, var(--line)); border-radius: 9px; background: white; object-fit: contain; }
.pdf-icon { display: grid; place-items: center; color: var(--green-dark); background: var(--green-soft); }
.pdf-icon svg { width: 26px; height: 26px; }
.file-copy { min-width: 0; display: grid; gap: 4px; }
.file-copy strong { overflow-wrap: anywhere; font-size: .91rem; }
.file-copy small { color: var(--muted); font-size: .74rem; }
.item-controls { display: inline-flex; align-items: center; gap: 5px; }
.item-controls button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.item-controls button svg { width: 17px; height: 17px; }
.drag-handle { cursor: grab; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.is-source-dragging { opacity: .28; }
.is-reordering, .is-reordering * { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

.option-panel, .password-panel { margin: 24px 0 0; padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: var(--tools-surface-soft); }
.option-panel legend { padding: 0 7px; font-size: .88rem; font-weight: 750; }
.option-choice { min-height: 62px; display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; }
.option-choice + .option-choice { border-top: 1px solid var(--line); }
.option-choice input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--green); }
.option-choice span { display: grid; gap: 3px; }
.option-choice strong { font-size: .87rem; }
.option-choice small, .range-field small, .password-panel > small { color: var(--muted); font-size: .75rem; line-height: 1.5; }
.range-field { margin-top: 12px; display: grid; gap: 8px; }
.range-field > span, .password-panel label > span { font-size: .82rem; font-weight: 750; }
.range-field input, .password-panel input[type='password'], .password-panel input[type='text'] {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.split-direct-help { margin-top: 14px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.split-direct-help svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--green-dark); }
.split-group-summary { margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 7px; list-style: none; }
.split-group-summary li { padding: 7px 9px; display: inline-flex; align-items: baseline; gap: 6px; border: 1px solid color-mix(in srgb, var(--green) 32%, var(--line)); border-radius: 9px; background: var(--surface); }
.split-group-summary strong { color: var(--green-dark); font-size: .73rem; }
.split-group-summary span { color: var(--muted); font-size: .7rem; }
.password-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.password-panel > label:not(.show-passwords) { display: grid; gap: 8px; }
.show-passwords { grid-column: 1 / -1; min-height: 44px; display: flex; align-items: center; gap: 9px; width: fit-content; font-size: .82rem; font-weight: 700; }
.show-passwords input { width: 18px; height: 18px; accent-color: var(--green); }
.show-passwords svg { width: 18px; height: 18px; }
.password-panel > small { grid-column: 1 / -1; }

.page-grid { margin-top: 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.page-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 7px 16px rgb(24 35 30 / 7%); }
.page-card.has-split-group { border-color: color-mix(in srgb, var(--green) 34%, var(--line)); }
.page-preview { aspect-ratio: 3 / 4; display: grid; place-items: center; overflow: hidden; background: #e9e8e2; }
.page-preview img { width: 100%; height: 100%; display: block; object-fit: contain; }
.page-caption { min-height: 55px; padding: 9px; display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.page-identity { min-width: 0; display: grid; gap: 2px; }
.page-identity strong { font-size: .78rem; }
.page-identity small { color: var(--green-dark); font-size: .66rem; font-weight: 750; }
.page-controls { gap: 3px; }
.page-controls button { width: 36px; height: 36px; }
.page-controls button svg { width: 15px; height: 15px; }
.split-toggle { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.split-toggle svg { width: 17px; height: 17px; }
.split-toggle.is-active { color: var(--tools-on-action); border-color: var(--tools-action); background: var(--tools-action); }
.split-divider { min-width: 0; min-height: 100%; padding: 18px 12px; display: grid; place-content: center; justify-items: center; gap: 6px; color: var(--green-dark); text-align: center; border: 1px dashed color-mix(in srgb, var(--green) 62%, var(--line)); border-radius: 14px; background: color-mix(in srgb, var(--green-soft) 72%, var(--surface)); }
.split-divider svg { width: 28px; height: 28px; }
.split-divider strong { font-size: .8rem; }
.split-divider small { color: var(--muted); font-size: .68rem; }

.button { min-height: 46px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid transparent; border-radius: 10px; font-weight: 750; transition: transform .18s, background .18s, box-shadow .18s; }
.button svg { width: 18px; height: 18px; }
.button-primary { color: var(--tools-on-action); border-color: var(--tools-action); background: var(--tools-action); }
.button-secondary { color: var(--green-dark); border-color: var(--line); background: var(--surface); }
.form-actions { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; }
.progress-area { margin-top: 18px; display: flex; align-items: center; gap: 10px; color: var(--green-dark); font-size: .82rem; font-weight: 700; }
.spinner { width: 18px; height: 18px; flex: 0 0 auto; border: 2px solid color-mix(in srgb, var(--green) 24%, transparent); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.message { margin-top: 18px; padding: 14px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; }
.message > svg { width: 21px; height: 21px; flex: 0 0 auto; }
.message-error { color: var(--red); border-color: color-mix(in srgb, var(--red) 28%, var(--line)); background: color-mix(in srgb, var(--red) 7%, var(--surface)); }
.message-success { color: var(--green-dark); border-color: color-mix(in srgb, var(--green) 30%, var(--line)); background: color-mix(in srgb, var(--green) 8%, var(--surface)); }
.message-copy { min-width: 0; display: grid; gap: 5px; }
.message-copy strong, .message-copy small { overflow-wrap: anywhere; }
.message-copy small { color: var(--muted); line-height: 1.45; }
.result-list { margin-top: 12px; display: grid; gap: 9px; }
.result-list article { padding: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.result-list article > span { min-width: 0; display: grid; gap: 3px; }
.result-list strong { overflow-wrap: anywhere; font-size: .82rem; }
.result-list small { color: var(--muted); font-size: .72rem; }

.drop-overlay { position: absolute; z-index: 8; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--green-dark); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(5px); }
.drop-overlay svg { width: 42px; height: 42px; }
.drop-overlay strong { font-size: 1.05rem; }
.guide { margin: 76px 0 44px; }
.guide-heading { max-width: 760px; }
.guide-grid { margin-top: 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.guide-grid article { padding: 22px; border: 1px solid var(--line); border-radius: 15px; background: color-mix(in srgb, var(--surface) 82%, transparent); }
.guide-grid article > span { width: 34px; height: 34px; display: grid; place-items: center; color: var(--green-dark); }
.guide-grid svg { width: 28px; height: 28px; }
.guide-grid h3 { margin: 14px 0 8px; font-size: .93rem; }
.guide-grid p, .limits-note { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.65; }
.limits-note { margin-top: 17px; }
.drag-ghost { position: fixed; z-index: 1000; pointer-events: none; transform: translate3d(0, 0, 0); will-change: transform, width, height; transition: width .18s, height .18s; }
.drag-ghost, .drag-ghost * { pointer-events: none; -webkit-user-select: none; user-select: none; }
.drag-ghost-preview { width: 100%; height: 100%; transform: scale(.985); opacity: .9; filter: drop-shadow(0 14px 20px rgb(20 31 26 / 22%)); transition: transform .16s, opacity .16s; }
.drag-ghost.lifted .drag-ghost-preview { transform: scale(1.025) rotate(.5deg); opacity: .96; }
.drag-ghost.dropping { transition: transform .2s cubic-bezier(.22, 1, .36, 1), width .2s, height .2s; }
.drag-ghost.dropping .drag-ghost-preview { transform: scale(1); opacity: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--green) 64%, white); outline-offset: 3px; }

@media (hover: hover) and (pointer: fine) {
  .file-action:hover, .button-primary:hover { background: var(--tools-action-hover); transform: translateY(-1px); }
  .button-secondary:hover, .item-controls button:hover, .split-toggle:hover { color: var(--ink); border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
  .split-toggle.is-active:hover { color: var(--tools-on-action); border-color: var(--tools-action-hover); background: var(--tools-action-hover); }
  .split-divider:hover { border-style: solid; background: var(--green-soft); }
}

@media (max-width: 820px) {
  .guide-grid { grid-template-columns: 1fr; }
  .file-card { grid-template-columns: 54px minmax(0, 1fr); }
  .file-preview, .pdf-icon { width: 54px; height: 54px; }
  .file-card > .item-controls { grid-column: 1 / -1; justify-content: flex-end; }
  .page-grid { grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); }
}

@media (max-width: 620px) {
  main { width: min(100% - 28px, 1040px); }
  .hero { margin: 28px auto; }
  .hero h1 { font-size: clamp(2.35rem, 13vw, 3.35rem); }
  .empty-state { min-height: 0; padding: 28px 20px; grid-template-columns: 1fr; text-align: center; }
  .empty-copy, .file-action, .privacy-note, .drop-hint, .empty-progress, .empty-error, .empty-visual { grid-column: 1; }
  .empty-visual { width: min(178px, 62vw); grid-row: auto; margin: 0 auto; }
  .file-action { width: 100%; }
  .privacy-note, .drop-hint, .empty-progress, .empty-error { justify-self: center; }
  .drop-hint { margin-top: -7px !important; }
  .work-form { padding: 26px 16px; }
  .form-heading, .source-toolbar { align-items: flex-start; flex-direction: column; }
  .local-note { text-align: start; }
  .source-toolbar .button { width: 100%; }
  .password-panel { grid-template-columns: 1fr; }
  .show-passwords, .password-panel > small { grid-column: 1; }
  .page-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .page-caption { min-height: 96px; align-items: flex-start; flex-direction: column; }
  .page-caption:has(.split-toggle) { min-height: 105px; }
  .page-controls { width: 100%; justify-content: space-between; }
  .page-controls button { width: 40px; height: 40px; }
  .split-toggle { width: 100%; }
  .split-divider { min-height: 220px; }
  .form-actions { flex-direction: column; }
  .form-actions .button { width: 100%; }
  .result-list article { align-items: stretch; flex-direction: column; }
  .result-list .button { width: 100%; }
  .guide { margin-top: 58px; }
}

@media (prefers-color-scheme: dark) {
  .page-preview { background: #d9d8d2; }
  .drag-ghost-preview { filter: drop-shadow(0 14px 22px rgb(0 0 0 / 42%)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
