/* Style CSS - Premium iOS-inspired Design System */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* Brand Crimson Red Identity */
  --primary: #EA3838;
  --primary-hover: #D32F2F;
  --primary-glow: rgba(234, 56, 56, 0.25);
  --bg: #F8F8FB;
  --surface: #FFFFFF;
  --surface-2: #F3F3F7;
  --ink: #1D1D21;
  --ink-soft: #6E6E73;
  --line: rgba(0,0,0,0.07);
  --red: #EA3838;
  --red-dark: #D32F2F;
  --orange: #FF9500;
  --blue: #0A84FF;
  --green: #34C759;
  --purple: #AF52DE;
  --teal: #32ADE6;
  --pink: #FF2D55;
  
  /* Sizes & Borders */
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --radius-xl: 32px;
  
  /* Shadows */
  --shadow-1: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
  --shadow-2: 0 4px 12px rgba(234, 56, 56, 0.1), 0 20px 48px rgba(0,0,0,0.12);
  
  /* Fonts */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  
  /* Transitions */
  --transition-spring: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  --transition-fast: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  --blur-amount: 20px;
  --bg-glass: rgba(248, 248, 251, 0.82);
  --border-glass: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
  /* Dark Theme Variables */
  --primary: #EA3838;
  --primary-hover: #FF4D4D;
  --primary-glow: rgba(234, 56, 56, 0.35);
  --bg: #0C0C0F;
  --surface: #17171C;
  --surface-2: #22222A;
  --ink: #F5F5F7;
  --ink-soft: #A1A1AA;
  --line: rgba(255,255,255,0.08);
  --shadow-1: 0 1px 3px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.6);
  --shadow-2: 0 4px 14px rgba(234, 56, 56, 0.25), 0 20px 48px rgba(0,0,0,0.8);
  --bg-glass: rgba(23, 23, 28, 0.82);
  --border-glass: rgba(255, 255, 255, 0.08);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--ink);
  transition: background-color 0.5s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s ease;
  overflow-x: hidden;
  padding-bottom: 80px; /* Space for mobile nav */
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Dynamic Animated Ambient Orbs for Premium Look */
body::before, body::after {
  content: "";
  position: fixed;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  pointer-events: none;
  z-index: -2;
  filter: blur(120px);
  opacity: 0.65;
  mix-blend-mode: normal;
  transition: opacity 0.5s ease;
}

body::before {
  background: radial-gradient(circle, rgba(88, 101, 242, 0.22) 0%, rgba(88, 101, 242, 0) 70%);
  top: -10vw;
  left: -10vw;
  animation: floatOrb1 32s ease infinite alternate;
}

body::after {
  background: radial-gradient(circle, rgba(175, 82, 222, 0.18) 0%, rgba(175, 82, 222, 0) 70%);
  bottom: -10vw;
  right: -10vw;
  animation: floatOrb2 36s ease infinite alternate;
}

/* Dark Mode glowing orb intensities */
[data-theme="dark"] body::before {
  background: radial-gradient(circle, rgba(88, 101, 242, 0.12) 0%, rgba(88, 101, 242, 0) 70%);
  opacity: 0.7;
}

[data-theme="dark"] body::after {
  background: radial-gradient(circle, rgba(175, 82, 222, 0.09) 0%, rgba(175, 82, 222, 0) 70%);
  opacity: 0.7;
}

@keyframes floatOrb1 {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(12vw, 15vh) scale(1.15);
  }
  100% {
    transform: translate(-5vw, 25vh) scale(0.9);
  }
}

@keyframes floatOrb2 {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-10vw, -12vh) scale(0.85);
  }
  100% {
    transform: translate(12vw, -8vh) scale(1.1);
  }
}

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

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink-soft);
}

/* ---------- NAV ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--line);
  transition: var(--transition-spring);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}

.brand-logo-img {
  height: 38px;
  max-height: 38px;
  width: auto;
  object-fit: contain;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  display: block;
}

.brand-logo-img:hover {
  transform: scale(1.04);
}

[data-theme="light"] .logo-theme-dark {
  display: none !important;
}

[data-theme="light"] .logo-theme-light {
  display: block !important;
}

[data-theme="dark"] .logo-theme-light {
  display: none !important;
}

[data-theme="dark"] .logo-theme-dark {
  display: block !important;
}

.brand-pdf {
  color: #EA3838;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-link {
  font-size: 14px;
  color: var(--ink-soft);
  font-weight: 500;
  transition: color .15s ease;
  padding: 6px 12px;
  border-radius: 8px;
}

.nav-link:hover, .nav-link.active {
  color: var(--ink);
  background-color: var(--line);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Rounded Select Language */
.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.lang-select {
  appearance: none;
  background-color: var(--line);
  border: none;
  border-radius: 20px;
  padding: 8px 32px 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: var(--transition-fast);
}

.lang-select:hover {
  background-color: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .lang-select:hover {
  background-color: rgba(255, 255, 255, 0.12);
}

.select-arrow {
  position: absolute;
  right: 12px;
  pointer-events: none;
  width: 10px;
  height: 10px;
  fill: var(--ink-soft);
}

/* Theme Toggle Button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background-color: var(--line);
  cursor: pointer;
  transition: var(--transition-spring);
}

.theme-toggle:hover {
  transform: scale(1.08);
  background-color: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.12);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink);
  stroke-width: 2.2;
  fill: none;
  transition: var(--transition-spring);
}

/* Menu Toggle Button (Mobile) */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background-color: var(--line);
  cursor: pointer;
}

/* Views Navigation Setup */
.app-view {
  display: none;
  animation: fadeSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.app-view.active {
  display: block;
}

@keyframes fadeSlideIn {
  0% {
    opacity: 0;
    transform: translateY(16px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- HERO ---------- */
.hero {
  padding: 40px 24px 24px;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}

.hero-compact {
  padding: 30px 24px 14px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--red-dark);
  background: rgba(255,59,48,0.10);
  padding: 6px 14px;
  border-radius: 980px;
  margin-bottom: 22px;
}

[data-theme="dark"] .hero-eyebrow {
  color: #FF453A;
  background: rgba(255,69,58,0.15);
}

.hero h1 {
  font-size: clamp(22px, 3.5vw, 34px);
  line-height: 1.28;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  color: #D90429;
}

[data-theme="dark"] .hero h1 {
  color: #FF4D4D;
}

.hero p {
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-soft);
  max-width: 600px;
  margin: 0 auto 20px;
  font-weight: 400;
}

.search-wrap {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: 980px;
  padding: 14px 20px;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
}

.search-bar svg {
  flex-shrink: 0;
  color: var(--ink-soft);
}

.search-bar input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  width: 100%;
  color: var(--ink);
  font-family: inherit;
}

.search-bar input::placeholder {
  color: #A1A1A6;
}

.search-hint {
  margin-top: 12px;
  font-size: 13px;
  color: #A1A1A6;
}

/* Interactive iOS Back Button */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--line);
  color: var(--ink);
  border: none;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition-fast);
  margin-bottom: 24px;
}

.btn-back:hover {
  background-color: rgba(0, 0, 0, 0.08);
  transform: translateX(-2px);
}

[data-theme="dark"] .btn-back:hover {
  background-color: rgba(255, 255, 255, 0.12);
}

/* ---------- CATEGORY PILLS (Segmented Control) ---------- */
.categories {
  max-width: 1100px;
  margin: 40px auto 0;
  padding: 0 24px;
  display: flex;
  justify-content: center;
}

.segmented {
  display: flex;
  gap: 2px;
  background: var(--line);
  padding: 4px;
  border-radius: 980px;
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 9px 18px;
  border-radius: 980px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}

.filter-btn:hover {
  color: var(--ink);
}

.filter-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* ---------- TOOL GRID ---------- */
.grid-section {
  max-width: 1100px;
  margin: 36px auto 0;
  padding: 0 24px 80px;
}

.tools-section {
  margin-bottom: 48px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 18px;
  padding-left: 4px;
}

.section-heading h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.section-heading span {
  font-size: 13px;
  color: var(--ink-soft);
}

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

/* Compact iOS Springboard Card */
.tool-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s ease;
  position: relative;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
}

.tool-card:active {
  transform: translateY(-1px) scale(0.98);
}

.tool-icon {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  box-shadow: none !important;
}

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

.tool-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px 0;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.tool-card-desc {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--ink-secondary, #8e8e93);
  margin: 0;
  line-height: 1.45;
  letter-spacing: 0.01em;
}

/* Icon Color Gradients */
.ic-red    { background: linear-gradient(145deg, #FF6259, #FF3B30); }
.ic-orange { background: linear-gradient(145deg, #FFBB33, #FF9500); }
.ic-blue   { background: linear-gradient(145deg, #57B6FF, #0A84FF); }
.ic-green  { background: linear-gradient(145deg, #5FDB84, #30D158); }
.ic-purple { background: linear-gradient(145deg, #C978EE, #AF52DE); }
.ic-teal   { background: linear-gradient(145deg, #5ED4F5, #32ADE6); }
.ic-pink   { background: linear-gradient(145deg, #FF6E8E, #FF2D55); }
.ic-gray   { background: linear-gradient(145deg, #8E8E93, #636366); }
.ic-indigo { background: linear-gradient(145deg, #7B7FFF, #5E5CE6); }
.ic-amber  { background: linear-gradient(145deg, #FFD060, #FFCC02); }
.ic-cyan   { background: linear-gradient(145deg, #40D8C8, #00C7BE); }
.ic-rose   { background: linear-gradient(145deg, #FF758C, #FF416C); }

/* ---------- DROPZONE & UPLOAD ---------- */
.upload-container {
  max-width: 680px;
  margin: 0 auto;
  perspective: 1000px;
}

.drop-card {
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1.5px dashed var(--line);
  padding: 50px 30px;
  text-align: center;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-1);
}

.drop-card:hover {
  border-color: rgba(255, 59, 48, 0.4);
  transform: translateY(-2px);
}

.drop-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  margin: 0 auto 14px;
  background: linear-gradient(155deg, var(--red), var(--pink));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(255,59,48,0.30);
}

.drop-card h3 {
  font-size: 17px;
  font-weight: 650;
  margin: 0 0 4px;
}

.drop-card p {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
}

.file-input {
  display: none;
}

/* File Upload Process Layer (Simulated Overlay) */
.dropzone-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 5;
  border-radius: var(--radius-lg);
}

.dropzone-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* iOS Circular Loading Animation */
.ios-spinner-wrapper {
  position: relative;
  width: 70px;
  height: 70px;
  margin-bottom: 20px;
}

.ios-spinner-ring {
  width: 100%;
  height: 100%;
  border: 4px solid var(--line);
  border-radius: 50%;
  box-sizing: border-box;
}

.ios-spinner-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 4px solid transparent;
  border-top-color: var(--red);
  border-radius: 50%;
  box-sizing: border-box;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

.upload-percent {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.upload-status {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 20px;
  font-weight: 500;
}

.progress-bar-container {
  width: 100%;
  max-width: 280px;
  height: 6px;
  background-color: var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background-color: var(--red);
  border-radius: 3px;
  transition: width 0.1s ease;
}

/* ---------- PREMIUM BANNER ---------- */
.premium {
  max-width: 1100px;
  margin: 20px auto 80px;
  padding: 0 24px;
}

.premium-card {
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #1D1D1F, #3A3A3C);
  color: #fff;
  padding: 44px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  box-shadow: var(--shadow-2);
  overflow: hidden;
  position: relative;
  text-align: left;
}

.premium-card::before {
  content: '';
  position: absolute;
  right: -60px;
  top: -60px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,149,0,0.35), transparent 70%);
}

.premium-text {
  position: relative;
  z-index: 1;
}

.premium-text h3 {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.premium-text p {
  font-size: 15px;
  color: rgba(255,255,255,0.68);
  margin: 0 0 20px;
  max-width: 420px;
}

.premium-list {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.premium-list div {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: rgba(255,255,255,0.85);
}

.btn {
  border: none;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  padding: 10px 24px;
  border-radius: 980px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.btn-primary:hover {
  background: #000;
}

[data-theme="dark"] .btn-primary {
  background: #fff;
  color: #000;
}

[data-theme="dark"] .btn-primary:hover {
  background: #f5f5f7;
}

.btn.secondary {
  background: var(--line);
  color: var(--ink);
  font-size: 14px;
  padding: 10px 24px;
  border-radius: 980px;
}

.btn.secondary:hover {
  background: var(--ink-soft);
  color: var(--bg);
}

[data-theme="dark"] .btn.secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

[data-theme="dark"] .btn.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

[data-theme="dark"] #cropper-container {
  background: rgba(255, 255, 255, 0.05) !important;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 980px;
}

.btn-ghost:hover {
  background: rgba(0,0,0,0.05);
}

[data-theme="dark"] .btn-ghost:hover {
  background: rgba(255,255,255,0.08);
}

.btn-premium {
  background: linear-gradient(135deg, var(--orange), #FFB143);
  color: #1D1D1F;
  padding: 12px 24px;
  border-radius: 980px;
  font-size: 14px;
}

.btn-premium:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

/* ---------- FOOTER ---------- */
footer {
  border-top: 1px solid var(--line);
  padding: 40px 24px 60px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
}

footer .foot-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

footer .foot-links a {
  color: var(--ink-soft);
  transition: color .15s ease;
}

footer .foot-links a:hover {
  color: var(--ink);
}

/* ---------- NEW VISUAL SPLIT EDITOR LAYOUT ---------- */
.editor-split-layout {
  display: flex;
  height: calc(100vh - 63px); /* 100% viewport minus header height */
  overflow: hidden;
  width: 100%;
}

/* Left Workspace Canvas */
.editor-canvas {
  flex-grow: 1;
  background-color: #EBF0F4;
  padding: 30px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  transition: background-color 0.3s ease;
}

[data-theme="dark"] .editor-canvas {
  background-color: #0E0E10;
}

.canvas-top-bar {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}

.canvas-workspace {
  display: flex;
  position: relative;
  width: 100%;
  align-items: flex-start;
  gap: 24px;
}

.thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px;
  flex-grow: 1;
}

/* Visual Document Thumbnails Card */
.thumbnail-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: grab;
}

.thumbnail-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-2);
}

.thumbnail-card:active {
  cursor: grabbing;
}

.thumbnail-card.dragover {
  border: 2px dashed var(--red);
  background-color: rgba(255, 59, 48, 0.05);
}

/* Page Thumbnail Mockup Sheet */
.thumbnail-preview-box {
  width: 100%;
  height: 180px;
  border-radius: 8px;
  overflow: hidden;
  background: #fdfdfd;
  border: 1px solid var(--line);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.thumbnail-card:hover .thumbnail-preview-box {
  border-color: rgba(255, 59, 48, 0.25);
}

/* Cover Mockup Elements */
.doc-mockup {
  width: 100%;
  height: 100%;
  background: #ffffff;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}

.doc-mockup-header {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 8px;
  font-weight: 700;
  color: #6e6e73;
  border-bottom: 1px solid #f5f5f7;
  padding-bottom: 4px;
}

.doc-mockup-logo {
  display: inline-flex;
  width: 10px;
  height: 10px;
  background: var(--red);
  color: #fff;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  font-size: 6px;
}

.doc-mockup-brand {
  font-size: 7px;
  font-weight: 600;
}

.doc-mockup-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  flex-grow: 1;
}

.doc-mockup-title {
  font-size: 9px;
  font-weight: 800;
  color: #1d1d1f;
  margin-bottom: 2px;
}

.doc-mockup-line {
  height: 3px;
  background: #e8e8ed;
  border-radius: 1px;
  width: 100%;
}

.doc-mockup-line.short {
  width: 60%;
  background: var(--red); /* matches password error line on image */
}

.doc-mockup-btn {
  margin-top: auto;
  height: 14px;
  background: var(--blue);
  color: #fff;
  border-radius: 3px;
  font-size: 6px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,122,255,0.2);
}

.doc-mockup-footer {
  font-size: 7px;
  text-align: right;
  color: #a1a1a6;
  border-top: 1px solid #f5f5f7;
  padding-top: 4px;
}

.thumbnail-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  padding: 2px 4px 0;
}

.thumbnail-card:hover .thumbnail-name {
  color: var(--ink);
}

/* Card Close Delete button */
.thumbnail-delete-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--red);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  box-shadow: var(--shadow-1);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
  z-index: 10;
}

.thumbnail-card:hover .thumbnail-delete-btn {
  opacity: 1;
  transform: scale(1);
}

.thumbnail-delete-btn:hover {
  background-color: var(--red-dark);
}

/* Card Rotate button */
.thumbnail-rotate-btn {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--blue);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  box-shadow: var(--shadow-1);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
  z-index: 10;
}

.thumbnail-card:hover .thumbnail-rotate-btn {
  opacity: 1;
  transform: scale(1);
}

.thumbnail-rotate-btn:hover {
  background-color: #005ecb;
}

/* Smooth transition for rotating preview sheets */
.thumbnail-preview-box {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease !important;
}

/* Right Fixed Editor Sidebar */
.editor-sidebar {
  width: 320px;
  background-color: var(--surface);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  transition: background-color 0.3s ease;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.sidebar-header h2 {
  font-size: 20px;
  font-weight: 750;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.sidebar-content {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-tip-box {
  display: flex;
  gap: 10px;
  padding: 14px;
  background: rgba(10, 132, 255, 0.06);
  border-radius: 12px;
  border: 1px solid rgba(10, 132, 255, 0.12);
  margin: 24px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--blue);
  align-items: flex-start;
}

.tool-options-container {
  padding: 0 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--line);
  background-color: var(--surface-2);
}

.btn-process-action {
  width: 100%;
  padding: 15px 20px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  box-shadow: 0 6px 20px rgba(255, 59, 48, 0.25);
  transition: background 0.2s ease, transform 0.2s ease;
}

.btn-process-action:hover {
  background: var(--red-dark);
  transform: translateY(-2px);
}

.btn-process-action:active {
  transform: translateY(0);
}

/* Floating control buttons (mockup right side of canvas) */
.floating-controls {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 10;
}

.floating-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-2);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease;
  position: relative;
}

.floating-btn:hover {
  transform: scale(1.06);
}

.floating-btn:active {
  transform: scale(0.96);
}

.btn-add {
  background-color: var(--red);
  color: #fff;
}

.btn-add:hover {
  background-color: var(--red-dark);
}

.floating-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  background-color: #000;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  border-radius: 10px;
  padding: 2px 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.2);
}

.btn-sort {
  background-color: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-sort:hover {
  background-color: var(--surface-2);
}

/* Business unified layout wrapper */
.business-unified-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 !important;
}

/* Business Editor Header Bar */
.business-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  box-sizing: border-box;
}

.editor-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-back-compact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  transition: var(--transition-fast);
}

.btn-back-compact:hover {
  background-color: var(--bg);
  border-color: var(--ink-soft);
}

.editor-header-divider {
  width: 1px;
  height: 20px;
  background-color: var(--line);
}

.editor-header-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
}

.editor-header-subtitle {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0;
  font-weight: 400;
}

/* Adjust business editor body to fit height */
.business-editor-body {
  height: calc(100vh - 116px); /* 100vh minus app header (60px) and editor header (56px) */
  overflow: hidden;
  box-sizing: border-box;
}

.form-section-card {
  background-color: var(--bg);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- STANDALONE TOOL DASHBOARD CONFIG ---------- */
.tool-dashboard-container {
  max-width: 720px;
  margin: 0 auto 50px;
  background-color: var(--surface);
  border-radius: var(--radius-xl);
  padding: 35px;
  box-shadow: var(--shadow-2);
  border: 1px solid var(--line);
  text-align: left;
}

/* Dashboard list of items (reorder grid) */
.dashboard-file-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background-color: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  transition: var(--transition-fast);
}

.file-item:hover {
  border-color: rgba(255, 59, 48, 0.2);
}

.file-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-item-icon {
  color: var(--red);
  display: flex;
  align-items: center;
}

.file-item-name {
  font-size: 0.95rem;
  font-weight: 600;
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-item-action {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--ink-soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-item-action:hover {
  background-color: var(--line);
  color: var(--ink);
}

.btn-item-action.delete:hover {
  background-color: rgba(255, 59, 48, 0.1);
  color: var(--red);
}

.btn-secondary {
  border: none;
  background-color: var(--line);
  color: var(--ink);
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
  padding: 8px 16px;
}

.btn-secondary:hover {
  background-color: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.12);
}

/* Dashboard options panels */
.dashboard-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 30px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Custom sliders */
.option-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.option-slider {
  flex-grow: 1;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background-color: var(--line);
  outline: none;
  cursor: pointer;
}

.option-slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: var(--red);
  border: 2px solid var(--surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.option-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.slider-val {
  font-size: 0.95rem;
  font-weight: 700;
  min-width: 36px;
  text-align: right;
}

/* ---------- SPECIFIC INTERACTIVE TOOL UIS ---------- */
/* Calculator */
.calc-container {
  max-width: 300px;
  margin: 0 auto;
  background-color: #000;
  border-radius: 30px;
  padding: 20px;
  box-shadow: 0 10px 35px rgba(0,0,0,0.25);
}

.calc-display {
  width: 100%;
  height: 80px;
  background-color: #000;
  color: #fff;
  text-align: right;
  padding: 20px 10px;
  font-size: 2.8rem;
  font-weight: 300;
  border: none;
  outline: none;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.calc-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  font-size: 1.4rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease;
}

.calc-btn:active {
  opacity: 0.7;
}

.calc-gray {
  background-color: #a5a5a5;
  color: #000;
}

.calc-darkgray {
  background-color: #333333;
  color: #fff;
}

.calc-orange {
  background-color: #ff9f0a;
  color: #fff;
}

.calc-double {
  grid-column: span 2;
  width: auto;
  border-radius: 30px;
  justify-content: flex-start;
  padding-left: 22px;
}

/* Invoice Generator Forms */
.invoice-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.form-input, .form-group select {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background-color: var(--bg);
  color: var(--ink);
  outline: none;
  font-size: 0.85rem;
}

.form-input option, .form-group select option {
  background-color: var(--surface);
  color: var(--ink);
}

.form-input:focus {
  border-color: var(--red);
  background-color: var(--surface);
}

.invoice-preview-container {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  background-color: #fff;
  color: #000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

[data-theme="dark"] .invoice-preview-container {
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.invoice-preview-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid #f4f4f4;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.invoice-preview-total {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--red);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background-color: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  padding: 12px 24px;
  border-radius: 20px;
  box-shadow: var(--shadow-2);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1100;
  font-weight: 600;
  font-size: 0.9rem;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 0;
}

.toast-container.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-icon {
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile Bottom Tab Navigation */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 68px;
  background-color: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.03);
  transition: var(--transition-spring);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  height: 100%;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 600;
  gap: 4px;
  border: none;
  background: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-item.active {
  color: var(--red);
}

.tab-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-item:active .tab-icon {
  transform: scale(0.85);
}

/* Mobile Drawer (Menu overlay) */
.mobile-menu-drawer {
  position: fixed;
  top: 0;
  left: -100%;
  width: 280px;
  height: 100%;
  background-color: var(--surface);
  z-index: 200;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
  transition: var(--transition-spring);
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mobile-menu-drawer.active {
  left: 0;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.drawer-header .logo-wrapper {
  gap: 12px;
}

.drawer-header .logo-wrapper span {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.drawer-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

.drawer-links {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-link {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 12px;
}

.drawer-link:hover, .drawer-link.active {
  background-color: var(--line);
  color: var(--red);
}

.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.4);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Printable invoice styling setup */
@media print {
  body *, .app-header, .mobile-nav, footer, .btn-back, #btn-gen-invoice, #btn-download-pdf, label, input, select {
    display: none !important;
  }
  body, .main-content, #tool-edit-view, .tool-dashboard-container, #invoice-preview, #receipt-preview, #quote-preview, #invoice-preview * {
    display: block !important;
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* Responsive Styles */
@media (min-width: 769px) {
  .mobile-nav {
    display: none;
  }
}

@media (max-width: 768px) {
  .desktop-nav {
    display: none;
  }
  
  .header-container .select-wrapper {
    display: none !important; /* Hide language selector in header on mobile to fit screen width */
  }
  
  .menu-toggle {
    display: flex;
  }
  
  .drop-card {
    padding: 35px 20px;
    border-radius: var(--radius-lg);
  }
  
  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
  }
  
  .grid-section {
    padding: 0 16px 80px;
  }
  
  .tool-card {
    border-radius: var(--radius-sm);
    padding: 16px 10px;
    gap: 8px;
  }
  
  .tool-icon {
    width: 88px;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    box-shadow: none !important;
  }
  
  .tool-icon svg {
    width: 76px;
    height: 76px;
  }
  
  .tool-card h4 {
    font-size: 12.5px;
  }
  
  .premium-card {
    flex-direction: column;
    text-align: left;
    padding: 30px 24px;
  }
  
  .tool-dashboard-container {
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .download-container {
    padding: 0 16px;
    box-sizing: border-box;
    width: 100%;
  }

  .footer {
    padding: 30px 16px 80px;
  }
  
  /* Stack split layout on mobile devices */
  .editor-split-layout {
    flex-direction: column;
    height: auto;
    overflow-y: auto;
  }
  
  .editor-sidebar {
    width: 100%;
    border-left: none;
    border-bottom: 1px solid var(--line);
    height: auto;
    padding-bottom: 84px; /* Ensure floating bottom tabs do not cover process buttons */
  }
  
  .editor-canvas {
    height: auto;
    overflow: visible;
    padding: 20px;
  }
  
  .thumbnails-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
  }
  
  .thumbnail-card {
    padding: 8px;
    gap: 6px;
  }

  .thumbnail-delete-btn, .thumbnail-rotate-btn {
    opacity: 1 !important;
    transform: scale(1) !important;
  }
  
  .thumbnail-preview-box {
    height: 120px;
  }
  
  .doc-mockup-body {
    gap: 2px;
  }
  
  .floating-controls {
    position: fixed;
    bottom: 96px;
    right: 20px;
    z-index: 99;
    margin: 0;
    gap: 12px;
  }
  
  .floating-btn {
    width: 44px;
    height: 44px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }

  .header-container {
    padding: 10px 16px;
  }
  
  .hero {
    padding: 42px 16px 28px;
  }

  .categories {
    margin: 20px auto 0;
    padding: 0 16px;
    display: flex;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
  }
  
  .segmented {
    display: flex;
    width: 100%;
    box-sizing: border-box;
  }

  .segmented .filter-btn {
    flex: 1;
    text-align: center;
    padding: 9px 4px;
    font-size: 13px;
  }
}

/* Cover Image Render Styles */
.thumbnail-cover-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #ffffff;
  display: block;
}

/* ---------- BUSINESS SPLIT LAYOUT & LIVE PREVIEW ---------- */
.business-dashboard-split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 100%;
  margin: 0 auto;
  align-items: stretch;
  height: 100%;
  padding: 24px;
  box-sizing: border-box;
}

@media (min-width: 993px) {
  .business-dashboard-split-layout {
    height: 100%;
    overflow: hidden;
  }
  
  .business-form-panel {
    height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
    box-sizing: border-box;
  }
  
  .business-preview-panel {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }

  #document-preview-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    width: 100%;
    height: 100%;
    position: relative;
  }

  .document-preview-sheet {
    width: 780px;
    height: 1100px;
    padding: 36px !important;
    font-size: 0.87rem !important;
    line-height: 1.5 !important;
    box-sizing: border-box;
    flex-shrink: 0;
    transform-origin: center center;
    transition: transform 0.1s ease;
  }
  
  .business-form-panel::-webkit-scrollbar {
    width: 5px;
  }
  
  .business-form-panel::-webkit-scrollbar-thumb {
    background-color: var(--line);
    border-radius: 3px;
  }
}

@media (max-width: 992px) {
  html:not(.pdf-print-mode) .business-dashboard-split-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    height: auto;
    overflow: visible;
  }
  
  html:not(.pdf-print-mode) .business-form-panel, 
  html:not(.pdf-print-mode) .business-preview-panel {
    height: auto;
    overflow-y: visible;
    padding-right: 0;
  }
  
  html:not(.pdf-print-mode) #document-preview-container {
    display: block;
    overflow: visible;
    height: auto;
  }
  
  html:not(.pdf-print-mode) .document-preview-sheet {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    transform: none !important;
    padding: 16px !important;
    font-size: 0.82rem !important;
    overflow-x: auto;
  }
}

.business-form-panel {
  background-color: var(--surface);
  border-radius: var(--radius-xl);
  padding: 18px 22px;
  box-shadow: var(--shadow-2);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
  min-width: 0;
}

.business-preview-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
  min-width: 0;
}

/* Document Sheet Simulation */
.document-preview-sheet {
  background-color: #ffffff;
  color: #1e293b;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
  padding: 40px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: box-shadow 0.2s ease;
}

[data-theme="dark"] .document-preview-sheet {
  border-color: rgba(255, 255, 255, 0.05);
}

/* Invoice Typography & Components */
.doc-brand-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.025em;
  margin: 0;
  text-transform: uppercase;
}

.doc-type-label {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 0.05em;
  text-align: right;
  margin: 0;
}

.doc-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  padding: 15px 0;
  margin: 15px 0;
}

.doc-meta-col h5 {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  margin: 0 0 5px 0;
  letter-spacing: 0.05em;
}

.doc-meta-col p {
  margin: 0;
  font-weight: 500;
  color: #334155;
  font-size: 0.85rem;
  word-break: break-word;
}

.doc-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  text-align: left;
}

.doc-items-table th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 2px solid #e2e8f0;
}

.doc-items-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  font-size: 0.85rem;
}

.doc-items-table tr:last-child td {
  border-bottom: 2px solid #e2e8f0;
}

.doc-summary-wrapper {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.doc-summary-table {
  width: 240px;
  border-collapse: collapse;
}

.doc-summary-table td {
  padding: 6px 10px;
  color: #475569;
  font-size: 0.85rem;
}

.doc-summary-table tr.grand-total td {
  font-weight: 800;
  font-size: 1.05rem;
  color: #0f172a;
  border-top: 2px solid #e2e8f0;
  padding-top: 10px;
}

.doc-summary-table tr.grand-total td.total-val {
  color: var(--red);
}

.doc-notes-section {
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
  margin-top: 15px;
  font-size: 0.72rem;
  color: #64748b;
}

.doc-notes-section h6 {
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0 0 2px 0;
  color: #475569;
}

.doc-notes-section p {
  margin: 0;
  white-space: pre-wrap;
}

/* Interactive Dynamic Form Fields */
.section-subtitle {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  margin: 20px 0 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-subtitle:first-of-type {
  margin-top: 0;
}

.dynamic-rows-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 4px;
}

.dynamic-item-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-icon-danger {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast);
}

.btn-icon-danger:hover {
  background-color: rgba(255, 59, 48, 0.1);
}

.btn-add-row {
  background-color: var(--surface-2);
  color: var(--ink);
  border: 1px dashed var(--line);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-add-row:hover {
  background-color: var(--line);
  border-color: var(--ink-soft);
}

/* Floating Preview Controls */
.preview-action-bar {
  display: flex;
  gap: 12px;
}

.btn-preview-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-preview-action.primary {
  background-color: var(--red);
  color: #fff;
  border: none;
}

.btn-preview-action.primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-preview-action.secondary {
  background-color: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-preview-action.secondary:hover {
  background-color: var(--surface-2);
}

/* Professional Thermal Receipt preview styling */
.receipt-sheet-theme {
  max-width: 360px;
  margin: 0 auto;
  border: 1px dashed #cbd5e1;
  border-radius: 0;
  padding: 30px 20px;
  font-family: 'Courier New', Courier, monospace;
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

.receipt-sheet-theme .doc-brand-title {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.4rem;
  text-align: center;
}

.receipt-sheet-theme .doc-type-label {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.1rem;
  text-align: center;
  margin-top: 4px;
  color: #1e293b;
}

.receipt-sheet-theme .doc-meta-grid {
  grid-template-columns: 1fr;
  gap: 8px;
  border-top: 1px dashed #94a3b8;
  border-bottom: 1px dashed #94a3b8;
  padding: 12px 0;
}

.receipt-sheet-theme .doc-meta-col {
  display: flex;
  justify-content: space-between;
}

.receipt-sheet-theme .doc-meta-col h5 {
  margin: 0;
}

.receipt-sheet-theme .doc-items-table th {
  background: none;
  padding: 8px 4px;
  border-bottom: 1px dashed #94a3b8;
}

.receipt-sheet-theme .doc-items-table td {
  padding: 8px 4px;
  border-bottom: 1px dashed #f1f5f9;
}

.receipt-sheet-theme .doc-summary-table {
  width: 100%;
}

.receipt-sheet-theme .doc-summary-table td {
  padding: 6px 4px;
}
.receipt-sheet-theme .doc-summary-table tr.grand-total td {
  border-top: 1px dashed #94a3b8;
  color: #000;
}

.receipt-sheet-theme .doc-summary-table tr.grand-total td.total-val {
  color: #000;
}

/* Responsive Grid Utilities for Business Forms */
.biz-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.biz-grid-2-skew {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 8px;
}
.biz-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.biz-grid-3-skew {
  display: grid;
  grid-template-columns: 0.8fr 0.8fr 1.4fr;
  gap: 10px;
}
.biz-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 600px) {
  html:not(.pdf-print-mode) .biz-grid-2, 
  html:not(.pdf-print-mode) .biz-grid-2-skew, 
  html:not(.pdf-print-mode) .biz-grid-3, 
  html:not(.pdf-print-mode) .biz-grid-3-skew, 
  html:not(.pdf-print-mode) .biz-grid-4 {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  html:not(.pdf-print-mode) .dynamic-item-row {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  html:not(.pdf-print-mode) .biz-item-desc {
    flex-basis: 100% !important;
    width: 100% !important;
  }
  html:not(.pdf-print-mode) .biz-item-qty, 
  html:not(.pdf-print-mode) .biz-item-price {
    flex-grow: 1 !important;
    width: auto !important;
  }
}

/* Print Overrides */
@media print {
  .app-header, 
  .mobile-nav, 
  footer, 
  .btn-back, 
  .btn-back-compact,
  .business-editor-header,
  .business-form-panel, 
  .preview-action-bar, 
  .hero-title, 
  .hero-subtitle,
  #toast {
    display: none !important;
  }
  
  body, 
  .main-content, 
  #tool-edit-view, 
  #business-unified-layout, 
  .business-dashboard-split-layout, 
  .business-preview-panel, 
  #document-preview-container {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    border: none !important;
    overflow: visible !important;
  }
  
  .document-preview-sheet {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    transform: none !important;
  }
}

/* Cropper & Scanner Editor Styles */
.scanner-editor-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 20px;
  gap: 16px;
}

#cropper-wrapper, .cropper-wrapper-el {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 60vh;
  background: #f1f5f9;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-2);
}

#cropper-wrapper img, .cropper-wrapper-el img {
  max-width: 100%;
  max-height: 60vh;
  display: block;
  object-fit: contain;
}

#crop-overlay, .crop-overlay-el {
  position: absolute;
  border: 2px dashed #0A84FF;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.6);
  cursor: move;
  box-sizing: border-box;
}

.crop-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #0A84FF;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.crop-handle.tl { top: -9px; left: -9px; cursor: nwse-resize; }
.crop-handle.tr { top: -9px; right: -9px; cursor: nesw-resize; }
.crop-handle.bl { bottom: -9px; left: -9px; cursor: nesw-resize; }
.crop-handle.br { bottom: -9px; right: -9px; cursor: nwse-resize; }

@media (max-width: 768px) {
  .scanner-editor-container {
    padding: 10px;
    gap: 12px;
  }
  #cropper-wrapper, .cropper-wrapper-el {
    border-radius: 12px;
  }
  .crop-handle {
    width: 22px;
    height: 22px;
  }
  .crop-handle.tl { top: -11px; left: -11px; }
  .crop-handle.tr { top: -11px; right: -11px; }
  .crop-handle.bl { bottom: -11px; left: -11px; }
  .crop-handle.br { bottom: -11px; right: -11px; }
}

.tool-card.coming-soon::after {
  content: "🔒 Coming Soon";
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #FF9500, #FF5E00);
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 980px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 0 0 0 rgba(255, 149, 0, 0.7);
  animation: pulse-glow 1.8s infinite;
  z-index: 10;
  border: 1.5px solid var(--surface);
  display: flex;
  align-items: center;
  gap: 3.5px;
}

@keyframes pulse-glow {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 149, 0, 0.6);
  }
  70% {
    transform: scale(1.04);
    box-shadow: 0 0 0 5px rgba(255, 149, 0, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 149, 0, 0);
  }
}

.tool-card.new-feature::after {
  content: "New";
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #FF2D55, #FF5E00);
  color: #fff;
  font-size: 8.5px;
  font-weight: 800;
  padding: 3.5px 9px;
  border-radius: 980px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 0 0 0 rgba(255, 45, 85, 0.6);
  animation: pulse-glow-new 1.8s infinite;
  z-index: 10;
  border: 1.5px solid var(--surface);
}

@keyframes pulse-glow-new {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 45, 85, 0.5);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 6px rgba(255, 45, 85, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 45, 85, 0);
  }
}

.tool-card.coming-soon * {
  pointer-events: none;
}

/* === Scan Process Button — Background Fill Progress === */
#btn-split-process {
  min-height: 44px;
}

#btn-split-process:disabled {
  cursor: default;
  opacity: 1 !important;
}

#btn-split-process #btn-progress-fill {
  transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ============================================================
   SCAN TO PDF – MOBILE RESPONSIVE STYLES
   ============================================================ */

/* === Mini live preview panel (sticky in sidebar) === */
#scan-mini-preview-panel {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transition: opacity 0.2s;
}

#scan-mini-preview-panel canvas {
  transition: filter 0.05s linear;
  display: block;
  margin: 0 auto;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#scan-mini-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent, #0A84FF);
  text-align: center;
  padding: 2px 0;
}

/* === Editor Layout (after cropping) === */
.scan-editor-layout {
  display: flex;
  width: 100%;
  height: calc(100vh - 180px);
  max-height: calc(100vh - 180px);
  gap: 15px;
  position: relative;
  padding: 10px;
  box-sizing: border-box;
  overflow: hidden;
}

.scan-pages-rail {
  width: 130px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid var(--line);
  padding-right: 12px;
  overflow-y: auto;
  height: 100%;
  flex-shrink: 0;
}

.scan-preview-pane {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.03);
  border-radius: 12px;
  border: 1px dashed var(--line);
  overflow: hidden;
  position: relative;
  padding: 15px;
  min-height: 260px;
  cursor: grab;
  touch-action: none;
}

/* === Cropper Layout === */
.scan-cropper-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100vh - 180px);
  max-height: calc(100vh - 180px);
  padding: 15px;
  box-sizing: border-box;
  gap: 10px;
  overflow: hidden;
}

.scan-cropper-header {
  font-weight: 700;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  flex-shrink: 0;
}

.scan-cropper-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 5px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  flex-shrink: 0;
}

.scan-cropper-actions .btn {
  padding: 8px 16px;
}

/* ============================================================
   MOBILE OVERRIDES (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {

  /* --- Scan Editor Layout: stack pages rail on top --- */
  .scan-editor-layout {
    flex-direction: column !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    gap: 10px;
    padding: 8px;
  }

  /* --- Pages Rail: horizontal strip across top on mobile --- */
  .scan-pages-rail {
    width: 100% !important;
    height: 110px !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    border-right: none !important;
    border-bottom: 1px solid var(--line) !important;
    padding-right: 0 !important;
    padding-bottom: 8px !important;
    gap: 8px !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .scan-pages-rail .rail-page-item {
    flex-shrink: 0 !important;
    width: 75px !important;
    scroll-snap-align: start;
  }

  /* --- Preview Pane: full width, generous height for A4 portrait --- */
  .scan-preview-pane {
    width: 100% !important;
    min-height: 380px !important;
    height: 58vh !important;
    max-height: 65vh !important;
    padding: 8px !important;
    border-radius: 10px !important;
  }

  #active-scan-preview-canvas {
    max-width: 100% !important;
    max-height: 100% !important;
  }

  /* --- Sidebar: full width below canvas on mobile --- */
  .editor-sidebar {
    width: 100% !important;
    border-left: none !important;
    border-top: 1px solid var(--line) !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
    flex-shrink: 0 !important;
    padding-bottom: 100px !important;
  }

  .editor-split-layout {
    flex-direction: column !important;
    height: auto !important;
    overflow-y: auto !important;
  }

  .canvas-workspace {
    flex: none !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* --- Cropper layout: single screen fit without scrolling on mobile --- */
  .scan-cropper-layout {
    height: calc(100vh - 120px) !important;
    max-height: calc(100vh - 120px) !important;
    overflow: hidden !important;
    padding: 8px !important;
    gap: 8px !important;
  }

  .scan-cropper-header {
    flex-shrink: 0 !important;
    font-size: 0.85rem !important;
  }

  #cropper-container {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: none !important;
    border-radius: 10px !important;
  }

  .scan-cropper-actions {
    margin-top: auto !important;
    padding-top: 8px !important;
    flex-shrink: 0 !important;
    width: 100% !important;
  }

  /* --- Cropper action buttons: bigger tap targets on mobile --- */
  #btn-crop-reset,
  #btn-crop-auto,
  #btn-crop-next {
    padding: 11px 14px !important;
    font-size: 0.85rem !important;
    flex: 1 !important;
  }

  /* --- Process/Download button: always full width on mobile --- */
  #btn-split-process {
    width: 100% !important;
    justify-content: center !important;
  }

  /* --- Option group sliders: bigger touch area --- */
  .option-slider {
    height: 28px !important;
  }

  /* --- Sidebar content scrollable --- */
  .sidebar-content {
    overflow-y: auto !important;
    max-height: none !important;
  }
}

/* ============================================================
   VERY SMALL SCREENS (max-width: 480px)
   ============================================================ */
@media (max-width: 480px) {
  .scan-pages-rail {
    height: 90px !important;
  }

  .scan-pages-rail .rail-page-item {
    width: 65px !important;
  }

  .scan-preview-pane {
    min-height: 350px !important;
    height: 55vh !important;
    max-height: 65vh !important;
  }

  .scan-cropper-layout {
    height: calc(100vh - 100px) !important;
    max-height: calc(100vh - 100px) !important;
  }

  #cropper-container {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: none !important;
  }

  #btn-crop-reset,
  #btn-crop-auto,
  #btn-crop-next {
    font-size: 0.78rem !important;
    padding: 10px 8px !important;
  }
}

/* ============================================================
   SEO CONTENT LAYOUT & FAQ STYLES
   ============================================================ */
#seo-info-container {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 40px;
  margin-top: 50px !important;
  box-shadow: var(--shadow-1);
  box-sizing: border-box;
}

.seo-heading {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--ink);
  margin-top: 0;
  margin-bottom: 14px;
  letter-spacing: -0.5px;
}

.seo-text {
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin-bottom: 24px;
}

.seo-subheading {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 24px;
  margin-bottom: 12px;
}

.seo-list {
  padding-left: 20px;
  margin-bottom: 24px;
}

.seo-list li {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.seo-faq-box {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 24px;
}

.seo-faq-q {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 16px;
  margin-bottom: 6px;
}

.seo-faq-a {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-top: 0;
  margin-bottom: 16px;
}
