/* ==========================================================================
   MAFLABS DESIGN SYSTEM - AI TABLE CONVERTER STYLESHEET
   100% Vanilla CSS, Zero Framework, Zero CDN, Offline First.
   ========================================================================== */

/* 1. SELF-HOSTED FONTS */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/Inter-400-normal-1.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/Inter-500-normal-2.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/Inter-600-normal-3.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/Inter-700-normal-4.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/Outfit-700-normal-5.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('fonts/Outfit-800-normal-6.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/JetBrains_Mono-400-normal-7.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/JetBrains_Mono-500-normal-8.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/JetBrains_Mono-600-normal-9.woff2') format('woff2');
}

/* 2. DESIGN TOKENS & CSS VARIABLES */
:root {
  --heading: #0f172a;
  --body: #475569;
  --muted: #64748b;
  --brand-blue: #2563eb;
  --brand-violet: #7c3aed;
  --brand-gradient: linear-gradient(90deg, #2563eb, #7c3aed);
  --badge-bg: #eff6ff;
  --badge-border: #bfdbfe;
  --badge-text: #1d4ed8;
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: #e2e8f0;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-pill: 9999px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-elevated: 0 20px 30px -10px rgba(15, 23, 42, 0.15);

  --surface-low: #f8fafc;
  --surface-high: #f1f5f9;
  --surface-highest: #e2e8f0;

  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --error: #dc2626;
  --error-bg: #fef2f2;

  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;

  --header-height: 60px;
  --hero-height: 120px;
  --toolbar-height: 54px;
}

/* 3. RESET & BASE STYLES */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--body);
  background-color: #ffffff;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
}

/* Ambient Background Blobs (Fixed across entire viewport) */
.blob-bg-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  -webkit-filter: blur(80px);
  opacity: 0.85;
  will-change: transform;
}

.blob-1 {
  top: -12vh;
  left: -8vw;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.32) 0%, rgba(59, 130, 246, 0.16) 45%, rgba(255, 255, 255, 0) 70%);
  animation: blob-float-1 20s infinite ease-in-out alternate;
}

.blob-2 {
  top: -10vh;
  right: -10vw;
  width: 48vw;
  height: 48vw;
  background: radial-gradient(circle, rgba(147, 51, 234, 0.28) 0%, rgba(168, 85, 247, 0.15) 45%, rgba(255, 255, 255, 0) 70%);
  animation: blob-float-2 24s infinite ease-in-out alternate;
}

.blob-3 {
  bottom: -15vh;
  left: -10vw;
  width: 52vw;
  height: 52vw;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.25) 0%, rgba(14, 165, 233, 0.14) 45%, rgba(255, 255, 255, 0) 70%);
  animation: blob-float-3 22s infinite ease-in-out alternate;
}

.blob-4 {
  bottom: -10vh;
  right: -8vw;
  width: 46vw;
  height: 46vw;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.28) 0%, rgba(236, 72, 153, 0.15) 45%, rgba(255, 255, 255, 0) 70%);
  animation: blob-float-4 26s infinite ease-in-out alternate;
}

@keyframes blob-float-1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5vw, 6vh) scale(1.06); }
  100% { transform: translate(-3vw, 10vh) scale(0.96); }
}

@keyframes blob-float-2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-6vw, 8vh) scale(1.08); }
  100% { transform: translate(4vw, 5vh) scale(0.94); }
}

@keyframes blob-float-3 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vw, -8vh) scale(1.06); }
  100% { transform: translate(-4vw, -4vh) scale(0.95); }
}

@keyframes blob-float-4 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-5vw, -6vh) scale(1.08); }
  100% { transform: translate(6vw, -10vh) scale(0.95); }
}

/* Typography Helpers */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--heading);
  letter-spacing: -0.025em;
  font-weight: 700;
}

.gradient-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--brand-blue);
}

a {
  color: var(--brand-blue);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
}

code, kbd, pre {
  font-family: var(--font-mono);
}

/* 4. BUTTONS & INTERACTIVE CONTROLS */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  padding: 8px 14px;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  line-height: 1.3;
  user-select: none;
  white-space: nowrap;
}

button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.btn-primary {
  background: var(--brand-gradient);
  color: #ffffff;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.28);
  border: none;
}

.btn-primary:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}

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

.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--card-border);
  color: var(--heading);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.btn-secondary:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
  background: #ffffff;
}

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

.btn-ghost:hover {
  background: var(--surface-high);
  color: var(--heading);
}

.btn-icon {
  padding: 7px;
  border-radius: var(--radius-sm);
  background: var(--surface-low);
  border: 1px solid var(--card-border);
  color: var(--body);
}

.btn-icon:hover {
  background: #ffffff;
  color: var(--heading);
  border-color: #cbd5e1;
}

button:disabled, .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 5. SITE HEADER */
.site-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  z-index: 50;
}

.header-container {
  max-width: 1360px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--surface-high);
  border: 1px solid var(--card-border);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-blue);
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.logo-navy {
  color: #00174b;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--body);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.nav-link:hover {
  color: var(--heading);
  background: var(--surface-high);
  text-decoration: none;
}

.nav-link.active {
  background: var(--badge-bg);
  color: var(--brand-blue);
  font-weight: 600;
}

.hamburger-btn {
  display: none;
  background: transparent;
  border: none;
  padding: 8px;
  color: var(--body);
}

/* 6. COMPACT HERO SECTION (<140px tall) */
.hero-compact {
  max-width: 1360px;
  margin: 0 auto;
  padding: 12px 20px 8px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 84px;
  max-height: 138px;
  position: relative;
  z-index: 10;
}

.hero-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  color: var(--badge-text);
}

.pill-privacy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--card-border);
  color: var(--muted);
}

.hero-title {
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.03em;
  color: var(--heading);
  margin-bottom: 3px;
}

.hero-subtitle {
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 950px;
}

/* 7. TOOLBAR */
.workspace-wrapper {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto 32px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 10;
  flex: 1;
}

.master-toolbar {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 8px 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-divider {
  width: 1px;
  height: 22px;
  background: var(--card-border);
  margin: 0 2px;
}

/* Popovers & Dropdowns */
.relative-menu {
  position: relative;
  display: inline-block;
}

.popover-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
  min-width: 230px;
  display: none;
  flex-direction: column;
  gap: 2px;
}

.popover-menu.align-right {
  left: auto;
  right: 0;
}

.popover-menu.open {
  display: flex;
}

.popover-item {
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--heading);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.popover-item:hover {
  background: var(--surface-high);
}

.popover-item-title {
  font-weight: 600;
  color: var(--heading);
}

.popover-item-desc {
  font-size: 11.5px;
  color: var(--muted);
}

/* Options Panel Popover */
.options-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 320px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--shadow-elevated);
  padding: 16px;
  z-index: 60;
  display: none;
  flex-direction: column;
  gap: 12px;
}

.options-panel.open {
  display: flex;
}

.options-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--surface-high);
}

.options-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--heading);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-reset-options {
  font-size: 11px;
  color: var(--brand-blue);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

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

.option-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.option-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--heading);
  cursor: pointer;
  user-select: none;
}

.option-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-blue);
  cursor: pointer;
}

.option-select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--heading);
}

.option-select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: var(--surface-low);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--heading);
}

/* 8. SPLIT-SCREEN WORKSPACE */
.split-workspace {
  width: 100%;
  height: calc(100dvh - var(--header-height) - var(--hero-height) - var(--toolbar-height) - 40px);
  min-height: 560px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Panes */
.workspace-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px;
  gap: 8px;
  overflow: hidden;
  background: transparent;
}

.pane-left {
  width: 50%;
  min-width: 25%;
}

.pane-right {
  width: 50%;
  min-width: 25%;
  background: rgba(248, 250, 252, 0.45);
}

/* Pane Header */
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--card-border);
  gap: 8px;
  min-height: 38px;
}

.pane-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pane-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--heading);
}

.pane-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Left Pane Editor */
.editor-container {
  flex: 1;
  display: flex;
  background: var(--surface-low);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.line-numbers {
  width: 44px;
  padding: 12px 6px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: rgba(100, 116, 139, 0.5);
  background: rgba(241, 245, 249, 0.6);
  border-right: 1px solid var(--card-border);
  user-select: none;
  overflow: hidden;
}

.raw-textarea {
  flex: 1;
  height: 100%;
  padding: 12px;
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  color: var(--heading);
  resize: none;
  outline: none;
  overflow-y: auto;
  white-space: pre;
}

.raw-textarea::placeholder {
  color: rgba(148, 163, 184, 0.8);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
}

.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(37, 99, 235, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 20;
}

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

.pane-footer-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  padding: 2px 4px;
}

.status-badge {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-high);
  color: var(--body);
  font-weight: 500;
}

/* 9. DRAGGABLE SPLIT DIVIDER */
.split-divider {
  width: 9px;
  background: var(--surface-high);
  cursor: col-resize;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  z-index: 30;
  user-select: none;
}

.split-divider:hover {
  background: #bfdbfe;
}

.divider-handle {
  width: 3px;
  height: 36px;
  background: var(--muted);
  border-radius: 4px;
  transition: background 0.15s ease;
}

.split-divider:hover .divider-handle {
  background: var(--brand-blue);
}

/* 10. EDITABLE SPREADSHEET GRID (Right Pane) */
.table-tab-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  max-width: 55%;
  padding-bottom: 2px;
}

.sheet-tab {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-high);
  border: 1px solid var(--card-border);
  color: var(--body);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.sheet-tab:hover {
  background: var(--surface-highest);
  color: var(--heading);
}

.sheet-tab.active {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.grid-subtoolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-low);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  gap: 6px;
}

.subtoolbar-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-grid-tool {
  padding: 4px 8px;
  font-size: 11.5px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--body);
}

.btn-grid-tool:hover {
  background: #ffffff;
  border-color: var(--card-border);
  color: var(--heading);
}

.btn-grid-tool.danger:hover {
  background: var(--error-bg);
  border-color: #fecaca;
  color: var(--error);
}

.ragged-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid #fde68a;
}

.spreadsheet-wrapper {
  flex: 1;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  overflow: auto;
  position: relative;
  user-select: text;
}

.spreadsheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: var(--heading);
  min-width: 100%;
}

.spreadsheet-table th, .spreadsheet-table td {
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  padding: 6px 10px;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sticky Header Row */
.spreadsheet-table thead {
  position: sticky;
  top: 0;
  z-index: 15;
  background: #f8fafc;
}

.spreadsheet-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--heading);
  background: #f1f5f9;
  text-align: left;
  user-select: none;
  position: relative;
}

.th-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.col-letter {
  font-weight: 700;
  color: var(--brand-blue);
}

.col-name {
  color: var(--body);
  font-weight: 500;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-resizer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 20;
}

.col-resizer:hover {
  background: var(--brand-blue);
}

/* Sticky Row Number Column */
.row-number-cell {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center !important;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: #f8fafc;
  position: sticky;
  left: 0;
  z-index: 10;
  user-select: none;
}

.spreadsheet-table thead th:first-child {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 25;
  width: 44px;
  min-width: 44px;
  text-align: center;
}

.spreadsheet-table tbody tr:hover td {
  background-color: #f8fafc;
}

.spreadsheet-table td.selected {
  outline: 2px solid var(--brand-blue);
  outline-offset: -2px;
  background-color: #eff6ff !important;
}

.cell-inline-input {
  width: 100%;
  height: 100%;
  padding: 4px 6px;
  background: #ffffff;
  border: 2px solid var(--brand-blue);
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  color: var(--heading);
  outline: none;
}

.filename-input {
  width: 140px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: var(--surface-low);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--heading);
  outline: none;
}

.filename-input:focus {
  border-color: var(--brand-blue);
  background: #ffffff;
}

/* 11. PROGRESS BAR */
.progress-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(226, 232, 240, 0.6);
  overflow: hidden;
  z-index: 40;
  display: none;
}

.progress-container.active {
  display: block;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--brand-gradient);
  transition: width 0.15s ease;
}

/* 12. TOAST SYSTEM */
.toast-container {
  position: fixed;
  top: 72px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateY(-8px);
  opacity: 0;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.toast-success {
  background: var(--success);
  color: #ffffff;
}

.toast.toast-error {
  background: var(--error);
  color: #ffffff;
}

.toast.toast-info {
  background: #0f172a;
  color: #ffffff;
}

/* Copied green state on button */
.copied-state {
  background: var(--success) !important;
  color: #ffffff !important;
  border-color: var(--success) !important;
}

/* 13. FOCUS MODE */
.workspace-wrapper.focus-mode {
  position: fixed;
  inset: 0;
  max-width: 100vw;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 12px;
  background: #ffffff;
  z-index: 999;
}

.workspace-wrapper.focus-mode .split-workspace {
  height: calc(100vh - 64px);
  max-height: none;
}

/* 14. MODAL DIALOGS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 150;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-elevated);
  max-width: 560px;
  width: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--card-border);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--heading);
}

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

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-low);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--heading);
}

.shortcut-key {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

/* 15. SEO CONTENT SECTION BELOW THE FOLD (700-1000 words) */
.seo-section {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto 60px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 48px;
  position: relative;
  z-index: 10;
}

.seo-block {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.seo-section-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--heading);
  letter-spacing: -0.02em;
}

.seo-subtitle {
  font-size: 15px;
  color: var(--muted);
}

/* Steps Grid */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.step-card {
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.02);
}

.step-num {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-blue);
}

.step-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--heading);
}

.step-desc {
  font-size: 13.5px;
  color: var(--body);
  line-height: 1.55;
}

/* Comparison Before / After */
.contrast-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.contrast-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contrast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
}

.contrast-code-preview {
  background: var(--surface-low);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--body);
  overflow-x: auto;
}

/* Value Props / Explanations */
.explainer-card {
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.explainer-text {
  font-size: 15px;
  line-height: 1.65;
  color: var(--body);
}

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

.explainer-subitem {
  background: var(--surface-low);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.explainer-subitem-title {
  font-weight: 700;
  color: var(--heading);
  font-size: 14.5px;
}

/* FAQ Accordion */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  background: var(--card-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 14px 18px;
  transition: all 0.2s ease;
}

.faq-item summary {
  font-family: var(--font-heading);
  font-size: 15.5px;
  font-weight: 700;
  color: var(--heading);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-icon-arrow {
  transition: transform 0.2s ease;
  color: var(--brand-blue);
  flex-shrink: 0;
}

.faq-item[open] .faq-icon-arrow {
  transform: rotate(180deg);
}

.faq-content {
  margin-top: 10px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--body);
}

/* Related Tools */
.related-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.tool-link-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.tool-link-card:hover {
  border-color: var(--brand-blue);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
  text-decoration: none;
  transform: translateY(-1px);
}

.tool-link-title {
  font-weight: 600;
  color: var(--heading);
  font-size: 14px;
}

.tool-link-desc {
  font-size: 12px;
  color: var(--muted);
}

/* 16. FOOTER */
.site-footer {
  margin-top: auto;
  background: var(--surface-low);
  border-top: 1px solid var(--card-border);
  padding: 40px 20px 24px 20px;
  position: relative;
  z-index: 10;
}

.footer-container {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 400px;
}

.footer-tagline {
  font-size: 13.5px;
  color: var(--muted);
}

.footer-nav-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-nav-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.footer-tools-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 8px 24px;
}

.footer-link {
  font-size: 13px;
  color: var(--body);
  text-decoration: none;
}

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

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 12px;
}

/* 17. MOBILE STICKY BOTTOM ACTION BAR (Under 900px) */
.mobile-action-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--card-border);
  padding: 10px 16px;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
  z-index: 45;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* 18. RESPONSIVE BREAKPOINTS */
@media (max-width: 900px) {
  .split-workspace {
    flex-direction: column;
    height: auto;
    min-height: auto;
  }

  .pane-left, .pane-right {
    width: 100% !important;
    min-height: 60dvh;
    height: 60dvh;
  }

  .split-divider {
    display: none !important;
  }

  .mobile-action-bar {
    display: flex;
  }

  .site-footer {
    padding-bottom: 70px; /* offset sticky mobile bar */
  }

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

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

@media (max-width: 700px) {
  .header-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid var(--card-border);
    flex-direction: column;
    padding: 16px 20px;
    gap: 12px;
    box-shadow: var(--shadow-lg);
  }

  .header-nav.mobile-open {
    display: flex;
  }

  .hamburger-btn {
    display: block;
  }

  .hero-compact {
    max-height: none;
  }

  .hero-title {
    font-size: 21px;
  }

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

/* Minimum 44px tap targets for mobile touch controls */
@media (pointer: coarse) {
  button, .btn, .sheet-tab, .option-label {
    min-height: 44px;
  }
}
