/* AnyTools — Landing Page Styles */

:root {
  --brand-50: #eff6ff;
  --brand-100: #dbeafe;
  --brand-200: #bfdbfe;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-800: #1e40af;
  --brand-950: #172554;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --bg-section: #f1f5f9;
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.1);
  --radius: 16px;
  --radius-lg: 24px;
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-display: 'Sora', 'Plus Jakarta Sans', sans-serif;
  --header-h: 72px;
}

[data-theme="dark"] {
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --bg: #0b1220;
  --bg-soft: #111827;
  --bg-section: #0f172a;
  --border: #1e293b;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

.container {
  width: min(1200px, 100% - 2rem);
  margin-inline: auto;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .site-header {
  background: rgba(11, 18, 32, .9);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}

.logo-img {
  display: block;
  height: 40px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
}

.logo-img-footer {
  height: 44px;
  max-width: 190px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.main-nav a:hover { color: var(--brand-600); }

.nav-arrow { font-size: .65rem; opacity: .6; }

.header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.icon-btn, .lang-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  font-size: .75rem;
  font-weight: 700;
  transition: .2s;
}

.icon-btn:hover, .lang-btn:hover {
  border-color: var(--brand-200);
  color: var(--brand-600);
}

.lang-btn { width: auto; padding: 0 .75rem; text-decoration: none; }

.icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

.btn-primary, .btn-secondary, .btn-ghost, .btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: .95rem;
  border: none;
  cursor: pointer;
  transition: .2s;
  white-space: nowrap;
}

.btn-sm { padding: .55rem 1.1rem; font-size: .875rem; border-radius: 10px; }

.btn-primary {
  background: var(--brand-600);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, .35);
}

.btn-primary:hover {
  background: var(--brand-700);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: var(--brand-300); color: var(--brand-600); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: .55rem 1rem;
  font-weight: 600;
  font-size: .875rem;
}

.btn-ghost:hover { color: var(--brand-600); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover { border-color: var(--brand-500); color: var(--brand-600); }

.header-login-icon {
  display: none;
  text-decoration: none;
  color: var(--brand-600);
  border-color: rgba(37, 99, 235, .28);
  background: rgba(37, 99, 235, .08);
}

.header-login-icon:hover {
  color: var(--brand-700);
  border-color: rgba(37, 99, 235, .45);
  background: rgba(37, 99, 235, .14);
}

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.mobile-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.mobile-nav {
  display: none;
  flex-direction: column;
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.mobile-nav a {
  padding: .75rem 0;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.mobile-nav[hidden] { display: none !important; }
.mobile-nav.is-open { display: flex; }

/* ── Hero ── */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 70% 20%, rgba(59,130,246,.08), transparent),
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(139,92,246,.06), transparent),
    var(--bg);
  padding: 3.5rem 0 0;
}

.hero-grid {
  display: block;
  position: relative;
  z-index: 1;
  padding-bottom: 2rem;
}

.hero-content h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  margin-bottom: 1rem;
}

.hero-content p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 480px;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 2rem;
}

.hero-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  list-style: none;
}

.hero-checks li {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.hero-checks svg {
  width: 18px;
  height: 18px;
  color: #22c55e;
  flex-shrink: 0;
}

/* Hero visual — full viewport width */
.hero-visual {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  line-height: 0;
}

.hero-illustration {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  object-fit: cover;
  object-position: center bottom;
  user-select: none;
  pointer-events: none;
}

.hero-mockup {
  position: relative;
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  backdrop-filter: blur(8px);
}

[data-theme="dark"] .hero-mockup {
  background: rgba(17, 24, 39, .85);
  border-color: var(--border);
}

.mockup-inner {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1rem;
}

.mockup-steps {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding-top: .5rem;
}

.mockup-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  font-size: .65rem;
  font-weight: 600;
  color: var(--text-light);
  text-align: center;
}

.mockup-step.active { color: var(--brand-600); }

.mockup-step-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mockup-step.active .mockup-step-icon {
  background: var(--brand-50);
  color: var(--brand-600);
}

.mockup-upload {
  border: 2px dashed var(--brand-200);
  border-radius: var(--radius);
  background: var(--brand-50);
  padding: 2.5rem 1.5rem;
  text-align: center;
}

[data-theme="dark"] .mockup-upload {
  background: rgba(59,130,246,.08);
  border-color: rgba(59,130,246,.3);
}

.mockup-upload svg {
  width: 40px;
  height: 40px;
  margin: 0 auto .75rem;
  color: var(--brand-600);
}

.mockup-upload p {
  font-size: .875rem;
  font-weight: 600;
  margin-bottom: .25rem;
}

.mockup-upload span {
  font-size: .75rem;
  color: var(--text-light);
}

.mockup-btn {
  display: inline-block;
  margin-top: 1rem;
  padding: .5rem 1.25rem;
  background: var(--brand-600);
  color: #fff;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 600;
}

.floating-icons {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.float-icon {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 800;
  box-shadow: var(--shadow);
  animation: float 4s ease-in-out infinite;
}

.float-icon.pdf { background: #fee2e2; color: #dc2626; top: -10px; right: 20px; animation-delay: 0s; }
.float-icon.xlsx { background: #dcfce7; color: #16a34a; top: 40%; left: -20px; animation-delay: 1s; }
.float-icon.doc { background: #dbeafe; color: #2563eb; bottom: 20%; right: -15px; animation-delay: 2s; }
.float-icon.img { background: #fef3c7; color: #d97706; bottom: -5px; left: 30%; animation-delay: .5s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ── Sections ── */
.section { padding: 5rem 0; }
.section-soft { background: var(--bg-soft); }

.section-header {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 3rem;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  margin-bottom: .75rem;
}

.section-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

.section-cta { text-align: center; margin-top: 2.5rem; }

/* ── Tools search ── */
.tools-search {
  max-width: 520px;
  margin: 0 auto 2rem;
}

.tools-search-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.tools-search-icon {
  position: absolute;
  left: 1rem;
  display: flex;
  color: var(--text-muted);
  pointer-events: none;
}

.tools-search-input {
  width: 100%;
  padding: .9rem 2.75rem .9rem 2.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .95rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.tools-search-input::placeholder {
  color: var(--text-muted);
}

.tools-search-input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

.tools-search-clear {
  position: absolute;
  right: .55rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: var(--bg-soft, #f1f5f9);
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.tools-search-clear:hover {
  color: var(--text);
  background: var(--border);
}

.tools-search-empty {
  margin: .85rem 0 0;
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
}

.tools-search-empty[hidden],
.tools-search-clear[hidden] {
  display: none !important;
}

.tools-grid.is-empty-filter {
  min-height: 0;
}

/* ── Tool Cards ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.tools-grid .tool-card[hidden] {
  display: none !important;
}

.tool-card {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: .25s;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--brand-200);
}

.tool-card-disabled {
  opacity: .65;
  cursor: not-allowed;
  pointer-events: none;
}

.tool-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.icon-purple { background: #f3e8ff; color: #9333ea; }
.icon-gold   { background: #fef3c7; color: #b45309; }
.icon-red    { background: #fee2e2; color: #dc2626; }
.icon-blue   { background: #dbeafe; color: #2563eb; }
.icon-green  { background: #dcfce7; color: #16a34a; }
.icon-orange { background: #ffedd5; color: #ea580c; }
.icon-teal   { background: #ccfbf1; color: #0d9488; }
.icon-gray   { background: var(--bg-section); color: var(--text-light); }

.tool-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: .25rem .6rem;
  border-radius: 999px;
}

.badge-popular { background: #dbeafe; color: #1d4ed8; }
.badge-new     { background: #dcfce7; color: #15803d; }
.badge-ai      { background: #f3e8ff; color: #7e22ce; }
.badge-soon    { background: var(--bg-section); color: var(--text-light); }

.tool-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: .35rem;
}

.tool-card p {
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Pricing ── */
.pricing-fx-root {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.pricing-currency-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem 1rem;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(15, 23, 42, .02), var(--bg));
}

.pricing-currency-label {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.pricing-currency-icon {
  color: #2563eb;
  flex-shrink: 0;
}

.pricing-currency-select {
  min-width: min(100%, 280px);
  max-width: 100%;
  flex: 1 1 220px;
  appearance: none;
  padding: .65rem 2.4rem .65rem .85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.pricing-currency-select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, .55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.pricing-fx-note {
  flex: 1 1 100%;
  margin: 0;
  font-size: .82rem;
  font-weight: 600;
  color: #0f766e;
}

.pricing-fx-note.is-error {
  color: #b91c1c;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: stretch;
}

.pricing-card {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1.5rem 1.35rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}

.pricing-card.is-featured {
  border-color: rgba(37, 99, 235, .4);
  background: linear-gradient(180deg, rgba(37, 99, 235, .07), var(--bg) 55%);
  box-shadow: 0 12px 32px rgba(37, 99, 235, .12);
}

.pricing-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-soft);
}

.pricing-badge.is-premium {
  color: #1d4ed8;
  background: rgba(37, 99, 235, .12);
}

.pricing-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.3;
}

.pricing-amount {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .35rem;
}

.pricing-amount:not(.has-promo) {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem .55rem;
}

.pricing-now-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem .55rem;
}

.pricing-now {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.pricing-currency {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: .15rem;
}

.pricing-period {
  font-size: .9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.pricing-promo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem .6rem;
}

.pricing-promo-badge {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  padding: .22rem .55rem;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .03em;
  color: #9a3412;
  background: #ffedd5;
}

.pricing-was {
  display: inline-flex;
  align-items: baseline;
  gap: .4rem;
  font-size: 1.15rem;
  color: #64748b;
  font-weight: 700;
  line-height: 1.2;
}

.pricing-was-label {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 800;
  color: #64748b;
}

.pricing-was s {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: #94a3b8;
  color: #64748b;
}

.pricing-amount.has-promo .pricing-now {
  color: #0f766e;
  font-size: 2rem;
}

.pricing-save {
  margin: 0;
  font-size: .88rem;
  color: #0f766e;
  font-weight: 600;
}

.pricing-save strong {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.pricing-ends {
  margin: 0;
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.pricing-ends time {
  color: var(--text);
  font-weight: 700;
}

.pricing-ends-limited {
  color: #b45309;
}

.pricing-offer-tag {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: .4rem;
  margin-top: -.25rem;
  padding: .28rem .7rem;
  border-radius: 8px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #9a3412;
  background: linear-gradient(135deg, #ffedd5, #fed7aa);
  box-shadow: 0 1px 0 rgba(154, 52, 18, .08);
}

.pricing-discount-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: block;
}

.pricing-discount-icon--sm {
  width: 12px;
  height: 12px;
}

.pricing-card.has-promo {
  position: relative;
}

.account-plan-card .pricing-amount {
  margin: .15rem 0 .35rem;
}

.account-plan-card .pricing-now {
  font-size: 1.35rem;
}

.account-plan-card .pricing-amount.has-promo .pricing-now {
  font-size: 1.45rem;
}

.account-plan-card.has-promo {
  border-color: rgba(15, 118, 110, .35);
  background: linear-gradient(180deg, rgba(15, 118, 110, .06), var(--bg-soft) 60%);
}

.pricing-features {
  list-style: none;
  margin: .25rem 0 .5rem;
  padding: 0;
  display: grid;
  gap: .45rem;
  flex: 1;
}

.pricing-features li {
  position: relative;
  padding-left: 1.35rem;
  font-size: .92rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.pricing-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: .35rem;
  width: .7rem;
  height: .7rem;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: inset 0 0 0 2px #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
  background-size: .55rem;
  background-repeat: no-repeat;
  background-position: center;
}

.pricing-cta {
  width: 100%;
  text-align: center;
  margin-top: auto;
}

.pricing-note {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .pricing-grid { grid-template-columns: 1fr; max-width: 420px; margin: 0 auto; }
}

.how-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  position: relative;
}

.how-steps::before {
  content: '';
  position: absolute;
  top: 36px;
  left: 16%;
  right: 16%;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--border) 0, var(--border) 8px, transparent 8px, transparent 16px);
  z-index: 0;
}

.how-step {
  text-align: center;
  position: relative;
  z-index: 1;
}

.how-num {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand-50);
  border: 2px solid var(--brand-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-600);
}

[data-theme="dark"] .how-num {
  background: rgba(59,130,246,.1);
  border-color: rgba(59,130,246,.25);
}

.how-icon {
  width: 40px;
  height: 40px;
  margin: -2.5rem auto 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-600);
  box-shadow: var(--shadow);
}

.how-step h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.how-step p {
  font-size: .875rem;
  color: var(--text-muted);
  max-width: 260px;
  margin: 0 auto;
}

/* ── Security ── */
.security-section {
  --sec-ink: #e8eef7;
  --sec-muted: rgba(232, 238, 247, .72);
  --sec-line: rgba(125, 211, 252, .22);
  --sec-accent: #7dd3fc;
  position: relative;
  overflow: hidden;
  color: var(--sec-ink);
  padding: clamp(3.5rem, 7vw, 5.5rem) 0;
  background:
    radial-gradient(900px 420px at 12% 20%, rgba(56, 189, 248, .16), transparent 55%),
    radial-gradient(700px 380px at 88% 80%, rgba(37, 99, 235, .22), transparent 50%),
    linear-gradient(160deg, #0b1a33 0%, #12253f 42%, #0f2744 100%);
}

.security-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 20%, transparent 75%);
  pointer-events: none;
  animation: security-grid-drift 28s linear infinite;
}

.security-section::after {
  content: '';
  position: absolute;
  width: 280px;
  height: 280px;
  right: -60px;
  top: -40px;
  border-radius: 50%;
  border: 1px solid rgba(125, 211, 252, .18);
  box-shadow: 0 0 0 40px rgba(125, 211, 252, .04);
  pointer-events: none;
  animation: security-ring-pulse 6s ease-in-out infinite;
}

@keyframes security-grid-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-48px, -48px, 0); }
}

@keyframes security-ring-pulse {
  0%, 100% { opacity: .55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

@keyframes security-point-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .security-section::before,
  .security-section::after,
  .security-point {
    animation: none !important;
  }
}

.security-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
}

.security-intro {
  max-width: 34rem;
}

.security-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin: 0 0 .85rem;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--sec-accent);
}

.security-eyebrow::before {
  content: '';
  width: 1.5rem;
  height: 2px;
  background: linear-gradient(90deg, var(--sec-accent), transparent);
}

.security-intro h2 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.4vw, 2.45rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: #fff;
}

.security-lead {
  margin: 0 0 1.5rem;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--sec-muted);
}

.security-intro-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .85rem 1.25rem;
}

.security-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .8rem;
  border: 1px solid var(--sec-line);
  border-radius: 10px;
  background: rgba(125, 211, 252, .08);
  color: #dbeafe;
  font-size: .8rem;
  font-weight: 600;
}

.security-pill svg {
  color: var(--sec-accent);
  flex-shrink: 0;
}

.security-more {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .9rem;
  font-weight: 700;
  color: #fff;
  transition: color .2s ease, gap .2s ease;
}

.security-more:hover {
  color: var(--sec-accent);
  gap: .6rem;
}

.security-points {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(15, 23, 42, .35), rgba(15, 23, 42, .15));
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.security-point {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, .14);
  animation: security-point-in .55s ease both;
  animation-delay: calc(var(--i, 0) * 80ms);
  transition: background .2s ease;
}

.security-point:last-child {
  border-bottom: none;
}

.security-point:hover {
  background: rgba(125, 211, 252, .06);
}

.security-point-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--sec-accent);
  background: rgba(125, 211, 252, .1);
  border: 1px solid rgba(125, 211, 252, .2);
  transition: transform .25s ease, background .25s ease;
}

.security-point:hover .security-point-icon {
  transform: translateY(-2px);
  background: rgba(125, 211, 252, .16);
}

.security-point-body h3 {
  margin: 0 0 .25rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.security-point-body p {
  margin: 0;
  font-size: .875rem;
  line-height: 1.5;
  color: var(--sec-muted);
}

/* Legacy grid (security.php) */
.security-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.security-item {
  text-align: center;
  padding: 1.5rem 1rem;
}

.security-item-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  color: #93c5fd;
}

.security-item h4 {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .35rem;
}

.security-item p {
  font-size: .8rem;
  color: rgba(255,255,255,.65);
}

/* ── Stats ── */
.stats-bar {
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 2.5rem 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  text-align: center;
}

.stat-item strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--brand-600);
  margin-bottom: .25rem;
}

.stat-item span {
  font-size: .875rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Footer ── */
.site-footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  padding-top: 4rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 2rem;
  padding-bottom: 3rem;
}

.footer-tagline {
  font-size: .875rem;
  color: var(--text-muted);
  margin: 1rem 0 1.25rem;
  max-width: 260px;
}

.social-links {
  display: flex;
  gap: .75rem;
}

.social-links a {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: .2s;
}

.social-links a:hover {
  color: var(--brand-600);
  border-color: var(--brand-200);
}

.footer-col h4 {
  font-size: .875rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.footer-col a {
  display: block;
  font-size: .875rem;
  color: var(--text-muted);
  padding: .3rem 0;
  transition: .2s;
}

.footer-col a:hover { color: var(--brand-600); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
}

.footer-bottom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .8rem;
  color: var(--text-light);
}

.footer-lang {
  font-weight: 600;
  color: var(--text-muted);
}

.footer-powered {
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
}

.footer-powered:hover {
  color: var(--brand-600);
  text-decoration: underline;
}

/* ── Tools page ── */
.page-hero {
  padding: 3rem 0 2rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

.page-hero h1 {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 700;
}

.page-hero p {
  color: var(--text-muted);
  margin-top: .5rem;
}

.header-account {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: .1rem;
  max-width: 200px;
  min-height: 41px;
  line-height: 1.15;
  white-space: nowrap;
}

.header-account-top {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  max-width: 100%;
  min-width: 0;
}

.header-account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 110px;
}

.header-expiry {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .01em;
}

.header-account.is-premium .header-expiry {
  color: #047857;
}

.header-plan {
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .04em;
  padding: .15rem .4rem;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-muted);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.header-plan.is-premium {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.mobile-nav-expiry {
  display: block;
  margin-top: .15rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.auth-page {
  position: relative;
  min-height: calc(100vh - var(--header-h) - 180px);
  display: flex;
  align-items: center;
  padding: 3rem 0 4rem;
  overflow: hidden;
}

.auth-page-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 10% 0%, rgba(37, 99, 235, .12), transparent 55%),
    radial-gradient(ellipse 60% 45% at 95% 20%, rgba(14, 165, 233, .1), transparent 50%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 55%, var(--bg) 100%);
  pointer-events: none;
  z-index: 0;
}

.auth-float {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.auth-float-item {
  position: absolute;
  left: var(--x);
  top: var(--y);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 52px;
  padding: 0 .85rem;
  border-radius: 16px;
  font-family: var(--font-display);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .08);
  border: 1px solid rgba(255, 255, 255, .55);
  backdrop-filter: blur(6px);
  transform: rotate(var(--r, 0deg));
  animation: authFloat 7.5s ease-in-out infinite;
  animation-delay: var(--d, 0s);
  opacity: .88;
}

.auth-float-pdf { background: rgba(254, 226, 226, .92); color: #dc2626; }
.auth-float-img { background: rgba(254, 243, 199, .92); color: #d97706; }
.auth-float-doc { background: rgba(219, 234, 254, .92); color: #2563eb; }
.auth-float-xls { background: rgba(220, 252, 231, .92); color: #16a34a; }
.auth-float-qr  { background: rgba(224, 242, 254, .92); color: #0284c7; }
.auth-float-zip { background: rgba(241, 245, 249, .95); color: #475569; }

.auth-float-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .45;
  animation: authOrb 10s ease-in-out infinite;
}

.auth-float-orb-a {
  width: 140px;
  height: 140px;
  left: 18%;
  top: 22%;
  background: radial-gradient(circle, rgba(59, 130, 246, .28), transparent 70%);
  animation-delay: 0s;
}

.auth-float-orb-b {
  width: 110px;
  height: 110px;
  right: 14%;
  top: 55%;
  background: radial-gradient(circle, rgba(14, 165, 233, .22), transparent 70%);
  animation-delay: 1.5s;
}

.auth-float-orb-c {
  width: 90px;
  height: 90px;
  left: 55%;
  top: 12%;
  background: radial-gradient(circle, rgba(37, 99, 235, .18), transparent 70%);
  animation-delay: 3s;
}

@keyframes authFloat {
  0%, 100% {
    transform: translateY(0) rotate(var(--r, 0deg));
  }
  50% {
    transform: translateY(-14px) rotate(calc(var(--r, 0deg) + 3deg));
  }
}

@keyframes authOrb {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: .4; }
  50% { transform: translate(12px, -16px) scale(1.08); opacity: .65; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-float-item,
  .auth-float-orb {
    animation: none;
  }
}

@media (max-width: 720px) {
  .auth-float-item {
    min-width: 44px;
    height: 44px;
    font-size: .7rem;
    opacity: .55;
  }
  .auth-float-item:nth-child(n+5) {
    display: none;
  }
}

.auth-wrap {
  position: relative;
  z-index: 1;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-brand-link {
  display: inline-flex;
  margin-bottom: .85rem;
  line-height: 0;
}

.auth-logo {
  height: 64px;
  max-width: 240px;
  width: auto;
}

.auth-heading {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 .35rem;
  letter-spacing: -.02em;
}

.auth-sub {
  margin: 0;
  font-size: .92rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 300px;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.auth-modal[hidden] {
  display: none !important;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
}

.auth-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  padding: 1.75rem 1.5rem 1.4rem;
  border-radius: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
  text-align: center;
}

.auth-modal-close {
  position: absolute;
  top: .65rem;
  right: .75rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.auth-modal-close:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.auth-modal-icon {
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto .9rem;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(37, 99, 235, .1);
  color: var(--brand-600);
}

.auth-modal-dialog h2 {
  margin: 0 0 .5rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--text);
}

.auth-modal-text {
  margin: 0 0 1.15rem;
  font-size: .95rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.auth-modal-actions {
  display: grid;
  gap: .65rem;
}

.auth-modal-actions .btn-primary,
.auth-modal-actions .btn-outline {
  width: 100%;
  text-align: center;
}

.auth-modal-note {
  margin: 1rem 0 0;
  font-size: .8rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.auth-modal-icon-warn {
  background: #fff7ed;
  color: #c2410c;
}

.auth-modal-email {
  margin: -.35rem 0 1rem;
  padding: .55rem .75rem;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
}

body.auth-modal-open {
  overflow: hidden;
}

.auth-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.auth-card-pro {
  padding: 2.25rem 2rem 1.85rem;
  box-shadow: var(--shadow-lg);
  border-color: rgba(226, 232, 240, .9);
}

.auth-wrap-wide {
  max-width: 520px;
}

.auth-textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.5;
}

.auth-field {
  margin-bottom: .95rem;
}

.auth-field:first-of-type {
  margin-top: .15rem;
}

.auth-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  margin: 0 0 .4rem;
  color: var(--text);
}

.auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: 0 0 .4rem;
}

.auth-label-row .auth-label {
  margin: 0;
}

.auth-forgot-link {
  font-size: .8rem;
  font-weight: 700;
  color: var(--brand-600);
  white-space: nowrap;
  text-decoration: none;
}

.auth-forgot-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: .15rem 0 .85rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.auth-remember input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--brand-600, #2563eb);
  cursor: pointer;
}

.auth-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .8rem 1rem;
  font: inherit;
  background: var(--bg-soft);
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.auth-input::placeholder {
  color: var(--text-light);
}

.auth-input:hover {
  border-color: #cbd5e1;
}

.auth-input:focus {
  outline: none;
  background: var(--bg);
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

.auth-submit {
  width: 100%;
  margin-top: .35rem;
  justify-content: center;
  min-height: 48px;
  font-weight: 700;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.35rem 0 1rem;
  color: var(--text-light);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-hint {
  margin: .15rem 0 1rem;
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.auth-switch {
  margin: 0;
  text-align: center;
  font-size: .9rem;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--brand-600);
  font-weight: 700;
}

.auth-switch a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-alert {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: .75rem 1rem;
  font-size: .9rem;
  margin-bottom: 1rem;
}

.auth-alert-ok {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.auth-success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  margin: 0.25rem auto 1rem;
  border-radius: 50%;
  color: #047857;
  background: #ecfdf5;
}

[data-theme="dark"] .auth-success-icon {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.15);
}

.auth-alert-error {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

[data-theme="dark"] .auth-page-bg {
  background:
    radial-gradient(ellipse 70% 50% at 10% 0%, rgba(37, 99, 235, .2), transparent 55%),
    radial-gradient(ellipse 60% 45% at 95% 20%, rgba(14, 165, 233, .12), transparent 50%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 60%);
}

[data-theme="dark"] .auth-card-pro {
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .auth-input {
  background: var(--bg-soft);
}

[data-theme="dark"] .auth-input:focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .25);
}

.account-section {
  padding-top: 1.5rem;
}

.account-layout {
  max-width: 1080px;
  width: 100%;
  min-width: 0;
}

.account-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
  margin-bottom: 1.25rem;
}

.account-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  min-width: 0;
}

.account-stat span {
  display: block;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 650;
  margin-bottom: .35rem;
}

.account-stat strong {
  display: block;
  font-size: 1.15rem;
  font-family: var(--font-display);
  word-break: break-word;
}

.account-stat.has-countdown.is-ok strong { color: #047857; }
.account-stat.has-countdown.is-warn strong { color: #b45309; }
.account-stat.has-countdown.is-danger strong { color: #b91c1c; }

.account-stat-unit {
  display: inline-block;
  margin-left: .25rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: lowercase;
}

.sub-countdown {
  margin: 0 0 1.25rem;
  padding: 1.15rem 1.25rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(16, 185, 129, .08), var(--bg));
  box-shadow: var(--shadow);
}

.sub-countdown.is-warn {
  background: linear-gradient(180deg, rgba(245, 158, 11, .1), var(--bg));
  border-color: rgba(245, 158, 11, .35);
}

.sub-countdown.is-danger {
  background: linear-gradient(180deg, rgba(239, 68, 68, .1), var(--bg));
  border-color: rgba(239, 68, 68, .35);
}

.sub-countdown-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

.sub-countdown-days {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 110px;
}

.sub-countdown-days strong {
  font-family: var(--font-display);
  font-size: 2.6rem;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #047857;
}

.sub-countdown.is-warn .sub-countdown-days strong { color: #b45309; }
.sub-countdown.is-danger .sub-countdown-days strong { color: #b91c1c; }

.sub-countdown-days span {
  margin-top: .25rem;
  font-size: .92rem;
  font-weight: 800;
  color: var(--text-muted);
}

.sub-countdown-meta {
  flex: 1 1 220px;
  min-width: 0;
}

.sub-countdown-label {
  margin: 0 0 .45rem;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sub-countdown-units {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .5rem;
  max-width: 360px;
}

.sub-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .45rem .3rem;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.sub-unit strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.1;
  color: var(--text);
}

.sub-unit span {
  margin-top: .15rem;
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.sub-countdown-expiry {
  margin: .55rem 0 0;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.sub-countdown-expiry time {
  color: var(--text);
  font-weight: 700;
}

.sub-countdown-bar {
  margin-top: .9rem;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .08);
  overflow: hidden;
}

.sub-countdown-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width .4s ease;
}

.sub-countdown.is-warn .sub-countdown-bar span {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.sub-countdown.is-danger .sub-countdown-bar span {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.account-days-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .55rem;
  border-radius: 999px;
  font-size: .86rem;
  font-weight: 800;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.account-days-pill.is-warn {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.account-days-pill.is-danger {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.35fr);
  gap: 1rem;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.account-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.account-card-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

.account-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  margin-bottom: 1rem;
}

.account-panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.account-panel-head span {
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 600;
}

.account-profile-form {
  margin-bottom: .75rem;
  min-width: 0;
}

.account-profile-form .auth-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.account-profile-form .btn-secondary {
  margin-top: .65rem;
}

.account-password-block {
  margin: 1.1rem 0 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.account-subhead {
  margin: 0 0 .75rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.account-password-form .auth-label {
  margin-top: .7rem;
}

.account-password-form .auth-label:first-of-type {
  margin-top: 0;
}

.account-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem 1rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .95rem;
  min-width: 0;
}

.account-row span {
  color: var(--text-muted);
  flex: 0 1 auto;
  min-width: 0;
}

.account-row strong {
  text-align: right;
  font-weight: 700;
  min-width: 0;
  max-width: 65%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.account-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: .92rem;
}

.account-muted {
  color: var(--text-muted);
  font-size: .85rem;
}

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

.account-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.account-table th,
.account-table td {
  text-align: left;
  padding: .65rem .45rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.account-table th {
  color: var(--text-muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
}

.account-badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
}

.account-badge-paid { background: #dcfce7; color: #15803d; }
.account-badge-pending { background: #fef3c7; color: #b45309; }
.account-badge-failed { background: #fee2e2; color: #b91c1c; }
.account-badge-refunded { background: #e0e7ff; color: #3730a3; }

.account-usage-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.account-usage-list li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem 1rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  min-width: 0;
}

.account-usage-list li:last-child {
  border-bottom: 0;
}

.account-usage-list li strong {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.account-usage-list span {
  color: var(--text-muted);
  font-size: .82rem;
  white-space: nowrap;
  flex: 0 0 auto;
}

.plan-badge.is-free {
  color: var(--text-muted);
}

.plan-badge.is-premium {
  color: #047857;
}

.account-tools-bar {
  padding: .85rem 0 0;
}

.account-tools-btn {
  display: flex;
  width: 100%;
  margin: 0;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
}

.account-pay {
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
  min-width: 0;
}

.account-card-panel .auth-switch {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .5rem;
  align-items: center;
  word-break: break-word;
}

@media (max-width: 900px) {
  .account-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-grid { grid-template-columns: 1fr; }
  .account-plan-options { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .account-card-panel {
    padding: 1rem 1rem;
    border-radius: 14px;
  }

  .account-row {
    flex-direction: column;
    align-items: stretch;
    gap: .25rem;
  }

  .account-row strong {
    text-align: left;
    max-width: 100%;
  }

  .account-profile-form .btn-secondary,
  .account-password-form .btn-secondary,
  .account-plan-card .btn-stripe,
  .account-plan-card .btn-toyyib {
    width: 100%;
  }

  .account-usage-list li {
    flex-direction: column;
    gap: .2rem;
  }

  .account-usage-list span {
    white-space: normal;
  }

  .account-panel-head h2 {
    font-size: 1.05rem;
  }

  .account-pay-head p {
    font-size: .86rem;
  }
}

@media (max-width: 520px) {
  .account-stat-grid { grid-template-columns: 1fr; }

  .account-stat {
    padding: .85rem 1rem;
  }

  .account-stat strong {
    font-size: 1.05rem;
  }
}

.account-pay-head h2 {
  margin: 0 0 .35rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.account-pay-head p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: .9rem;
}

.account-pay-price {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  margin-bottom: 1rem;
  padding: .9rem 1rem;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.account-pay-price strong {
  font-size: 1.35rem;
  font-family: var(--font-display);
}

.account-pay-price span {
  color: var(--text-muted);
  font-size: .88rem;
}

.btn-stripe {
  background: #635bff;
  border-color: #635bff;
}

.btn-stripe:hover {
  background: #4f46e5;
  border-color: #4f46e5;
}

.account-pay-note {
  margin: .75rem 0 0;
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
}

.account-pay .pricing-currency-bar {
  margin-bottom: .15rem;
  padding: .7rem .85rem;
}

.account-pay .pricing-currency-select {
  min-width: min(100%, 240px);
}

.account-plan-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  min-width: 0;
}

.account-plan-card {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-soft);
  margin: 0;
  min-width: 0;
}

.account-plan-card.is-yearly {
  border-color: rgba(37, 99, 235, .35);
  background: rgba(37, 99, 235, .06);
}

.account-plan-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}

.account-plan-card strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.account-plan-meta {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: .35rem;
}

.account-plan-card .btn-stripe,
.account-plan-card .btn-toyyib {
  margin-top: 0;
  width: 100%;
}

.account-plan-card .btn-toyyib {
  padding: .5rem 1rem;
  font-size: .82rem;
  border-radius: 10px;
  min-height: 0;
}

.account-pay-methods {
  display: grid;
  gap: .45rem;
  margin-top: auto;
}

.account-pay-methods form {
  margin: 0;
}

.btn-toyyib {
  border-color: #0d9488;
  color: #0f766e;
}

.btn-toyyib:hover {
  background: rgba(13, 148, 136, .08);
  border-color: #0f766e;
}

#toolError a {
  color: var(--brand-600);
  font-weight: 700;
}

.content-article {
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.7;
  color: var(--text);
}

.content-article h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  margin: 2rem 0 .75rem;
}

.content-article p,
.content-article ul {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.content-article p strong,
.content-article li strong {
  color: var(--text);
}

.content-article ul {
  padding-left: 1.25rem;
}

.content-article li {
  margin-bottom: .4rem;
}

.content-article a {
  color: var(--brand-600);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.content-meta {
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem !important;
}

.security-grid-light .security-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.security-grid-light .security-item h4 {
  color: var(--text);
}

.security-grid-light .security-item p {
  color: var(--text-muted);
  margin: .35rem 0 0;
  font-size: .9rem;
}

.security-grid-light .security-item-icon {
  color: var(--brand-600);
  background: var(--brand-50);
  margin: 0 auto 1rem;
}

.tool-redirect {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1rem;
}

.tool-redirect-box {
  max-width: 480px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow);
}

.tool-redirect-box .tool-icon {
  margin: 0 auto 1.25rem;
  width: 64px;
  height: 64px;
}

.tool-redirect-box h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: .5rem;
}

.tool-redirect-box p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: .95rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 1rem;
}

.tool-progress {
  max-width: 420px;
  margin: 0 auto 1.1rem;
  text-align: left;
}

.tool-progress[hidden] {
  display: none !important;
}

.tool-progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--border, #e2e8f0);
  overflow: hidden;
}

.tool-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-600), var(--brand-500, #3b82f6));
  transition: width .18s ease;
}

.tool-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: .55rem;
  font-size: .85rem;
}

.tool-progress-pct {
  font-weight: 800;
  color: var(--brand-700, #1d4ed8);
  min-width: 3rem;
}

.tool-progress-hint {
  color: var(--text-muted);
  font-weight: 600;
  text-align: right;
}

.tool-result.is-processing {
  border-color: var(--brand-200, #bfdbfe);
  background: var(--brand-50, #eff6ff);
}

[data-theme="dark"] .tool-result.is-processing {
  background: rgba(37, 99, 235, .12);
  border-color: rgba(37, 99, 235, .35);
}

[data-theme="dark"] .tool-progress-track {
  background: rgba(148, 163, 184, .25);
}

.tool-redirect-status {
  font-size: .875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.tool-redirect-note {
  margin-top: 1.25rem;
  font-size: .75rem;
  color: var(--text-light);
}

/* ── Tool workspace ── */
.tool-back {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: 1rem;
  padding: .4rem .15rem;
  color: var(--text-muted);
  font-size: .92rem;
  font-weight: 650;
  text-decoration: none;
  border-radius: 8px;
  transition: color .15s ease, background .15s ease;
}

.tool-back:hover {
  color: var(--brand-600);
  background: rgba(37, 99, 235, .06);
}

.tool-back svg {
  flex-shrink: 0;
}

.tool-page {
  padding: 2.5rem 0 4rem;
  background:
    radial-gradient(ellipse 70% 50% at 80% 0%, rgba(59,130,246,.07), transparent),
    var(--bg-soft);
}

.tool-heading {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.tool-heading h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  margin-bottom: .35rem;
}

.tool-heading p {
  color: var(--text-muted);
  max-width: 560px;
}

.tool-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.tool-steps {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.5rem;
}

.tool-step {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-light);
  padding: .4rem .8rem;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.tool-step.is-active {
  color: var(--brand-700);
  background: var(--brand-50);
  border-color: var(--brand-200);
}

.upload-zone {
  border: 2px dashed var(--brand-200);
  border-radius: var(--radius);
  background: var(--brand-50);
  padding: 2.5rem 1.5rem;
  text-align: center;
  transition: .2s;
  cursor: pointer;
}

[data-theme="dark"] .upload-zone {
  background: rgba(59,130,246,.08);
  border-color: rgba(59,130,246,.35);
}

.upload-zone.is-drag {
  border-color: var(--brand-600);
  background: var(--brand-100);
}

.upload-zone-inner svg {
  margin: 0 auto .75rem;
  color: var(--brand-600);
}

.upload-zone h3 {
  font-size: 1.1rem;
  margin-bottom: .35rem;
}

.upload-zone p {
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 1rem;
}

.upload-meta {
  margin-top: .75rem !important;
  font-size: .8rem !important;
  font-weight: 600;
  color: var(--brand-700) !important;
}

.file-list {
  list-style: none;
  margin: 1rem 0 0;
  display: grid;
  gap: .5rem;
}

.file-list.file-list-thumbs {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .85rem;
}

.file-list li,
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .7rem .85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
  font-size: .875rem;
  font-weight: 600;
  transition: border-color .15s, background .15s, opacity .15s, transform .15s;
}

.file-thumb {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .55rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}

.file-item.is-sortable,
.file-thumb.is-sortable {
  cursor: grab;
}

.file-item.is-dragging,
.file-thumb.is-dragging {
  opacity: .4;
  cursor: grabbing;
  transform: scale(.98);
}

.file-item.drag-over,
.file-thumb.drag-over {
  border-color: var(--brand-500);
  background: var(--brand-50);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .2);
}

[data-theme="dark"] .file-item.drag-over,
[data-theme="dark"] .file-thumb.drag-over {
  background: rgba(59, 130, 246, .12);
}

.file-thumb-media {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  overflow: hidden;
  background:
    linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-color: #f8fafc;
}

.file-thumb-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
  user-select: none;
}

.file-ord {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: .75rem;
  font-weight: 800;
}

.file-ord-thumb {
  position: absolute;
  top: .4rem;
  left: .4rem;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .2);
}

[data-theme="dark"] .file-ord {
  background: rgba(59, 130, 246, .15);
  color: var(--brand-200);
}

.file-thumb-remove {
  position: absolute;
  top: .35rem;
  right: .35rem;
  z-index: 2;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .72);
  border-color: transparent;
  color: #fff;
}

.file-thumb-remove:hover:not(:disabled) {
  background: #dc2626;
  border-color: transparent;
  color: #fff;
}

.file-thumb-controls {
  display: flex;
  justify-content: center;
  gap: .3rem;
}

.file-thumb-caption {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  margin: 0;
  padding: 0 .15rem .15rem;
}

.file-item-main {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
  flex: 1;
}

.file-type-icon {
  flex-shrink: 0;
  min-width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fee2e2;
  color: #b91c1c;
  font-size: .65rem;
  font-weight: 800;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list small {
  font-weight: 500;
  color: var(--text-muted);
}

.file-item-actions {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex-shrink: 0;
}

.file-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: .95rem;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: .15s;
}

.file-btn:hover:not(:disabled) {
  border-color: var(--brand-300);
  color: var(--brand-700);
}

.file-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.file-btn-remove {
  font-size: 1.15rem;
}

.file-btn-remove:hover:not(:disabled) {
  border-color: #fecaca;
  color: #dc2626;
  background: #fef2f2;
}

@media (max-width: 640px) {
  .file-list.file-list-thumbs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.pdf-editor-box {
  margin-top: 1rem;
}

.pdf-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem 1rem;
  margin: .75rem 0;
}

.pdf-editor-zoom-controls {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  padding: .2rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
}

.pdf-editor-zoom-btn {
  min-width: 2rem;
  padding-inline: .45rem;
}

.pdf-editor-zoom-label {
  min-width: 3.2rem;
  text-align: center;
  font-size: .8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.pdf-editor-zoom-controls #pdfEditorPanToggle.is-active {
  background: rgba(37, 99, 235, .12);
  border-color: rgba(37, 99, 235, .45);
  color: var(--brand-700, #1d4ed8);
}

.pdf-editor-meta {
  font-size: .82rem;
  font-weight: 650;
  color: var(--text-muted);
}

.pdf-editor-preview-wrap,
.sign-preview-wrap.pdf-editor-preview-wrap {
  margin-top: .5rem;
  width: 100%;
  height: min(720px, 75vh);
  max-height: min(720px, 75vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pdf-editor-viewport {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  cursor: grab;
  touch-action: pan-x pan-y;
}

.pdf-editor-viewport.is-pan-mode,
.pdf-editor-viewport.is-space-pan {
  touch-action: none;
}

.pdf-editor-viewport.is-panning,
.pdf-editor-viewport.is-space-pan {
  cursor: grabbing;
}

.pdf-editor-viewport.is-pan-mode {
  cursor: grab;
}

.pdf-editor-zoom-sizer {
  position: relative;
  min-width: 100%;
  min-height: 100%;
}

.pdf-editor-zoom-stage {
  transform-origin: 0 0;
  will-change: transform;
}

.pdf-editor-page {
  position: relative;
  width: 100%;
}

.pdf-editor-pages.sign-pages {
  width: 100%;
  max-width: 100%;
  align-items: stretch;
}

.pdf-editor-page.sign-page {
  width: 100%;
  max-width: 100%;
}

#pdfEditorPreview.sign-preview {
  width: 100%;
  max-width: 100%;
  padding: .65rem;
  box-sizing: border-box;
}

.pdf-editor-canvas-wrap {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, .1);
  overflow: hidden;
  /* Keep true page proportion — prevents stretched/lonjong preview */
  aspect-ratio: var(--page-ar, auto);
}

.pdf-editor-canvas-wrap.is-editing-content {
  overflow: visible;
}

.pdf-editor-canvas-wrap canvas.sign-page-canvas,
.pdf-editor-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-width: 100%;
  aspect-ratio: inherit;
  image-rendering: auto;
  vertical-align: top;
}

.pdf-editor-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.pdf-editor-layer > * {
  pointer-events: auto;
}

/* White mask over original canvas glyphs after edit/move */
.pdf-editor-content-cover {
  position: absolute;
  z-index: 4;
  box-sizing: border-box;
  background: #fff;
  pointer-events: none !important;
  border-radius: 1px;
}

/* Hit-targets only: keep text transparent so canvas glyphs show once (no double/stack). */
.pdf-editor-content {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  overflow: visible;
  cursor: text;
  z-index: 5;
}

.pdf-editor-content:hover {
  border-color: rgba(37, 99, 235, .55);
  background: rgba(37, 99, 235, .06);
  z-index: 6;
}

.pdf-editor-content.is-dragging {
  cursor: grabbing;
  z-index: 12;
  opacity: .96;
}

.pdf-editor-content-move {
  display: none;
  position: absolute;
  left: 0;
  top: -1.55rem;
  width: 1.55rem;
  height: 1.55rem;
  border: none;
  border-radius: 6px;
  background: #dbeafe;
  color: #1d4ed8;
  cursor: grab;
  padding: 0;
  place-items: center;
  z-index: 40;
  pointer-events: auto;
}

.pdf-editor-content:hover .pdf-editor-content-move,
.pdf-editor-content:focus-within .pdf-editor-content-move,
.pdf-editor-content.is-editing .pdf-editor-content-move,
.pdf-editor-content.is-changed:not(.is-settled) .pdf-editor-content-move,
.pdf-editor-content.is-moved:not(.is-settled) .pdf-editor-content-move,
.pdf-editor-content.is-deleted .pdf-editor-content-move {
  display: grid;
}

.pdf-editor-content-move:active {
  cursor: grabbing;
}

.pdf-editor-content.is-editing,
.pdf-editor-content:focus-within {
  border-color: rgba(37, 99, 235, .75);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .18);
  z-index: 7;
  overflow: visible;
  min-height: 28px;
  max-width: none;
}

.pdf-editor-content.is-changed {
  border-color: rgba(15, 118, 110, .65);
  background: #fff;
  z-index: 6;
  overflow: visible;
  min-height: 22px;
}

/* Same TTFs embedded into exported PDF — preview & download match */
@font-face {
  font-family: 'AnyToolsEditSans';
  src: url('../fonts/OpenSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'AnyToolsEditSans';
  src: url('../fonts/OpenSans-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'AnyToolsEditSans';
  src: url('../fonts/OpenSans-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'AnyToolsEditSans';
  src: url('../fonts/OpenSans-BoldItalic.ttf') format('truetype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'AnyToolsEditSerif';
  src: url('../fonts/Tinos-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'AnyToolsEditSerif';
  src: url('../fonts/Tinos-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'AnyToolsEditSerif';
  src: url('../fonts/Tinos-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'AnyToolsEditSerif';
  src: url('../fonts/Tinos-BoldItalic.ttf') format('truetype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'AnyToolsEditMono';
  src: url('../fonts/Cousine-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'AnyToolsEditMono';
  src: url('../fonts/Cousine-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'AnyToolsEditMono';
  src: url('../fonts/Cousine-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'AnyToolsEditMono';
  src: url('../fonts/Cousine-BoldItalic.ttf') format('truetype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

.pdf-editor-style-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: .35rem 0 .85rem;
}

.pdf-editor-style-row .sign-size-label {
  margin: 0;
}

.pdf-editor-style-toggles {
  display: inline-flex;
  gap: .35rem;
}

.pdf-editor-style-btn {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1rem;
  line-height: 1;
}

.pdf-editor-style-btn em {
  font-style: italic;
  font-family: Georgia, serif;
}

.pdf-editor-style-btn.is-active {
  border-color: rgba(37, 99, 235, .55);
  background: rgba(37, 99, 235, .12);
  color: var(--brand-700, #1d4ed8);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}

.pdf-editor-content-input {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0 2px;
  border: none;
  outline: none;
  resize: none;
  overflow: hidden;
  background: transparent;
  /* Invisible until edit — prevents stacked double text over canvas */
  color: transparent;
  caret-color: #2563eb;
  font-family: 'AnyToolsEditSans', Arial, Helvetica, sans-serif;
  font-weight: 400;
  /* Fallback; JS overrides to fit overlay height */
  font-size: 11px;
  line-height: 1;
  white-space: pre;
  box-sizing: border-box;
}

.pdf-editor-content:hover:not(.is-changed):not(.is-editing):not(:focus-within) .pdf-editor-content-input {
  color: transparent;
}

.pdf-editor-content.is-editing .pdf-editor-content-input,
.pdf-editor-content:focus-within .pdf-editor-content-input {
  color: #0f172a;
  min-height: 0;
  overflow: visible;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1;
}

.pdf-editor-content.is-changed:not(.is-editing):not(:focus-within) .pdf-editor-content-input {
  color: #0f172a;
  min-height: 0;
  overflow: visible;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0;
  line-height: 1;
}

/* Originally 1-line PDF text — never wrap to a second row */
.pdf-editor-content.is-single-line .pdf-editor-content-input,
.pdf-editor-content.is-single-line.is-editing .pdf-editor-content-input,
.pdf-editor-content.is-single-line:focus-within .pdf-editor-content-input,
.pdf-editor-content.is-single-line.is-changed .pdf-editor-content-input {
  white-space: pre !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  overflow-x: hidden;
  overflow-y: hidden;
}

.pdf-editor-content-actions {
  display: none;
  position: absolute;
  top: -1.55rem;
  left: 1.7rem;
  right: auto;
  z-index: 40;
  flex-direction: row;
  gap: .25rem;
  align-items: center;
  pointer-events: auto;
}

.pdf-editor-content:hover .pdf-editor-content-actions,
.pdf-editor-content:focus-within .pdf-editor-content-actions,
.pdf-editor-content.is-editing .pdf-editor-content-actions,
.pdf-editor-content.is-changed:not(.is-settled) .pdf-editor-content-actions,
.pdf-editor-content.is-deleted .pdf-editor-content-actions {
  display: flex;
}

/* After OK — hide chrome until hover/edit again */
.pdf-editor-content.is-settled:not(:hover):not(:focus-within):not(.is-editing) .pdf-editor-content-actions,
.pdf-editor-content.is-settled:not(:hover):not(:focus-within):not(.is-editing) .pdf-editor-content-move {
  display: none !important;
}

.pdf-editor-ok {
  border: none;
  border-radius: 6px;
  padding: .2rem .5rem;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  background: #0f766e;
  color: #fff;
  cursor: pointer;
  line-height: 1.2;
}

.pdf-editor-ok:hover {
  background: #0d9488;
}

/* OK mainly useful while editing / after change */
.pdf-editor-content:not(.is-editing):not(.is-changed):not(.is-deleted) .pdf-editor-ok {
  display: none;
}

.pdf-editor-content.is-deleted {
  background: #fff;
  border-color: rgba(185, 28, 28, .55);
  overflow: hidden;
}

.pdf-editor-content.is-deleted .pdf-editor-content-input {
  color: transparent;
  caret-color: transparent;
}

.pdf-editor-content-actions .pdf-editor-delete {
  width: 1.55rem;
  min-width: 1.55rem;
  height: 1.35rem;
}

.pdf-editor-size-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: .35rem 0 .75rem;
}

.pdf-editor-size-input {
  width: 4.5rem;
  min-height: 2.15rem;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: center;
}

.pdf-editor-size-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.pdf-editor-size-unit {
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
}

.pdf-editor-size-row input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.pdf-editor-field,
.pdf-editor-text {
  position: absolute;
  box-sizing: border-box;
  min-width: 48px;
  touch-action: none;
}

.pdf-editor-field {
  z-index: 3;
  border: 1.5px solid #2563eb;
  border-radius: 4px;
  background: rgba(37, 99, 235, .08);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .7) inset;
  cursor: grab;
}

/* Added text always above form fields & content overlays */
.pdf-editor-text {
  z-index: 20;
}

.pdf-editor-field.is-dragging {
  cursor: grabbing;
  z-index: 8;
  opacity: .95;
}

.pdf-editor-text.is-dragging {
  cursor: grabbing;
  z-index: 30;
  opacity: .95;
}

.pdf-editor-field-badge {
  position: absolute;
  top: -1.05rem;
  left: 0;
  padding: .05rem .35rem;
  border-radius: 4px;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #fff;
  background: #2563eb;
  pointer-events: none;
}

.pdf-editor-field-input,
.pdf-editor-text-input {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  padding: .15rem .3rem;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.2;
  overflow: hidden;
}

.pdf-editor-field-input:focus,
.pdf-editor-text-input:focus {
  background: rgba(255, 255, 255, .92);
}

/* left/top = exact text origin (same as PDF draw origin). Chrome sits outside. */
.pdf-editor-text {
  display: block;
  min-width: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 2px;
  background: transparent;
  box-shadow: none;
  outline: 1.5px dashed rgba(15, 118, 110, .55);
  outline-offset: 3px;
  z-index: 20;
  line-height: 1;
}

.pdf-editor-text .pdf-editor-move {
  position: absolute;
  left: 0;
  top: -1.55rem;
  flex: none;
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border: none;
  border-radius: 6px;
  background: #ccfbf1;
  color: #0f766e;
  cursor: grab;
  padding: 0;
}

.pdf-editor-move:active {
  cursor: grabbing;
}

.pdf-editor-text-label {
  display: block;
  margin: 0;
  padding: 0;
  min-width: 1ch;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: grab;
  line-height: 1;
  user-select: none;
}

.pdf-editor-text-label.is-placeholder {
  color: #94a3b8;
  font-style: italic;
}

.pdf-editor-actions {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  flex: 0 0 auto;
}

.pdf-editor-text .pdf-editor-actions {
  position: absolute;
  left: 1.7rem;
  top: -1.55rem;
  flex-direction: row;
}

.pdf-editor-edit {
  border: none;
  border-radius: 6px;
  padding: .2rem .45rem;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  line-height: 1.2;
}

.pdf-editor-edit:hover {
  background: #1d4ed8;
}

.pdf-editor-delete {
  width: 100%;
  min-width: 1.55rem;
  height: 1.35rem;
  border: none;
  border-radius: 6px;
  background: #b91c1c;
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.pdf-editor-delete:hover {
  background: #991b1b;
}

.pdf-editor-image {
  position: absolute;
  z-index: 22;
  box-sizing: border-box;
  touch-action: none;
  outline: 1.5px dashed rgba(15, 118, 110, .55);
  outline-offset: 2px;
  cursor: grab;
  user-select: none;
}

.pdf-editor-image.is-dragging {
  cursor: grabbing;
  z-index: 32;
  opacity: .96;
}

.pdf-editor-image-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  -webkit-user-drag: none;
}

.pdf-editor-image-resize {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 3px;
  background: #0f766e;
  cursor: nwse-resize;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
}

.pdf-editor-image-actions {
  position: absolute;
  top: -1.55rem;
  right: 0;
  flex-direction: row;
}

.pdf-editor-image-actions .pdf-editor-delete {
  width: 1.55rem;
  min-width: 1.55rem;
}

.sign-box, .ocr-box {
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--bg-soft);
}

.sign-box-head, .ocr-box h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
  font-size: .95rem;
}

.sign-hint {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

.sign-pad-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .65rem .85rem;
  margin-top: .75rem;
}

.sign-pad-page-field {
  flex: 1 1 10rem;
  min-width: 8rem;
  max-width: 14rem;
}

.sign-pad-actions .btn-primary {
  flex: 0 0 auto;
  min-height: 38px;
  padding-inline: 1rem;
}

.sign-pad-wrap {
  border-radius: 12px;
  border: 1px dashed var(--border);
  /* Checkerboard so transparent pad is visible */
  background-color: #f8fafc;
  background-image:
    linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  overflow: hidden;
}

[data-theme="dark"] .sign-pad-wrap {
  background-color: #1e293b;
  background-image:
    linear-gradient(45deg, #334155 25%, transparent 25%),
    linear-gradient(-45deg, #334155 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #334155 75%),
    linear-gradient(-45deg, transparent 75%, #334155 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

#signCanvas {
  display: block;
  width: 100%;
  height: 200px;
  background: transparent;
  touch-action: none;
  cursor: crosshair;
}

.sign-place {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.sign-size-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: .5rem;
  color: var(--text-muted);
}

#signSizeRange {
  width: 100%;
  margin-bottom: 1rem;
  accent-color: var(--brand-600);
}

.sign-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .65rem .85rem;
  margin-bottom: .65rem;
}

.sign-toolbar-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
}

.sign-toolbar-actions .btn-sm {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-weight: 700;
}

.sign-toolbar-actions .btn-sm svg {
  flex: 0 0 auto;
}

.sign-toolbar-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
  margin-left: auto;
}

.sign-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.sign-zoom-label {
  min-width: 3.5rem;
  text-align: center;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
}

.sign-page-meta {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.sign-preview-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
  max-height: min(720px, 75vh);
  min-height: 220px;
  background:
    linear-gradient(45deg, #94a3b8 25%, transparent 25%),
    linear-gradient(-45deg, #94a3b8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #94a3b8 75%),
    linear-gradient(-45deg, transparent 75%, #94a3b8 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #cbd5e1;
  overscroll-behavior: contain;
}

.sign-preview {
  position: relative;
  display: block;
  width: 100%;
  line-height: 0;
  min-height: 220px;
  padding: .75rem;
  box-sizing: border-box;
}

.sign-preview.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.sign-preview-empty {
  margin: 0;
  padding: 1.5rem;
  font-size: .9rem;
  font-weight: 600;
  color: #334155;
  line-height: 1.4;
  text-align: center;
  max-width: 260px;
}

.sign-preview-empty[hidden] {
  display: none !important;
}

.sign-pages {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  width: 100%;
  margin: 0 auto;
  transform-origin: top center;
}

.sign-page {
  background: transparent;
}

.sign-page-label {
  display: inline-block;
  margin-bottom: .35rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.4;
}

.sign-page-surface {
  position: relative;
  display: block;
  width: 100%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .18);
  line-height: 0;
}

.sign-page-add {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: .55rem;
  z-index: 4;
}

.pdf-editor-page-add {
  margin-top: .65rem;
  margin-bottom: .15rem;
}

.sign-page-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--brand-600, #2563eb);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .12);
  transition: .15s ease;
}

.sign-page-add-btn:hover,
.sign-page-add.is-open .sign-page-add-btn {
  border-color: var(--brand-600, #2563eb);
  background: var(--brand-600, #2563eb);
  color: #fff;
}

.sign-page-add-menu {
  position: absolute;
  bottom: calc(100% + .4rem);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 11.5rem;
  padding: .35rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .18);
  z-index: 6;
}

.sign-page-add-menu[hidden] {
  display: none !important;
}

.sign-page-add-option {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .55rem .65rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: .85rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.sign-page-add-option:hover {
  background: rgba(37, 99, 235, .08);
  color: var(--brand-700, #1d4ed8);
}

.sign-page-add-option svg {
  flex: 0 0 auto;
  color: var(--brand-600, #2563eb);
}

.sign-page-surface img,
.sign-page-surface canvas,
.sign-page-raster {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  user-select: none;
  pointer-events: none;
  background: #fff;
  /* Prefer high-quality downscale; avoid pixelated upscale artifacts */
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
}

.sign-overlay {
  position: absolute;
  left: 68%;
  top: 72%;
  width: 25%;
  cursor: grab;
  touch-action: none;
  z-index: 2;
  border: 1.5px dashed rgba(37, 99, 235, .7);
  border-radius: 4px;
  background: transparent;
  box-sizing: border-box;
}

.sign-overlay[hidden] {
  display: none !important;
}

.sign-overlay:active {
  cursor: grabbing;
}

.sign-overlay img {
  display: block;
  width: 100%;
  height: auto;
  background: transparent;
  pointer-events: none;
  user-select: none;
}

.sign-overlay-delete {
  position: absolute;
  top: -10px;
  right: -10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .28);
  z-index: 3;
}

.sign-overlay-delete:hover {
  background: #dc2626;
}

.sign-overlay-delete svg {
  display: block;
}

.sign-resize-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--brand-600);
  border: 2px solid #fff;
  cursor: nwse-resize;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}

.sign-page-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}

.sign-text-modal,
.sign-draw-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.sign-text-modal[hidden],
.sign-draw-modal[hidden] {
  display: none !important;
}

.sign-text-modal-backdrop,
.sign-draw-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .48);
}

.sign-text-modal-dialog,
.sign-draw-modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  max-height: min(90vh, 640px);
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.35rem 1.35rem 1.2rem;
  box-shadow: var(--shadow-lg);
}

.sign-draw-modal-dialog {
  max-width: 560px;
}

.sign-draw-modal-pad {
  margin: .35rem 0 .25rem;
}

.sign-draw-modal-dialog h3 {
  margin: 0 1.5rem .45rem 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.sign-text-modal-dialog h3 {
  margin: 0 1.5rem .45rem 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.sign-text-modal-close {
  position: absolute;
  top: .7rem;
  right: .75rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.sign-text-modal-close:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.sign-text-modal-page {
  margin: 0 0 .85rem;
  font-size: .85rem;
  font-weight: 700;
  color: var(--brand-600);
}

.sign-text-modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
}

body.sign-text-modal-open {
  overflow: hidden;
}

.sign-text-input {
  width: 100%;
  margin: .35rem 0 .75rem;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  color: var(--text);
  background: #fff;
  resize: vertical;
  min-height: 2.75rem;
  box-sizing: border-box;
}

.sign-text-input:focus {
  outline: 2px solid rgba(37, 99, 235, .25);
  border-color: var(--brand-600);
}

.pdf-editor-rich-input {
  min-height: 6.25rem;
  max-height: 14rem;
  overflow-y: auto;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
  cursor: text;
}

.pdf-editor-rich-input:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}

.pdf-editor-rich-input b,
.pdf-editor-rich-input strong {
  font-weight: 700;
}

.pdf-editor-rich-input i,
.pdf-editor-rich-input em {
  font-style: italic;
}

.pdf-editor-text-label b,
.pdf-editor-text-label strong,
.pdf-editor-content-input b,
.pdf-editor-content-input strong {
  font-weight: 700;
}

.pdf-editor-text-label i,
.pdf-editor-text-label em,
.pdf-editor-content-input i,
.pdf-editor-content-input em {
  font-style: italic;
}

.sign-text-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .75rem;
  margin-bottom: .75rem;
  align-items: end;
}

.sign-text-field-color {
  min-width: 4.5rem;
}

.sign-text-color {
  display: block;
  width: 3.25rem;
  height: 2.4rem;
  padding: .15rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.sign-text-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .85rem 0 0;
}

.sign-text-overlay {
  position: absolute;
  left: 12%;
  top: 18%;
  max-width: 90%;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  z-index: 3;
  padding: .1rem .2rem .15rem;
  border: 1.5px dashed transparent;
  border-radius: 4px;
  background: transparent;
  box-sizing: border-box;
}

.sign-preview,
.sign-pages,
.sign-page-surface {
  touch-action: pan-y;
}

.sign-page-surface:has(.sign-text-overlay.is-selected),
.sign-page-surface:has(.sign-text-overlay:active) {
  touch-action: none;
}

.sign-text-overlay:active {
  cursor: grabbing;
}

.sign-text-overlay.is-selected {
  border-color: rgba(37, 99, 235, .75);
  background: rgba(37, 99, 235, .06);
  z-index: 5;
}

.sign-text-overlay.is-editing {
  z-index: 6;
}

.sign-text-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 3px;
  background: #2563eb;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .35);
  z-index: 7;
  display: none;
  touch-action: none;
  box-sizing: border-box;
}

.sign-text-overlay.is-selected .sign-text-handle {
  display: block;
}

.sign-text-handle-nw {
  top: -6px;
  left: -6px;
  cursor: nwse-resize;
}

.sign-text-handle-ne {
  top: -6px;
  right: -6px;
  cursor: nesw-resize;
}

.sign-text-handle-sw {
  bottom: -6px;
  left: -6px;
  cursor: nesw-resize;
}

.sign-text-handle-se {
  bottom: -6px;
  right: -6px;
  cursor: nwse-resize;
}

.sign-text-body {
  display: block;
  line-height: 1.25;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
}

.sign-text-content {
  display: block;
  pointer-events: none;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.sign-text-chrome {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 8;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  line-height: 1.2;
  color: #0f172a;
  cursor: default;
  /* Floated outside the overlay box so selection border wraps text only */
  pointer-events: auto;
}

.sign-text-overlay.is-selected .sign-text-chrome {
  display: block;
}

/* If text sits near the bottom, flip controls above the box */
.sign-text-overlay.is-chrome-above .sign-text-chrome {
  top: auto;
  bottom: calc(100% + 8px);
}

.sign-text-actions {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

.sign-text-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .2rem .55rem;
  border: 1px solid #2563eb;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .18);
}

.sign-text-edit-btn:hover {
  background: #1d4ed8;
}

.sign-text-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid #ef4444;
  border-radius: 6px;
  background: #ef4444;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .18);
}

.sign-text-delete-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.sign-text-delete-btn svg {
  display: block;
}

.sign-text-edit-panel {
  margin-top: .4rem;
  padding: .45rem .5rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .16);
  min-width: 168px;
  max-width: min(240px, 70vw);
  box-sizing: border-box;
}

.sign-text-edit-panel[hidden] {
  display: none !important;
}

.sign-text-edit-row {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-top: .35rem;
}

.sign-text-edit-row:first-child {
  margin-top: 0;
}

.sign-text-inline-font {
  width: 100%;
  padding: .25rem .35rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 11px;
  background: #fff;
}

.sign-text-inline-color {
  width: 2rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  flex: 0 0 auto;
}

.sign-text-size-btn {
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.sign-text-size-btn:hover {
  background: #e2e8f0;
}

.sign-text-inline-size {
  flex: 1 1 auto;
  min-width: 0;
  accent-color: #2563eb;
}

.sign-text-inline-size-label {
  min-width: 2.1rem;
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
}

.ocr-hint {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

.image-compress-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
}

@media (max-width: 640px) {
  .image-compress-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.compress-box {
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--bg-soft);
}

/* ── Visual video cutter ── */
.vcut-box {
  padding: 1.15rem 1.15rem 1.25rem;
}

.vcut-stage {
  position: relative;
  margin-top: .85rem;
  border-radius: 14px;
  overflow: hidden;
  background: #0b1220;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
}

.vcut-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  background: #0b1220;
}

.vcut-box.is-ready .vcut-video {
  display: block;
}

.vcut-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  color: #94a3b8;
  text-align: center;
  padding: 1.5rem;
  pointer-events: none;
}

.vcut-empty p {
  margin: 0;
  font-size: .9rem;
  font-weight: 600;
  max-width: 16rem;
  line-height: 1.4;
}

.vcut-box.is-ready .vcut-empty {
  display: none;
}

.vcut-panel {
  margin-top: 1rem;
}

.vcut-panel[hidden] {
  display: none !important;
}

.vcut-transport {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem;
  margin-bottom: .85rem;
}

.vcut-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
}

.vcut-play-btn .vcut-icon-pause {
  display: none;
}

.vcut-play-btn.is-playing .vcut-icon-play {
  display: none;
}

.vcut-play-btn.is-playing .vcut-icon-pause {
  display: block;
}

.vcut-clock {
  margin-left: auto;
  display: inline-flex;
  align-items: baseline;
  gap: .3rem;
  font-size: .88rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.vcut-clock strong {
  color: var(--text);
  font-size: 1rem;
}

.vcut-timeline {
  position: relative;
  height: 44px;
  margin: .25rem 0 .35rem;
  user-select: none;
  touch-action: none;
}

.vcut-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 10px;
  margin-top: -5px;
  border-radius: 999px;
  background: #cbd5e1;
  overflow: hidden;
}

[data-theme="dark"] .vcut-track {
  background: #334155;
}

.vcut-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0%;
  width: 100%;
  background: linear-gradient(90deg, rgba(37, 99, 235, .85), rgba(59, 130, 246, .75));
  border-radius: inherit;
}

.vcut-playhead {
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: 0%;
  width: 2px;
  margin-left: -1px;
  background: #f8fafc;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .35);
  pointer-events: none;
  z-index: 3;
}

.vcut-range {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
  z-index: 2;
}

.vcut-range::-webkit-slider-runnable-track {
  height: 10px;
  background: transparent;
  border: none;
}

.vcut-range::-moz-range-track {
  height: 10px;
  background: transparent;
  border: none;
}

.vcut-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 28px;
  margin-top: -9px;
  border-radius: 6px;
  border: 2px solid #fff;
  background: var(--brand-600);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .28);
  pointer-events: auto;
  cursor: ew-resize;
}

.vcut-range::-moz-range-thumb {
  width: 18px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid #fff;
  background: var(--brand-600);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .28);
  pointer-events: auto;
  cursor: ew-resize;
}

.vcut-range-start {
  z-index: 4;
}

.vcut-range-end {
  z-index: 5;
}

.vcut-markers {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .35rem 0 .9rem;
}

.vcut-times {
  display: grid;
  grid-template-columns: 1fr 1fr minmax(7rem, auto);
  gap: .75rem;
  align-items: end;
  margin-bottom: .9rem;
}

.vcut-time-field {
  display: grid;
  gap: .3rem;
}

.vcut-time-field span,
.vcut-clip span {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.vcut-clip {
  display: grid;
  gap: .3rem;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  min-height: 3.15rem;
}

.vcut-clip strong {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--brand-700, #1d4ed8);
}

@media (max-width: 640px) {
  .vcut-times {
    grid-template-columns: 1fr 1fr;
  }
  .vcut-clip {
    grid-column: 1 / -1;
  }
  .vcut-clock {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
}

/* ── Visual audio cutter (reuses vcut controls) ── */
.acut-stage {
  aspect-ratio: 21 / 9;
  min-height: 140px;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(37, 99, 235, .35), transparent 55%),
    linear-gradient(180deg, #0f172a 0%, #020617 100%);
}

.acut-audio {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.acut-viz {
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 52%;
  width: min(88%, 420px);
  z-index: 1;
}

.acut-box.is-ready .acut-viz {
  display: flex;
}

.acut-viz span {
  flex: 1;
  max-width: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  opacity: .55;
  height: calc(28% + (var(--h, 40) * 1%));
  transform-origin: bottom center;
  transition: height .25s ease, opacity .2s ease;
}

.acut-box.is-playing .acut-viz span {
  opacity: .95;
  animation: acut-bar 1.05s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 60ms);
}

.acut-viz span:nth-child(1) { --h: 34; --i: 0; }
.acut-viz span:nth-child(2) { --h: 62; --i: 1; }
.acut-viz span:nth-child(3) { --h: 48; --i: 2; }
.acut-viz span:nth-child(4) { --h: 78; --i: 3; }
.acut-viz span:nth-child(5) { --h: 40; --i: 4; }
.acut-viz span:nth-child(6) { --h: 70; --i: 5; }
.acut-viz span:nth-child(7) { --h: 55; --i: 6; }
.acut-viz span:nth-child(8) { --h: 88; --i: 7; }
.acut-viz span:nth-child(9) { --h: 46; --i: 8; }
.acut-viz span:nth-child(10) { --h: 66; --i: 9; }
.acut-viz span:nth-child(11) { --h: 38; --i: 10; }
.acut-viz span:nth-child(12) { --h: 74; --i: 11; }
.acut-viz span:nth-child(13) { --h: 52; --i: 12; }
.acut-viz span:nth-child(14) { --h: 82; --i: 13; }
.acut-viz span:nth-child(15) { --h: 44; --i: 14; }
.acut-viz span:nth-child(16) { --h: 68; --i: 15; }
.acut-viz span:nth-child(17) { --h: 50; --i: 16; }
.acut-viz span:nth-child(18) { --h: 76; --i: 17; }
.acut-viz span:nth-child(19) { --h: 42; --i: 18; }
.acut-viz span:nth-child(20) { --h: 60; --i: 19; }

@keyframes acut-bar {
  0%, 100% { transform: scaleY(.45); }
  50% { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  .acut-box.is-playing .acut-viz span {
    animation: none;
  }
}

.compress-box h3 {
  font-size: .95rem;
  margin-bottom: .35rem;
}

.compress-options {
  display: grid;
  gap: .6rem;
}

.compress-option {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  transition: .2s;
}

.compress-option:hover,
.compress-option:has(input:checked) {
  border-color: var(--brand-400, #60a5fa);
  background: var(--brand-50);
  color: var(--brand-800);
}

[data-theme="dark"] .compress-option:hover,
[data-theme="dark"] .compress-option:has(input:checked) {
  background: rgba(59, 130, 246, .12);
  color: var(--brand-200);
}

.compress-option input {
  accent-color: var(--brand-600);
}

.page-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
}

@media (max-width: 768px) {
  .page-settings-grid {
    grid-template-columns: 1fr;
  }
}

.page-setting-field .sign-size-label {
  margin-bottom: .4rem;
}

.page-setting-field .split-range-input {
  margin: 0;
}

.split-range-wrap {
  margin-top: 1rem;
}

.split-range-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .75rem 1rem;
  font: inherit;
  background: var(--bg);
  color: var(--text);
}

.qr-generate-btn {
  width: 100%;
  margin-top: 1rem;
}

.qr-preview-wrap {
  margin-top: 1.25rem;
  text-align: center;
}

.qr-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  min-width: 280px;
  min-height: 280px;
  position: relative;
}

.qr-preview canvas,
.qr-preview img {
  display: block;
  width: 256px;
  height: 256px;
  max-width: 100%;
  object-fit: contain;
}

.qr-preview img[hidden],
.qr-preview canvas[hidden],
.qr-preview-empty[hidden] {
  display: none !important;
}

.qr-preview-empty {
  margin: 0;
  font-size: .85rem;
  color: #94a3b8;
  font-weight: 600;
  max-width: 180px;
}

.barcode-preview {
  min-height: 140px;
  padding: 1rem;
}

.barcode-preview svg,
.barcode-preview canvas,
.barcode-preview img {
  max-width: 100%;
  height: auto;
  background: #fff;
}

.barcode-check {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.qr-text-area {
  resize: vertical;
  min-height: 110px;
  line-height: 1.5;
}

#ocrText {
  display: block;
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .85rem 1rem;
  font-family: ui-monospace, 'Cascadia Code', 'Segoe UI', Consolas, monospace;
  font-size: .95rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
}

#ocrText:focus {
  outline: 2px solid var(--brand-200);
  border-color: var(--brand-500);
}

.ocr-status {
  margin-top: .5rem;
  font-size: .8rem;
  color: var(--brand-700);
  font-weight: 600;
}

.tool-actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.tool-result {
  margin-top: 1.5rem;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}

[data-theme="dark"] .tool-result {
  background: rgba(22, 163, 74, .1);
  border-color: rgba(22, 163, 74, .35);
}

.tool-result h3 {
  margin: .5rem 0;
  font-family: var(--font-display);
}

.tool-result p {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: .9rem;
}

.tool-result-actions {
  display: flex;
  justify-content: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.tool-error {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: .9rem;
  font-weight: 600;
}

[data-theme="dark"] .tool-error {
  background: rgba(185, 28, 28, .15);
  border-color: rgba(185, 28, 28, .4);
  color: #fca5a5;
}

/* ── Floating chat widget ── */
.chat-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1200;
  font-family: var(--font-body, inherit);
}

.chat-fab {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .85rem 1.1rem;
  border: 0;
  border-radius: 999px;
  background: var(--brand-600);
  color: #fff;
  font-weight: 700;
  font-size: .92rem;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(37, 99, 235, .35);
  transition: transform .15s ease, background .15s ease;
}

.chat-fab:hover { background: var(--brand-700); transform: translateY(-1px); }
.chat-fab-icon { display: flex; }
.chat-fab-badge {
  position: absolute;
  top: -.35rem;
  right: -.15rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 .35rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: .7rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.chat-widget > .chat-fab { position: relative; }

.chat-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + .75rem);
  width: min(380px, calc(100vw - 1.5rem));
  height: min(520px, calc(100vh - 6rem));
  display: flex;
  flex-direction: column;
  background: var(--bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .18);
  overflow: hidden;
}

.chat-panel[hidden] { display: none !important; }

.chat-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, var(--brand-700), var(--brand-600));
  color: #fff;
}

.chat-panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.chat-panel-head p {
  margin: .2rem 0 0;
  font-size: .78rem;
  opacity: .9;
}

.chat-panel-close {
  border: 0;
  background: rgba(255,255,255,.15);
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.chat-intro {
  padding: .85rem 1rem .25rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.chat-intro > p {
  margin: 0 0 .65rem;
  font-size: .82rem;
  color: var(--text-muted, #64748b);
}

.chat-intro-fields {
  display: grid;
  gap: .55rem;
  margin-bottom: .75rem;
}

.chat-intro-fields label {
  display: grid;
  gap: .25rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
}

.chat-intro-fields input {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  font: inherit;
  background: var(--bg, #fff);
  color: var(--text, #0f172a);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  background: var(--bg-soft, #f8fafc);
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--text-muted, #64748b);
  font-size: .85rem;
  max-width: 16rem;
}

.chat-bubble {
  max-width: 88%;
  padding: .65rem .8rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
}

.chat-bubble.is-mine {
  align-self: flex-end;
  background: var(--brand-50, #eff6ff);
  border-color: var(--brand-100, #dbeafe);
}

.chat-bubble.is-admin {
  align-self: flex-start;
}

.chat-bubble-meta {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  margin-bottom: .25rem;
}

.chat-bubble-body {
  font-size: .9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text, #0f172a);
}

.chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .55rem;
  padding: .75rem;
  border-top: 1px solid var(--border, #e5e7eb);
  background: var(--bg, #fff);
}

.chat-compose textarea {
  resize: none;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: .65rem .75rem;
  font: inherit;
  min-height: 2.75rem;
  background: var(--bg, #fff);
  color: var(--text, #0f172a);
}

.chat-send {
  align-self: end;
  padding: .7rem 1rem !important;
}

.chat-status {
  margin: 0;
  padding: 0 .75rem .65rem;
  font-size: .78rem;
  color: var(--text-muted, #64748b);
}

.chat-status.is-error { color: #b91c1c; }

[data-theme="dark"] .chat-panel {
  background: #0f172a;
  border-color: #1e293b;
}

[data-theme="dark"] .chat-messages { background: #020617; }
[data-theme="dark"] .chat-bubble {
  background: #111827;
  border-color: #1f2937;
}
[data-theme="dark"] .chat-bubble.is-mine {
  background: rgba(37, 99, 235, .2);
  border-color: rgba(37, 99, 235, .35);
}
[data-theme="dark"] .chat-compose,
[data-theme="dark"] .chat-intro {
  background: #0f172a;
  border-color: #1e293b;
}

@media (max-width: 640px) {
  .chat-widget { right: .75rem; bottom: .75rem; }
  .chat-fab-label { display: none; }
  .chat-fab { padding: .95rem; border-radius: 999px; }
  .chat-panel {
    position: fixed;
    left: .5rem;
    right: .5rem;
    bottom: .5rem;
    width: auto;
    height: min(70vh, 560px);
  }
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .main-nav { display: none; }
  .mobile-menu-btn { display: flex; }
  .hero { padding-top: 2.5rem; }
  .hero-visual {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .security-layout { grid-template-columns: 1fr; gap: 2rem; }
  .security-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .header-actions .btn-ghost,
  .header-actions .btn-primary,
  .header-login-text,
  .header-register-text { display: none; }
  .header-login-icon { display: flex; }
  .tools-grid { grid-template-columns: 1fr; }
  .how-steps { grid-template-columns: 1fr; gap: 2.5rem; }
  .how-steps::before { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .security-intro h2 { font-size: 1.7rem; }
  .security-point { padding: 1rem 1.05rem; }
  .security-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom-inner { flex-direction: column; gap: .75rem; }
}

/* ── Payment invoice ── */
.account-invoice-link {
  display: inline-flex;
  font-size: .82rem;
  font-weight: 700;
  color: var(--brand-600);
  text-decoration: none;
  white-space: nowrap;
}

.account-invoice-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.invoice-section {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.invoice-layout {
  max-width: 820px;
}

.invoice-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.invoice-sheet {
  background: #fff;
  color: #0f172a;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow);
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.invoice-brand p {
  margin: .5rem 0 0;
  font-weight: 700;
  color: #334155;
}

.invoice-logo {
  height: 48px;
  width: auto;
  display: block;
}

.invoice-meta {
  text-align: right;
}

.invoice-meta h1 {
  margin: 0 0 .65rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
}

.invoice-meta p {
  margin: 0 0 .3rem;
  font-size: .92rem;
  color: #475569;
}

.invoice-meta span {
  display: inline-block;
  min-width: 6.5rem;
  color: #94a3b8;
  margin-right: .35rem;
}

.invoice-status {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
}

.invoice-status-paid { background: #dcfce7; color: #15803d; }
.invoice-status-pending { background: #fef3c7; color: #b45309; }
.invoice-status-failed { background: #fee2e2; color: #b91c1c; }
.invoice-status-refunded { background: #e0e7ff; color: #3730a3; }

.invoice-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  padding: 1.5rem 0;
}

.invoice-parties h2 {
  margin: 0 0 .45rem;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #94a3b8;
}

.invoice-parties p {
  margin: 0;
  font-size: .95rem;
  color: #475569;
  line-height: 1.5;
}

.invoice-party-name {
  font-weight: 700 !important;
  color: #0f172a !important;
}

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

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}

.invoice-table th,
.invoice-table td {
  text-align: left;
  padding: .85rem .5rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.invoice-table th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #94a3b8;
}

.invoice-col-amount {
  text-align: right !important;
  white-space: nowrap;
}

.invoice-item-sub {
  margin-top: .25rem;
  font-size: .82rem;
  color: #64748b;
}

.invoice-ref {
  word-break: break-all;
  max-width: 12rem;
}

.invoice-totals {
  margin-top: 1.25rem;
  margin-left: auto;
  width: min(280px, 100%);
}

.invoice-total-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .45rem 0;
  font-size: .95rem;
  color: #475569;
}

.invoice-total-grand {
  margin-top: .35rem;
  padding-top: .75rem;
  border-top: 2px solid #0f172a;
  font-size: 1.1rem;
  color: #0f172a;
}

.invoice-notes {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.invoice-notes h2 {
  margin: 0 0 .4rem;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
}

.invoice-notes p {
  margin: 0;
  font-size: .9rem;
  color: #334155;
  line-height: 1.55;
}

.invoice-footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.invoice-footer p {
  margin: 0 0 .35rem;
  font-size: .92rem;
  color: #334155;
}

.invoice-footer-muted {
  color: #94a3b8 !important;
  font-size: .8rem !important;
}

@media (max-width: 640px) {
  .invoice-sheet { padding: 1.25rem 1.1rem; }
  .invoice-meta { text-align: left; }
  .invoice-parties { grid-template-columns: 1fr; }
}

/* Quotation Maker */
.quotation-box h4 {
  margin: 0 0 .75rem;
  font-family: var(--font-display);
  font-size: 1rem;
}

.quotation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}

.quotation-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-soft, #f8fafc);
  min-width: 0;
}

.quotation-card .sign-size-label {
  margin-top: .65rem;
}

.quotation-card .sign-size-label:first-of-type {
  margin-top: 0;
}

.quotation-textarea {
  resize: vertical;
  min-height: 4rem;
}

.quotation-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

.quotation-meta-card {
  margin-bottom: 1rem;
}

.quotation-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

.quotation-meta-grid.is-invoice {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quotation-logo-card {
  margin: 1rem 0;
}

.quotation-logo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .85rem;
}

.quotation-logo-preview {
  width: 96px;
  height: 96px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.quotation-logo-preview[hidden] {
  display: none !important;
}

.quotation-logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.quotation-logo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

.doc-save-bar {
  margin-bottom: 1rem;
}

.doc-save-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

.doc-save-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .75rem;
}

.doc-save-actions .doc-delete-btn {
  border-color: #fecaca;
  color: #b91c1c;
}

.doc-save-actions .doc-delete-btn:hover {
  background: #fef2f2;
}

.doc-combobox {
  position: relative;
}

.doc-combobox-native,
select.doc-combobox-native[hidden] {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  display: block !important; /* override [hidden] so layout stays in combobox */
}

.doc-combobox-input {
  width: 100%;
  box-sizing: border-box;
}

.doc-combobox.is-open .doc-combobox-input {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.doc-combobox-list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% - 1px);
  max-height: 220px;
  overflow-y: auto;
  margin: 0;
  padding: .35rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.doc-combobox-list[hidden] {
  display: none !important;
}

.doc-combobox-option {
  padding: .55rem .85rem;
  font-size: .9rem;
  cursor: pointer;
  color: var(--text, #0f172a);
}

.doc-combobox-option.is-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.doc-combobox-option:hover,
.doc-combobox-option.is-active {
  background: #eff6ff;
}

.doc-combobox-option.is-selected {
  font-weight: 700;
  background: #f8fafc;
}

.doc-combobox-empty {
  padding: .65rem .85rem;
  font-size: .85rem;
  color: var(--text-muted);
}

.quotation-items-table.is-corporate th:nth-child(2),
.quotation-items-table.is-corporate th:nth-child(3),
.quotation-items-table.is-corporate th:nth-child(4),
.quotation-items-table.is-corporate th:nth-child(5),
.quotation-items-table.is-corporate th:nth-child(6),
.quotation-items-table.is-corporate td:nth-child(2),
.quotation-items-table.is-corporate td:nth-child(3),
.quotation-items-table.is-corporate td:nth-child(4),
.quotation-items-table.is-corporate td:nth-child(5),
.quotation-items-table.is-corporate td:nth-child(6) {
  width: 5.5rem;
}

.account-doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.account-doc-list li {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}

.account-doc-list li strong {
  display: block;
}

.account-doc-list li span {
  color: var(--text-muted);
  font-size: .8rem;
}

@media (max-width: 820px) {
  .doc-save-row {
    grid-template-columns: 1fr;
  }
}

.quotation-items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
}

.quotation-items-head h4 {
  margin: 0;
}

.quotation-items-wrap {
  overflow-x: auto;
}

.quotation-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.quotation-items-table th,
.quotation-items-table td {
  padding: .45rem .35rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.quotation-items-table th:nth-child(2),
.quotation-items-table th:nth-child(3),
.quotation-items-table th:nth-child(4),
.quotation-items-table td:nth-child(2),
.quotation-items-table td:nth-child(3),
.quotation-items-table td:nth-child(4) {
  width: 6.5rem;
}

.quotation-items-table th:last-child,
.quotation-items-table td:last-child {
  width: 2.5rem;
  text-align: center;
}

.quotation-items-table .split-range-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.quotation-item-amount {
  font-weight: 700;
  white-space: nowrap;
}

.quotation-remove-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff;
  color: #dc2626;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.quotation-remove-btn:hover {
  background: #fef2f2;
}

.quotation-bottom {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.quotation-summary .quotation-total-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .92rem;
}

.quotation-summary .quotation-total-row.is-grand {
  border-bottom: 0;
  margin-top: .35rem;
  padding-top: .7rem;
  font-size: 1.05rem;
}

.quotation-summary .quotation-total-row.is-grand strong {
  color: var(--brand-700, #1d4ed8);
}

/* Image Watermark */
.watermark-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 1.25rem;
  align-items: start;
  margin-top: 1rem;
}

.watermark-form {
  min-width: 0;
}

.watermark-preview-panel {
  position: sticky;
  top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
}

.watermark-preview-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: .65rem;
  border-radius: 10px;
  background:
    linear-gradient(45deg, #e7e5e4 25%, transparent 25%),
    linear-gradient(-45deg, #e7e5e4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e7e5e4 75%),
    linear-gradient(-45deg, transparent 75%, #e7e5e4 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #f5f5f4;
  overflow: hidden;
}

.watermark-preview-empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  color: #78716c;
  font-size: .88rem;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 8px;
}

.watermark-preview-empty[hidden],
#wmPreviewCanvas[hidden] {
  display: none !important;
}

#wmPreviewCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(154, 52, 18, 0.14);
  background: #fff;
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
}

.wm-range {
  accent-color: #ea580c;
}

@media (max-width: 960px) {
  .watermark-layout {
    grid-template-columns: 1fr;
  }

  .watermark-preview-panel {
    position: static;
  }
}

/* Business Card Maker */
.bc-template-select-row {
  display: flex;
  align-items: flex-end;
  gap: .85rem;
}

.bc-template-select-field {
  flex: 1;
  min-width: 0;
}

.bc-template-swatch {
  display: block;
  width: 72px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  background: linear-gradient(180deg, #fff 50%, #1e293b 50%);
}

.bc-template-swatch[data-tpl="mono"] {
  background: linear-gradient(180deg, #fff 50%, #1e293b 50%);
}

.bc-template-swatch[data-tpl="sunshine"] {
  background: linear-gradient(180deg, #ffd200 50%, #fff 50%);
}

.bc-template-swatch[data-tpl="wave"] {
  background:
    linear-gradient(180deg, #fff 55%, transparent 55%),
    linear-gradient(135deg, #1e3a5f 40%, #f59e0b 100%);
}

.bc-template-swatch[data-tpl="trade"] {
  background: linear-gradient(110deg, #1d4ed8 48%, #fff 48%);
}

.bc-template-swatch[data-tpl="bold"] {
  background: linear-gradient(180deg, #111 38%, #ffc107 38% 72%, #111 72%);
}

.business-card-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 1.25rem;
  align-items: start;
  margin-top: 1rem;
}

.business-card-form {
  min-width: 0;
}

.business-card-preview-panel {
  position: sticky;
  top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #f0fdfa 0%, #ccfbf1 100%);
}

.business-card-dual-preview {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.business-card-dual-preview[hidden] {
  display: none !important;
}

.bc-edit-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .45rem;
  padding: .65rem;
  border: 1px solid rgba(13, 148, 136, 0.25);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
}

.bc-edit-toolbar[hidden] {
  display: none !important;
}

.bc-edit-field {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
}

.bc-edit-field span {
  font-size: .68rem;
  font-weight: 600;
  color: #0f766e;
}

.bc-edit-field .split-range-input {
  min-width: 96px;
  height: 2.1rem;
  padding: .25rem .45rem;
  font-size: .8rem;
}

.bc-edit-field input[type="number"] {
  width: 4.2rem;
  min-width: 4.2rem;
}

.bc-edit-toolbar .btn-sm {
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 .55rem;
}

.bc-edit-toolbar .btn-sm.is-active {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.bc-edit-toolbar .bc-edit-danger {
  color: #b91c1c;
  border-color: #fecaca;
}

.bc-edit-toolbar .bc-edit-danger:hover {
  background: #fef2f2;
}

.bc-edit-hint {
  margin: 0;
  font-size: .75rem;
  color: #0f766e;
  opacity: .85;
}

.bc-modal-style-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .65rem;
  margin-top: .85rem;
}

.bc-modal-style-row .bc-edit-field {
  flex: 1;
  min-width: 110px;
}

.bc-modal-style-toggles {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.bc-modal-toggle-btns {
  display: flex;
  gap: .35rem;
}

.bc-modal-toggle-btns .btn-sm {
  min-width: 2.2rem;
  height: 2.2rem;
}

.bc-modal-toggle-btns .btn-sm.is-active {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.bc-canvas-wrap {
  position: relative;
}

.bc-canvas-wrap canvas {
  cursor: default;
  touch-action: none;
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
}

.bc-float-actions {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: .3rem;
  pointer-events: auto;
  transform: translateY(-50%);
}

.bc-float-actions[hidden] {
  display: none !important;
}

.bc-float-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
  cursor: pointer;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
  padding: 0 .55rem;
  height: 28px;
  white-space: nowrap;
}

.bc-float-btn svg {
  display: block;
  flex-shrink: 0;
}

.bc-float-edit {
  background: #0f766e;
  color: #fff;
  padding-right: .7rem;
}

.bc-float-edit:hover {
  background: #0d9488;
}

.bc-float-del {
  width: 28px;
  padding: 0;
  background: #fff;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.bc-float-del:hover {
  background: #fef2f2;
}

.bc-side-block {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.bc-side-label {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #0f766e;
}

.business-card-preview-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .65rem;
  border-radius: 10px;
  background: #e7e5e4;
}

.business-card-preview-frame canvas {
  display: block;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 3.5 / 2;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 10px 28px rgba(15, 118, 110, 0.18);
  background: #fff;
}

.business-card-preview-empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  color: #78716c;
  font-size: .88rem;
}

.business-card-preview-empty[hidden] {
  display: none !important;
}

.bc-logo-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 112px;
  padding: .85rem;
  border: 1.5px dashed #99f6e4;
  border-radius: 12px;
  background:
    linear-gradient(180deg, #f0fdfa 0%, #ecfeff 100%);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.bc-logo-dropzone:hover,
.bc-logo-dropzone:focus-visible {
  border-color: var(--brand-600, #0d9488);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
  outline: none;
}

.bc-logo-dropzone.is-dragover {
  border-color: var(--brand-600, #0d9488);
  background: #ccfbf1;
}

.bc-logo-dropzone.has-logo {
  border-style: solid;
  background: #fff;
}

.bc-logo-dropzone-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  text-align: center;
  color: #0f766e;
}

.bc-logo-dropzone-empty[hidden] {
  display: none !important;
}

.bc-logo-dropzone-empty strong {
  font-size: .88rem;
  color: #134e4a;
}

.bc-logo-dropzone-empty span {
  font-size: .75rem;
  color: #0f766e;
  opacity: .75;
}

.bc-logo-dropzone-preview {
  width: 100%;
  max-width: 160px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bc-logo-dropzone-preview[hidden] {
  display: none !important;
}

.bc-logo-dropzone-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.bc-logo-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .65rem;
}

@media (max-width: 960px) {
  .business-card-layout {
    grid-template-columns: 1fr;
  }

  .business-card-preview-panel {
    position: static;
  }
}

/* Certificate Maker */
.certificate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 1.25rem;
  align-items: start;
  margin-top: 1rem;
}

.certificate-form {
  min-width: 0;
}

.certificate-preview-panel {
  position: sticky;
  top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
}

.certificate-preview-frame {
  position: relative;
  border-radius: 10px;
  background: #e7e5e4;
  padding: .5rem;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.certificate-preview-empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  color: #78716c;
  font-size: .88rem;
}

.certificate-preview-empty[hidden],
#certPreviewCanvas[hidden] {
  display: none !important;
}

#certPreviewCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 8px 24px rgba(68, 40, 0, 0.12);
  cursor: grab;
  border-radius: 2px;
  image-rendering: auto;
  -webkit-font-smoothing: antialiased;
}

#certPreviewCanvas.is-dragging {
  cursor: grabbing;
}

.certificate-template-thumb {
  width: 96px;
  height: 72px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.certificate-template-thumb[hidden] {
  display: none !important;
}

.certificate-template-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.cert-range {
  width: 100%;
  margin: .25rem 0 .65rem;
  accent-color: #b45309;
}

.cert-color {
  height: 2.5rem;
  padding: .2rem .35rem;
  cursor: pointer;
}

@media (max-width: 960px) {
  .certificate-layout {
    grid-template-columns: 1fr;
  }

  .certificate-preview-panel {
    position: static;
  }
}

/* Receipt live preview */
.quotation-box.is-receipt {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 1.25rem;
  align-items: start;
}

.quotation-box.is-receipt .doc-maker-main {
  min-width: 0;
}

.receipt-preview-panel {
  position: sticky;
  top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #faf8ff 0%, #f4f0fb 100%);
}

.receipt-preview-head h4 {
  margin: 0 0 .25rem;
  font-family: var(--font-display);
  font-size: 1rem;
}

.receipt-preview-head .ocr-hint {
  margin: 0 0 .85rem;
}

.receipt-preview-frame {
  padding: .65rem;
  border-radius: 12px;
  background:
    radial-gradient(circle at 20% 10%, rgba(124, 58, 237, 0.08), transparent 40%),
    #e8e4f0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.receipt-preview-sheet {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 8px 28px rgba(45, 20, 80, 0.12);
  padding: 1.1rem 1rem 1.25rem;
  color: #000;
  font-size: .78rem;
  line-height: 1.35;
  min-height: 280px;
}

.receipt-preview-sheet.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #000;
  font-size: .85rem;
  padding: 2rem 1rem;
}

.rp-logo {
  display: block;
  max-width: 88px;
  max-height: 52px;
  margin: 0 auto .65rem;
  object-fit: contain;
}

.rp-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #000;
  margin: 0 0 .15rem;
  text-align: left;
}

.rp-number {
  float: right;
  font-weight: 700;
  font-size: .85rem;
  color: #000;
  margin-top: .2rem;
}

.rp-bar {
  clear: both;
  height: 2px;
  background: #000;
  margin: .55rem 0 .7rem;
}

.rp-meta {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  color: #000;
  font-size: .72rem;
  margin-bottom: .75rem;
}

.rp-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
  margin-bottom: .85rem;
}

.rp-party-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #000;
  margin-bottom: .2rem;
}

.rp-party-name {
  font-weight: 700;
  font-size: .8rem;
  color: #000;
  margin-bottom: .15rem;
}

.rp-party-line {
  color: #000;
  font-size: .7rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.rp-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: .65rem;
  color: #000;
}

.rp-table th {
  text-align: left;
  font-size: .68rem;
  font-weight: 700;
  background: #f3f4f6;
  color: #000;
  padding: .35rem .3rem;
}

.rp-table th:nth-child(2),
.rp-table th:nth-child(3),
.rp-table th:nth-child(4),
.rp-table td:nth-child(2),
.rp-table td:nth-child(3),
.rp-table td:nth-child(4) {
  text-align: right;
  white-space: nowrap;
}

.rp-table td {
  padding: .35rem .3rem;
  border-bottom: 1px solid #e5e7eb;
  font-size: .72rem;
  color: #000;
  vertical-align: top;
}

.rp-totals {
  margin-left: auto;
  width: 62%;
  min-width: 140px;
}

.rp-total-row {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  padding: .2rem 0;
  color: #000;
  font-size: .72rem;
}

.rp-total-row.is-grand {
  margin-top: .25rem;
  padding-top: .4rem;
  border-top: 1.5px solid #000;
  color: #000;
  font-weight: 800;
  font-size: .85rem;
}

.rp-notes {
  margin-top: .75rem;
  padding-top: .55rem;
  border-top: 1px dashed #d1d5db;
}

.rp-notes strong {
  display: block;
  color: #000;
  font-size: .7rem;
  margin-bottom: .25rem;
}

.rp-notes p {
  margin: 0;
  color: #000;
  font-size: .7rem;
  white-space: pre-wrap;
}

.rp-footer {
  margin-top: .85rem;
  text-align: center;
  color: #000;
  font-size: .65rem;
}

@media (max-width: 960px) {
  .quotation-box.is-receipt {
    grid-template-columns: 1fr;
  }

  .receipt-preview-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .quotation-grid,
  .quotation-bottom,
  .quotation-meta-grid,
  .quotation-meta-grid.is-invoice,
  .quotation-inline {
    grid-template-columns: 1fr;
  }

  .rp-parties {
    grid-template-columns: 1fr;
  }

  .rp-totals {
    width: 100%;
  }
}

@media print {
  .site-header,
  .site-footer,
  .chat-widget,
  .auth-modal,
  .no-print,
  .invoice-toolbar {
    display: none !important;
  }

  body {
    background: #fff !important;
  }

  main {
    padding: 0 !important;
  }

  .invoice-section {
    padding: 0 !important;
  }

  .invoice-sheet {
    border: 0;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
  }
}
