:root {
  color-scheme: light;
  --bg: #eef2f7;
  --ink: #101828;
  --muted: #667085;
  --line: #d7dee9;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --nav: #111827;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #d9f3ef;
  --blue: #2563eb;
  --blue-soft: #e7efff;
  --warn: #b42318;
  --ok: #067647;
  --shadow: 0 18px 50px rgba(16, 24, 40, 0.12);
  --shadow-soft: 0 10px 24px rgba(16, 24, 40, 0.08);
  font-family: "Inter", "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 8%, rgba(215, 38, 82, 0.18), transparent 28rem),
    radial-gradient(circle at 88% 12%, rgba(15, 118, 110, 0.14), transparent 30rem),
    linear-gradient(140deg, #fff7f8 0%, #f8fafc 36%, #e8eef7 100%);
  color: var(--ink);
}

.app-shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.app-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.98), rgba(43, 23, 34, 0.96)),
    radial-gradient(circle at 8% 50%, rgba(215, 38, 82, 0.38), transparent 22rem);
  box-shadow: 0 18px 46px rgba(16, 24, 40, 0.22);
}

.brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
    radial-gradient(circle at 38% 52%, rgba(215, 38, 82, 0.28), transparent 9rem);
  color: #fff;
  text-decoration: none;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 14px 26px rgba(0, 0, 0, 0.18);
}

.brand::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.16), transparent 58%);
  pointer-events: none;
}

.brand span {
  position: relative;
  z-index: 1;
  color: #fff;
  font-weight: 950;
  letter-spacing: 0;
}

.module-nav {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.module-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 8px;
  color: #cbd5e1;
  font-weight: 850;
  text-decoration: none;
}

.module-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.module-nav a.active {
  color: #111827;
  background: #fff;
  box-shadow: inset 0 -3px 0 var(--accent);
}

.clear-form {
  display: flex;
  justify-content: flex-end;
}

.clear-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #d6deea;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.clear-form button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.account-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
  font-weight: 900;
  text-decoration: none;
}

.tools-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: center;
  justify-items: center;
  margin: 10px 0 26px;
  padding: 40px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 246, 248, 0.78) 46%, rgba(237, 244, 255, 0.86)),
    radial-gradient(circle at 18% 50%, rgba(215, 38, 82, 0.28), transparent 20rem),
    radial-gradient(circle at 88% 22%, rgba(15, 118, 110, 0.18), transparent 22rem);
  box-shadow: 0 28px 70px rgba(16, 24, 40, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.tools-hero::before,
.tools-hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.tools-hero::before {
  inset: 0;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.54), transparent 42%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 72px);
}

.tools-hero::after {
  width: 420px;
  height: 420px;
  left: 50%;
  top: 50%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(215, 38, 82, 0.32), rgba(215, 38, 82, 0.12) 38%, transparent 70%);
  filter: blur(18px);
  transform: translate(-50%, -50%);
}

.tools-hero h1 {
  max-width: 760px;
  margin: 8px 0 10px;
  font-size: clamp(2.2rem, 5vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.tools-hero > * {
  position: relative;
  z-index: 1;
}

.hero-logo-frame {
  position: relative;
  width: min(760px, 100%);
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(250, 252, 255, 0.38)),
    radial-gradient(circle at 48% 52%, rgba(215, 38, 82, 0.22), transparent 16rem);
  box-shadow:
    0 28px 56px rgba(88, 28, 45, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

.hero-logo-frame::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.1)),
    radial-gradient(circle at 50% 48%, rgba(255, 70, 96, 0.22), transparent 15rem);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.hero-logo {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  max-height: 270px;
  object-fit: contain;
  object-position: center;
  border-radius: 12px;
  filter: saturate(1.08) contrast(1.08) drop-shadow(0 18px 32px rgba(215, 38, 82, 0.22));
}

.tools-hero .lead {
  max-width: 620px;
  margin: 0;
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 950;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
}

.secondary-action svg {
  width: 18px;
  height: 18px;
}

.module-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  margin: 10px 0 18px;
  padding: 14px 18px;
  border: 1px solid rgba(208, 213, 221, 0.78);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 34px rgba(16, 24, 40, 0.08);
  backdrop-filter: blur(10px);
}

.module-topbar h1 {
  margin: 0;
  color: #111827;
  font-size: 1.55rem;
  font-weight: 950;
  line-height: 1.1;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.compact-tools {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.compact-tools .tool-card {
  min-height: 156px;
  gap: 10px;
  padding: 20px;
}

.compact-tools .tool-icon {
  width: 58px;
  height: 58px;
  border-radius: 14px;
}

.compact-tools .tool-icon svg {
  width: 28px;
  height: 28px;
}

.tool-card {
  position: relative;
  display: grid;
  min-height: 190px;
  align-content: start;
  gap: 12px;
  padding: 24px;
  border: 1px solid rgba(228, 231, 236, 0.9);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tool-card:hover {
  transform: translateY(-4px);
  border-color: rgba(16, 24, 40, 0.24);
  box-shadow: 0 20px 38px rgba(16, 24, 40, 0.14);
}

.tool-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  color: #111827;
}

.tool-icon svg {
  width: 34px;
  height: 34px;
}

.tool-card strong {
  font-size: 1.08rem;
  line-height: 1.2;
}

.tool-card small {
  color: var(--muted);
  line-height: 1.45;
}

.tone-blue .tool-icon { background: #cfe8ff; }
.tone-mint .tool-icon { background: #c8f4e5; }
.tone-rose .tool-icon { background: #ffd4df; }
.tone-amber .tool-icon { background: #ffdda7; }
.tone-violet .tool-icon { background: #e9d5ff; }
.tone-cyan .tool-icon { background: #c8f7ff; }
.tone-indigo .tool-icon { background: #dbe4ff; }
.tone-green .tool-icon { background: #d8f8c9; }
.tone-yellow .tool-icon { background: #fff1ad; }
.tone-pink .tool-icon { background: #ffd2f2; }
.tone-orange .tool-icon { background: #ffd8b5; }
.tone-red .tool-icon { background: #ffd1d1; }
.tone-slate .tool-icon { background: #d8e0ec; }
.tone-lime .tool-icon { background: #e3ffc0; }
.tone-teal .tool-icon { background: #bff4ef; }
.tone-emerald .tool-icon { background: #c7f8d4; }

.tool-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.7fr) minmax(360px, 1fr);
  gap: 18px;
  align-items: start;
}

.tool-summary {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  color: var(--accent-strong);
  font-weight: 900;
  text-decoration: none;
}

.back-link svg {
  width: 18px;
  height: 18px;
}

.tool-page-icon {
  width: 86px;
  height: 86px;
  background: #fff0f4;
}

.tool-summary h1 {
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 3.6rem);
  line-height: 0.98;
}

.tool-summary .lead {
  margin: 0;
}

.tool-form {
  display: grid;
  gap: 18px;
}

.compact-dropzone {
  min-height: 260px;
}

.field-block select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.ocr-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(420px, 1fr);
  gap: 18px;
  align-items: start;
}

.ocr-panel,
.ocr-result-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid rgba(208, 213, 221, 0.78);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
}

.ocr-topbar {
  min-height: 58px;
  margin: 0;
  padding: 10px 14px;
}

.ocr-dropzone {
  min-height: 230px;
}

.ocr-actions,
.ocr-export-actions,
.ocr-result-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ocr-actions {
  flex-wrap: wrap;
}

.ocr-actions .primary-button {
  flex: 1 1 180px;
}

.ocr-progress {
  margin: 0;
}

.ocr-result-head {
  justify-content: space-between;
  color: #475467;
  font-weight: 850;
}

.ocr-result-head strong {
  color: #111827;
  font-size: 1.05rem;
}

#ocrText {
  width: 100%;
  min-height: 520px;
  resize: vertical;
  padding: 16px;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  font: 500 0.96rem/1.6 "Inter", ui-sans-serif, system-ui, sans-serif;
}

#ocrText:focus {
  outline: 3px solid rgba(15, 118, 110, 0.14);
  border-color: var(--accent);
}

.ocr-export-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace,
.module-page {
  display: grid;
  grid-template-columns: 0.88fr 1.12fr;
  gap: 18px;
  align-items: stretch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.intro {
  position: relative;
  overflow: hidden;
  padding: 32px;
  background:
    linear-gradient(160deg, #ffffff 0%, #f7fbff 55%, #ecfdf7 100%);
}

.intro::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--accent), var(--blue), #0ea5e9);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 680px;
  font-size: clamp(2rem, 4vw, 4.1rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  letter-spacing: 0;
}

.lead {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

.feature-grid {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.feature-grid > div {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 4px 12px;
  padding: 16px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.06);
}

.feature-icon {
  grid-row: span 2;
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--nav);
  color: white;
  font-size: 0.72rem;
  font-weight: 950;
}

.feature-grid strong {
  align-self: end;
}

.feature-grid small {
  color: var(--muted);
  line-height: 1.45;
}

.converter-card,
.tool-card {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 288px;
  padding: 28px;
  border: 1px dashed #95a3b8;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff, #f8fbff);
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.dropzone:hover,
.dropzone.dragging {
  border-color: var(--accent);
  background: #f3fbf8;
  box-shadow: 0 12px 26px rgba(15, 118, 110, 0.12);
  transform: translateY(-1px);
}

.dropzone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  display: inline-grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, #111827, #334155);
  color: white;
  font-size: 0.85rem;
  font-weight: 950;
  box-shadow: 0 18px 32px rgba(16, 24, 40, 0.22);
}

.dropzone strong {
  font-size: 1.2rem;
}

.dropzone small,
.file-summary {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.file-summary {
  width: 100%;
  max-width: 480px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.format-picker,
.page-picker,
.sheet-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.page-picker,
.sheet-picker {
  grid-template-columns: 1fr;
}

.format-picker legend,
.page-picker legend,
.sheet-picker legend,
.edit-options legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: #475467;
  font-size: 0.9rem;
  font-weight: 850;
}

.format-picker label,
.page-options label,
.sheet-options label,
.edit-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  font-weight: 800;
  cursor: pointer;
}

.format-picker label:hover,
.page-options label:hover,
.sheet-options label:hover,
.edit-options label:hover {
  border-color: rgba(15, 118, 110, 0.35);
  background: #f2fbf8;
}

.format-picker input,
.page-picker input,
.sheet-picker input,
.edit-options input {
  accent-color: var(--accent);
}

.page-options,
.sheet-options,
.edit-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.page-number-field,
.field-block {
  display: grid;
  gap: 8px;
  color: #475467;
  font-size: 0.92rem;
  font-weight: 850;
}

.page-number-field input,
.field-block input,
.field-block select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.page-number-field input:focus,
.field-block input:focus,
.field-block select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.14);
}

.field-block input[type="file"] {
  padding: 12px;
  background: #fbfcff;
}

.file-field small {
  color: #667085;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.45;
}

.signature-designer {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(208, 213, 221, 0.9);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.signature-designer-head,
.signature-page-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.signature-designer-head strong,
.signature-page-controls span {
  color: var(--ink);
  font-weight: 900;
}

.signature-page-controls .icon-button {
  min-width: 38px;
  height: 38px;
  padding: 0;
}

.signature-stage-wrap {
  min-height: 440px;
  max-height: 660px;
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(208, 213, 221, 0.78);
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(148, 163, 184, 0.2) 1px, transparent 1px),
    linear-gradient(rgba(148, 163, 184, 0.2) 1px, transparent 1px),
    #e8eef6;
  background-size: 22px 22px;
}

.signature-stage {
  position: relative;
  min-width: 320px;
  min-height: 430px;
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 18px 42px rgba(16, 24, 40, 0.24);
}

#signaturePdfCanvas {
  position: absolute;
  inset: 0;
}

.signature-box {
  position: absolute;
  z-index: 2;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  min-width: 56px;
  min-height: 28px;
  padding: 7px 9px;
  border: 1px dashed #0f766e;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  cursor: move;
  touch-action: none;
  user-select: none;
}

.signature-box.moving {
  border-style: solid;
  box-shadow: 0 16px 34px rgba(15, 118, 110, 0.24);
}

.signature-box img {
  display: block;
  max-width: 100%;
  max-height: calc(100% - 20px);
  object-fit: contain;
  pointer-events: none;
}

.signature-box img[hidden] + span {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: clamp(14px, 2.2vw, 28px);
}

.signature-box span:not(.signature-resize-handle) {
  max-width: 100%;
  overflow: hidden;
  color: #111827;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.signature-resize-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.25);
  cursor: nwse-resize;
}

.page-number-field input:disabled {
  color: #98a2b3;
  background: #eef3f9;
  cursor: not-allowed;
}

.primary-button,
.secondary-button,
.secondary-link,
.icon-button,
.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 8px;
  font: inherit;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  padding: 0 18px;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  box-shadow: 0 14px 26px rgba(15, 118, 110, 0.2);
}

.primary-button:hover {
  filter: brightness(0.96);
}

.primary-button[disabled] {
  background: #98a2b3;
  box-shadow: none;
  cursor: wait;
}

.secondary-button,
.tool-button,
.icon-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary-button {
  width: 100%;
  color: #475467;
}

.secondary-button:hover,
.tool-button:hover,
.icon-button:hover {
  border-color: rgba(15, 118, 110, 0.35);
  background: #f2fbf8;
}

.secondary-link {
  width: 100%;
  color: var(--accent-strong);
}

.tool-button.active {
  border-color: rgba(15, 118, 110, 0.45);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.progress-panel,
.inline-result {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.progress-panel[hidden],
.inline-result[hidden] {
  display: none;
}

.progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-heading strong,
.progress-heading span {
  font-weight: 950;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3eaf4;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  transition: width 180ms ease;
}

.progress-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.progress-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-size: 0.9rem;
}

.progress-step.active {
  border-color: rgba(15, 118, 110, 0.45);
  color: var(--accent-strong);
  background: #f2fbf8;
}

.progress-step.done {
  color: var(--ok);
  background: #ecfdf3;
  border-color: #abefc6;
}

.progress-step strong {
  white-space: nowrap;
}

.progress-message {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.inline-result > span {
  color: var(--muted);
}

.alerts {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 800;
  line-height: 1.45;
}

.alert.error {
  color: var(--warn);
  background: #fff1f0;
  border: 1px solid #fecdca;
}

.alert.success {
  color: var(--ok);
  background: #ecfdf3;
  border: 1px solid #abefc6;
}

.pdf-editor-shell,
.merge-workspace {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 16px;
  align-items: start;
}

.editor-sidebar,
.merge-sidebar {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 18px;
  padding: 22px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.editor-sidebar h1,
.merge-sidebar h1 {
  font-size: 2.35rem;
}

.editor-tools {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.editor-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.editor-controls .field-block:first-child {
  grid-column: 1 / -1;
}

.editor-controls input[type="color"] {
  padding: 4px;
}

.editor-actions {
  display: grid;
  gap: 10px;
}

.editor-status {
  min-height: 44px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.45;
}

.editor-status.success {
  color: var(--ok);
  background: #ecfdf3;
  border-color: #abefc6;
}

.editor-status.error {
  color: var(--warn);
  background: #fff1f0;
  border-color: #fecdca;
}

.editor-workbench,
.merge-board {
  overflow: hidden;
  background: #fff;
}

.editor-topbar,
.merge-board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.page-controls,
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  width: auto;
  min-width: 42px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.pdf-stage-wrap {
  min-height: 680px;
  overflow: auto;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(148, 163, 184, 0.24) 1px, transparent 1px),
    linear-gradient(rgba(148, 163, 184, 0.24) 1px, transparent 1px),
    #e7edf5;
  background-size: 24px 24px;
}

.pdf-stage {
  position: relative;
  min-width: 320px;
  min-height: 460px;
  margin: 0 auto;
  background: white;
  box-shadow: 0 18px 44px rgba(16, 24, 40, 0.25);
}

#pdfCanvas,
.pdf-text-layer,
.edit-layer {
  position: absolute;
  inset: 0;
}

.pdf-text-layer {
  z-index: 2;
  pointer-events: none;
}

.edit-layer {
  z-index: 3;
  touch-action: none;
}

.pdf-stage.native-text-mode .pdf-text-layer {
  z-index: 4;
  pointer-events: auto;
}

.pdf-stage.native-text-mode .edit-layer {
  pointer-events: none;
}

.native-text-item {
  position: absolute;
  display: inline-block;
  overflow: hidden;
  padding: 0 1px;
  border: 1px solid transparent;
  color: transparent;
  line-height: 1;
  white-space: pre;
  font-family: Arial, Helvetica, sans-serif;
  min-width: 18px;
  min-height: 12px;
}

.pdf-stage.native-text-mode .native-text-item {
  color: transparent;
  background: transparent;
  cursor: text;
}

.pdf-stage.native-text-mode .native-text-item:hover {
  border-color: rgba(37, 99, 235, 0.55);
  background: rgba(255, 255, 255, 0.72);
  color: #111827;
}

.pdf-stage.native-text-mode .native-text-item:hover,
.native-text-item.editing,
.native-text-item.changed {
  border-color: rgba(37, 99, 235, 0.55);
  background: rgba(255, 255, 255, 0.96);
  color: #111827;
}

.native-text-item.editing,
.native-text-item.changed {
  resize: both;
  overflow: auto;
  min-width: 36px;
  min-height: 18px;
}

.native-text-item:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.pdf-stage.drawing .edit-layer {
  cursor: crosshair;
}

.pdf-object {
  position: absolute;
  z-index: 3;
  min-width: 22px;
  min-height: 18px;
  border: 1px solid transparent;
  resize: both;
  overflow: hidden;
  cursor: move;
}

.pdf-object.selected {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.pdf-object-text {
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.05);
  color: #111827;
  line-height: 1.25;
  white-space: pre-wrap;
}

.pdf-object-text:focus {
  outline: 2px solid var(--blue);
}

.pdf-object-whiteout {
  border-color: rgba(37, 99, 235, 0.35);
  background: #ffffff;
}

.pdf-object-rect {
  border-style: solid;
  background: transparent;
}

.pdf-object-highlight {
  opacity: 0.42;
}

.pdf-object-ink {
  pointer-events: auto;
  resize: none;
}

.pdf-object-ink svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.merge-board-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.merge-board-header .eyebrow {
  margin-bottom: 6px;
}

.merge-board-header > span {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 950;
}

.merge-list {
  display: grid;
  gap: 10px;
  min-height: 520px;
  padding: 18px;
  background: #e9eef6;
  align-content: start;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px dashed #95a3b8;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 850;
  text-align: center;
}

.merge-item {
  display: grid;
  grid-template-columns: 34px 54px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.08);
}

.merge-item.dragging {
  opacity: 0.55;
}

.merge-item.drag-over {
  border-color: var(--accent);
  background: #f2fbf8;
}

.merge-handle {
  display: inline-grid;
  place-items: center;
  min-height: 40px;
  border-radius: 8px;
  background: #eef3f9;
  color: var(--muted);
  font-weight: 950;
  cursor: grab;
}

.merge-number {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--nav);
  color: #fff;
  font-size: 0.9rem;
}

.merge-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.merge-info strong,
.merge-info small {
  overflow-wrap: anywhere;
}

.merge-info small {
  color: var(--muted);
}

.merge-actions {
  display: flex;
  gap: 6px;
}

.merge-actions button {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
  cursor: pointer;
}

.merge-actions button:hover {
  background: #eef3f9;
}

.merge-actions button:disabled {
  color: #98a2b3;
  cursor: not-allowed;
}

.result-card {
  width: min(640px, 100%);
  padding: 34px;
  margin: 0 auto;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.download-box {
  display: grid;
  gap: 14px;
  margin: 28px 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.download-box span {
  overflow-wrap: anywhere;
  font-weight: 850;
}

.upgrade-note {
  margin: 0;
  padding: 12px;
  border: 1px solid #fedf89;
  border-radius: 10px;
  color: #92400e;
  background: #fffaeb;
  font-weight: 850;
  line-height: 1.45;
}

@media (max-width: 920px) {
  .app-header {
    grid-template-columns: 1fr;
  }

  .module-nav {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .clear-form {
    justify-content: stretch;
  }

  .account-actions {
    justify-content: stretch;
  }

  .account-chip {
    flex: 1;
  }

  .clear-form button {
    width: 100%;
  }

  .workspace,
  .module-page,
  .pdf-editor-shell,
  .merge-workspace,
  .format-picker,
  .page-options,
  .sheet-options,
  .edit-options,
  .progress-steps {
    grid-template-columns: 1fr;
  }

  .editor-sidebar,
  .merge-sidebar {
    position: static;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 22px, 720px);
    padding: 12px 0 28px;
  }

  .intro,
  .converter-card,
  .tool-card,
  .result-card,
  .editor-sidebar,
  .merge-sidebar {
    padding: 20px;
  }

  .editor-topbar,
  .merge-board-header,
  .page-controls,
  .zoom-controls {
    flex-wrap: wrap;
  }

  .pdf-stage-wrap {
    min-height: 520px;
    padding: 16px;
  }

  .merge-item {
    grid-template-columns: 34px 44px 1fr;
  }

  .merge-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .dropzone {
    min-height: 240px;
  }
}

.page-edit .app-shell {
  width: 100%;
  padding: 0;
}

.page-edit .app-header {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.studio-editor {
  min-height: 100vh;
  background: #f4f6f9;
}

.studio-filebar {
  display: grid;
  grid-template-columns: auto minmax(220px, 360px) 1fr;
  gap: 18px;
  align-items: center;
  min-height: 86px;
  padding: 18px 56px;
  border-bottom: 1px solid #e4e7ec;
  background: #fff;
}

.studio-brand {
  display: inline-flex;
  align-items: baseline;
  color: #22252d;
  font-size: 2rem;
  font-weight: 900;
  text-decoration: none;
}

.studio-brand span {
  color: #d72652;
  font-style: italic;
}

.studio-brand strong {
  color: #20242b;
}

.studio-file-name {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid #cfd6e2;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-size: 1rem;
  cursor: pointer;
}

.studio-file-name input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.studio-file-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-file-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  align-items: center;
}

.studio-action,
.done-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 60px;
  padding: 0 28px;
  border-radius: 8px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.studio-action.icon-only {
  width: 60px;
  padding: 0;
}

.studio-action svg,
.done-button svg,
.tool-button svg,
.floating-controls svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.studio-action {
  border: 1px solid transparent;
  background: #fff;
  color: #111827;
}

.studio-action:hover {
  background: #f2f4f7;
}

.done-button {
  border: 0;
  background: #d72652;
  color: #fff;
  font-size: 1.08rem;
}

.done-button:disabled {
  background: #a8b3c5;
  cursor: wait;
}

.studio-ribbon {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-height: 78px;
  padding: 10px 14px;
  border-bottom: 1px solid #d8dee8;
  background: #f8fafc;
  overflow-x: auto;
}

.studio-ribbon .tool-button {
  flex: 0 0 auto;
  min-width: 58px;
  min-height: 58px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #1f2937;
  box-shadow: none;
}

.studio-ribbon .tool-button:disabled {
  color: #98a2b3;
  cursor: not-allowed;
  opacity: 0.62;
}

.studio-ribbon .tool-button:hover {
  border-color: #e4e7ec;
  background: #fff;
}

.studio-ribbon .tool-button.active {
  border-color: #fbd1dc;
  background: #fff0f4;
  color: #c91f49;
}

.ribbon-divider {
  width: 1px;
  min-height: 42px;
  margin: auto 4px;
  background: #d8dee8;
}

.ribbon-field {
  flex: 0 0 86px;
  display: grid;
  gap: 4px;
  align-content: center;
  padding: 6px 8px;
  border-left: 1px solid #e4e7ec;
  color: #475467;
  font-size: 0.78rem;
  font-weight: 800;
}

.ribbon-font-field {
  flex-basis: 176px;
}

.ribbon-field input,
.ribbon-field select {
  width: 100%;
  min-height: 30px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font: inherit;
  font-weight: 700;
}

.ribbon-field select {
  padding: 0 8px;
}

.font-install-button {
  min-width: 42px !important;
  min-height: 42px !important;
  margin: auto 0;
  border-color: #d0d5dd !important;
  background: #fff !important;
}

.studio-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - 164px);
  min-height: 620px;
}

.studio-pages {
  overflow: auto;
  border-right: 1px solid #cdd5e1;
  background: #f7f7f8;
}

.studio-pages-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #e7e7e8;
  color: #111827;
}

.thumbnail-list {
  display: grid;
  gap: 24px;
  padding: 10px 20px 28px;
}

.thumbnail-item {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 8px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.thumbnail-item:hover,
.thumbnail-item.active {
  border-color: #7c3aed;
  background: #fff;
}

.thumbnail-item canvas {
  width: 100%;
  max-width: 190px;
  aspect-ratio: 3 / 4;
  height: auto;
  border: 1px solid #d0d5dd;
  background: #fff;
}

.thumbnail-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 190px;
  aspect-ratio: 3 / 4;
  border: 1px solid #d0d5dd;
  background: #fff;
  color: #667085;
  font-size: 0.78rem;
  font-weight: 800;
}

.thumbnail-item span {
  color: #111827;
  font-weight: 800;
}

.studio-document-area {
  position: relative;
  overflow: hidden;
  background: #eef2f7;
}

.studio-document-area .pdf-stage-wrap {
  height: 100%;
  min-height: 0;
  padding: 28px 64px 88px;
  background: #eef2f7;
}

.studio-document-area .pdf-stage {
  box-shadow: 0 10px 32px rgba(16, 24, 40, 0.16);
}

.studio-status {
  position: absolute;
  top: 14px;
  right: 22px;
  z-index: 5;
  max-width: 420px;
  padding: 10px 14px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: #475467;
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(16, 24, 40, 0.08);
}

.studio-status.success {
  color: var(--ok);
  border-color: #abefc6;
  background: rgba(236, 253, 243, 0.96);
}

.studio-status.error {
  color: var(--warn);
  border-color: #fecdca;
  background: rgba(255, 241, 240, 0.96);
}

.floating-controls {
  position: absolute;
  left: 50%;
  bottom: 28px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.92);
  color: #fff;
  transform: translateX(-50%);
  box-shadow: 0 18px 32px rgba(16, 24, 40, 0.22);
}

.floating-controls .icon-button {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  min-width: 42px;
  padding: 0 10px;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.floating-controls .icon-button:hover {
  background: rgba(255, 255, 255, 0.22);
}

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.page-jump input {
  width: 54px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #111827;
  text-align: center;
  font: inherit;
  font-weight: 900;
}

.page-jump input:focus {
  outline: 2px solid rgba(255, 255, 255, 0.45);
}

.modal-open {
  overflow: hidden;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.app-modal[hidden] {
  display: none;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(6px);
}

.app-modal-card {
  position: relative;
  width: min(440px, 100%);
  padding: 26px;
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 16px;
  background: #fff;
  color: #111827;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.24);
}

.app-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #e4e7ec;
  border-radius: 50%;
  background: #fff;
  color: #667085;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}

.app-modal-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 16px;
  border-radius: 16px;
  background: #fff0f4;
  color: #d72652;
  font-size: 1.45rem;
  font-weight: 950;
}

.app-modal-body h2 {
  margin: 0 42px 8px 0;
  font-size: 1.45rem;
  line-height: 1.15;
}

.app-modal-body p {
  margin: 0;
  color: #667085;
  line-height: 1.55;
}

.app-modal-field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: #344054;
  font-size: 0.88rem;
  font-weight: 850;
}

.app-modal-field input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid #cfd6e2;
  border-radius: 10px;
  color: #111827;
  font: inherit;
  background: #fff;
}

.app-modal-field input:focus {
  outline: 3px solid rgba(215, 38, 82, 0.16);
  border-color: #d72652;
}

.app-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.modal-primary,
.modal-secondary {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.modal-primary {
  border: 0;
  background: #d72652;
  color: #fff;
}

.modal-secondary {
  border: 1px solid #d0d5dd;
  background: #fff;
  color: #111827;
}

.process-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 20px;
}

.process-overlay[hidden] {
  display: none;
}

.process-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 40%, rgba(15, 118, 110, 0.24), transparent 34%),
    rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(5px);
}

.process-card {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 18px;
  width: min(620px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.96));
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.34);
}

.process-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  overflow: hidden;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.14), rgba(220, 38, 38, 0.13)), #f8fafc;
}

.process-orbit span {
  position: absolute;
  width: 132px;
  height: 132px;
  border: 10px solid rgba(15, 118, 110, 0.16);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: process-spin 1.2s linear infinite;
}

.process-orbit svg {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  color: var(--ink);
}

.process-copy {
  min-width: 0;
}

.process-copy p,
.process-copy h2 {
  margin: 0;
}

.process-copy > p:first-child {
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0;
}

.process-copy h2 {
  margin-top: 4px;
  color: var(--ink);
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  line-height: 1.08;
}

.process-track {
  height: 9px;
  margin-top: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e7ec;
}

.process-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #14b8a6, #dc2626);
  transition: width 0.28s ease;
}

.process-overlay.indeterminate .process-track span {
  width: 42%;
  animation: process-slide 1.15s ease-in-out infinite;
}

#processPercent {
  display: block;
  margin-top: 10px;
  color: var(--ink);
  font-size: 1.18rem;
  font-weight: 950;
  text-align: center;
}

#processMessage {
  margin-top: 14px;
  color: #475467;
  font-weight: 800;
  line-height: 1.5;
}

.process-steps {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.process-steps span,
.process-steps button {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #fff;
  color: #667085;
  font-size: 0.86rem;
  font-weight: 950;
}

.process-steps button {
  font: inherit;
  cursor: default;
}

.process-steps button:not(:disabled) {
  cursor: pointer;
}

.process-steps span.active,
.process-steps button.active {
  color: var(--accent-strong);
  border-color: rgba(15, 118, 110, 0.28);
  background: #ecfdf3;
}

.process-steps span.done,
.process-steps button.done {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.process-steps button.download-ready {
  color: #fff;
  border-color: #0f766e;
  background: linear-gradient(135deg, #0f766e, #0d9488);
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.24);
}

.process-steps button.download-upgrade {
  color: #fff;
  border-color: #d72652;
  background: linear-gradient(135deg, #d72652, #a21caf);
  box-shadow: 0 12px 28px rgba(215, 38, 82, 0.22);
}

.auth-shell,
.checkout-shell {
  display: grid;
  grid-template-columns: minmax(320px, 520px);
  justify-content: center;
  padding: 38px 0;
}

.checkout-shell {
  grid-template-columns: minmax(300px, 0.85fr) minmax(360px, 1fr);
  gap: 18px;
}

.auth-card,
.checkout-summary,
.checkout-form,
.admin-panel,
.plan-card {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.auth-card,
.checkout-summary,
.checkout-form,
.admin-panel {
  display: grid;
  gap: 18px;
  padding: 26px;
}

.auth-card h1,
.checkout-summary h1,
.admin-panel h2,
.plan-card h2 {
  margin: 0;
  color: var(--ink);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.free-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 16px 18px;
}

.free-note strong {
  color: var(--ink);
  font-weight: 950;
}

.free-note span {
  color: #475467;
  font-weight: 800;
}

.plan-card {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 24px;
  overflow: hidden;
}

.plan-card.featured {
  border-color: rgba(15, 118, 110, 0.38);
  box-shadow: 0 26px 70px rgba(15, 118, 110, 0.18);
}

.plan-ribbon {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  padding: 8px 12px;
  color: #111827;
  background: #ffd89f;
  font-weight: 950;
  text-align: center;
}

.plan-card.featured h2 {
  margin-top: 30px;
}

.plan-card > strong,
.checkout-summary > strong {
  color: #0f172a;
  font-size: 2rem;
  font-weight: 950;
}

.plan-card p,
.checkout-summary p {
  margin: 0;
  color: #475467;
  font-weight: 750;
  line-height: 1.55;
}

.plan-card ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan-card li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-weight: 850;
}

.plan-card li svg {
  width: 18px;
  color: var(--accent);
}

.admin-grid {
  display: grid;
  gap: 18px;
}

.admin-panel-wide {
  grid-column: 1 / -1;
}

.admin-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.admin-panel-head p {
  margin: 6px 0 0;
  color: #667085;
  font-weight: 750;
  line-height: 1.45;
}

.admin-check-all {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.admin-settings-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.admin-settings-form label {
  display: grid;
  gap: 8px;
  color: #475467;
  font-weight: 900;
}

.admin-settings-form input,
.admin-settings-form select {
  min-height: 46px;
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 850;
  padding: 0 12px;
}

.admin-settings-form .settings-check {
  grid-column: 1 / -1;
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  width: fit-content;
  padding: 0 14px;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.admin-settings-form .settings-check input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.settings-mode-notes {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.settings-mode-notes div {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
}

.settings-mode-notes strong {
  color: var(--ink);
  font-weight: 950;
}

.settings-mode-notes span {
  color: #667085;
  font-weight: 750;
  line-height: 1.45;
}

.feature-toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.feature-toggle {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: center;
  min-height: 72px;
  padding: 14px;
  border: 1px solid #d8dee8;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
  color: var(--ink);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
  cursor: pointer;
}

.feature-toggle input,
.admin-check-all input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.feature-toggle span {
  font-weight: 950;
}

.feature-toggle small {
  grid-column: 2;
  color: #667085;
  font-weight: 800;
}

.feature-toggle:has(input:checked) {
  border-color: rgba(15, 118, 110, 0.42);
  background: linear-gradient(135deg, #ecfdf3 0%, #fff 100%);
}

.admin-actions-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.admin-actions-row button {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid #e4e7ec;
  color: #344054;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--ink);
  background: #f8fafc;
  font-weight: 950;
}

.admin-table td small {
  display: block;
  margin-top: 3px;
  color: #667085;
  font-weight: 700;
}

.admin-table td form {
  display: inline-flex;
  margin-right: 6px;
}

.admin-table td .inline-access-form {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.inline-access-form select {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 850;
}

.admin-table button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 900;
  cursor: pointer;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #344054;
  background: #eef2f7;
  font-size: 0.8rem;
  font-weight: 950;
  text-transform: capitalize;
}

.status-pill.approved,
.status-pill.active {
  color: #027a48;
  background: #ecfdf3;
}

.status-pill.pending {
  color: #92400e;
  background: #fffaeb;
}

.status-pill.rejected {
  color: #b42318;
  background: #fff1f0;
}

.plan-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.plan-mini {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #fff;
}

.plan-mini span {
  color: var(--accent-strong);
  font-weight: 950;
}

@keyframes process-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes process-slide {
  0% {
    transform: translateX(-110%);
  }
  50% {
    transform: translateX(70%);
  }
  100% {
    transform: translateX(230%);
  }
}

@media (max-width: 980px) {
  .admin-settings-form,
  .settings-mode-notes {
    grid-template-columns: 1fr;
  }

  .process-card {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 22px;
  }

  .process-copy {
    width: 100%;
    text-align: center;
  }

  .process-steps {
    width: 100%;
  }

  .checkout-shell {
    grid-template-columns: 1fr;
  }

  .tools-hero {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }

  .tool-workspace {
    grid-template-columns: 1fr;
  }

  .ocr-workspace {
    grid-template-columns: 1fr;
  }

  .tool-summary {
    position: static;
  }

  .studio-filebar {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .studio-file-actions {
    justify-content: stretch;
  }

  .studio-action,
  .done-button {
    flex: 1;
    min-height: 48px;
  }

  .studio-body {
    grid-template-columns: 1fr;
    height: auto;
  }

  .studio-pages {
    max-height: 260px;
    border-right: 0;
    border-bottom: 1px solid #cdd5e1;
  }

  .thumbnail-list {
    grid-auto-flow: column;
    grid-auto-columns: 150px;
    overflow-x: auto;
  }

  .studio-document-area {
    min-height: 620px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1360px);
  }

  .app-header {
    grid-template-columns: 1fr;
  }

  .module-nav {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .clear-form {
    justify-content: stretch;
  }

  .clear-form button {
    width: 100%;
  }

  .tools-hero h1 {
    font-size: 2.35rem;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .tool-card {
    min-height: 160px;
  }
}
