/* Automated CV Profiler – Enterprise White, Blue & Navy Theme
   GECO Asia Standard Styling & High-Fidelity Word Formatting
*/

:root {
  /* Surfaces & Backgrounds */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-card-hover: #ffffff;
  --bg-input: #ffffff;
  --bg-input-focus: #ffffff;

  /* Borders */
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-strong: #cbd5e1;
  --border-focus: #2563eb;

  /* Brand Palette - White, Blue & Deep Navy Blue */
  --navy-deep: #0a192f;
  --navy-primary: #0f2b48;
  --navy-mid: #16375c;
  --navy-light: #1e3a8a;
  
  --blue-royal: #1d4ed8;
  --blue-vibrant: #2563eb;
  --blue-bright: #3b82f6;
  --blue-sky: #0284c7;
  --blue-tint: #dbeafe;
  --blue-subtle: #eff6ff;

  /* Typography */
  --text-main: #0f172a;
  --text-navy: #0f2b48;
  --text-muted: #475569;
  --text-dim: #64748b;
  --text-inverse: #ffffff;

  /* Semantic Roles */
  --primary: #0f2b48;
  --primary-hover: #1e3a8a;
  --primary-vibrant: #2563eb;
  --primary-glow: rgba(37, 99, 235, 0.18);
  --secondary: #1d4ed8;
  --accent: #2563eb;

  --success: #0284c7;
  --warning: #d97706;
  --danger: #dc2626;

  /* Geometry & Elevation */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-sm: 0 1px 3px rgba(15, 43, 72, 0.06);
  --shadow-card: 0 4px 20px -2px rgba(15, 43, 72, 0.08), 0 2px 6px -1px rgba(15, 43, 72, 0.04);
  --shadow-card-hover: 0 12px 30px -4px rgba(15, 43, 72, 0.14), 0 4px 10px -2px rgba(15, 43, 72, 0.06);
  --shadow-glow: 0 0 25px rgba(37, 99, 235, 0.22);
}

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

[hidden] {
  display: none !important;
}

html {
  max-width: 100vw;
  overflow-x: hidden;
  height: 100%;
}

body {
  max-width: 100vw;
  overflow-x: hidden;
  height: auto;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Background Ambient Lighting (Bright, Crisp White & Cool Slate/Blue) */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: #f8fafc;
}

h1, h2, h3, h4 {
  font-family: 'Outfit', sans-serif;
  color: var(--navy-primary);
  font-weight: 700;
  letter-spacing: -0.015em;
}

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: var(--blue-subtle);
  border: 1px solid var(--blue-tint);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--blue-royal);
}

/* ==========================================================
   TOPBAR HEADER (Structured Enterprise 3-Zone Architecture)
   ========================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 32px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(15, 43, 72, 0.04);
  gap: 20px;
}

/* Hide Navigation Tabs and Role Tag Controls when on Landing Page Portal */
body.view-portal-active .topbar-center,
body.view-portal-active .topbar-right {
  display: none !important;
}

.topbar-left {
  display: flex;
  align-items: center;
  flex: 1 1 0%;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 43, 72, 0.1);
  display: block;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy-primary);
  line-height: 1.2;
  white-space: nowrap;
}

.brand-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.topbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.tab {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab:hover {
  color: var(--navy-primary);
  background: rgba(255, 255, 255, 0.7);
}

.tab.active {
  background: #ffffff;
  color: var(--navy-primary);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(15, 43, 72, 0.08);
}

.tab-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue-subtle);
  color: var(--blue-royal);
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.tab.active .tab-num {
  background: var(--navy-primary);
  color: #ffffff;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 0%;
  min-width: 0;
  gap: 12px;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 5px 13px;
  border-radius: 99px;
  font-size: 0.8rem;
  color: var(--navy-primary);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.06);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue-vibrant);
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.6);
  flex-shrink: 0;
}

.topbar-divider {
  width: 1px;
  height: 22px;
  background: #cbd5e1;
  flex-shrink: 0;
}

.role-selector-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.9);
  padding: 3px 5px 3px 8px;
  border-radius: 99px;
  box-shadow: 0 1px 3px rgba(15, 43, 72, 0.05);
  white-space: nowrap;
}

.user-session-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-right: 2px;
}

.user-avatar-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
}

.user-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.35);
}

.user-session-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}

.user-session-label {
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

.role-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy-primary);
  letter-spacing: -0.01em;
}

.role-tag.admin-active {
  color: #b91c1c;
}

.topbar-vdivider {
  width: 1px;
  height: 20px;
  background: #e2e8f0;
  flex-shrink: 0;
}

#btn-portal-return {
  padding: 4px 10px;
  font-size: 0.74rem;
  border-radius: 99px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: var(--navy-primary);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

#btn-portal-return .btn-icon {
  font-size: 0.82rem;
  color: var(--blue-vibrant);
}

#btn-portal-return:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: var(--blue-vibrant);
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.12);
}

/* ==========================================================
   MAIN LAYOUT & CARDS
   ========================================================== */
main {
  flex: 1 1 auto;
  max-width: 1840px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(10px, 1.8vh, 24px) clamp(16px, 2.5vw, 44px);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.view {
  animation: fadeIn 0.25s ease-out;
}

#view-profile {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Card Container */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
}

/* ==========================================================
   STEP 1: 2-PANEL FORM (Left: Instructions & Template, Right: Upload Dropzone)
   ========================================================== */
.upload-2panel-card {
  width: 100%;
  max-width: 1720px;
  margin: 0 auto;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(420px, 1.15fr) minmax(380px, 1fr);
  gap: clamp(20px, 2.4vw, 36px);
  padding: clamp(20px, 2.6vh, 36px) clamp(24px, 2.5vw, 44px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  align-items: stretch;
  box-sizing: border-box;
  grid-template-rows: minmax(0, 1fr);
  min-height: calc(100vh - 150px);
  min-height: calc(100dvh - 150px);
}

@media (max-width: 960px) {
  .upload-2panel-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 20px;
    padding: 18px;
    flex: none;
    min-height: auto;
    height: auto;
  }
}

@media (max-height: 640px) {
  .upload-2panel-card {
    grid-template-rows: auto;
    min-height: auto;
    height: auto;
  }
}

/* Large screens: scale content up so the space is used well */
@media (min-width: 1600px) and (min-height: 900px) {
  .upload-2panel-card {
    grid-template-columns: 1.1fr 1fr;
    gap: 48px;
    padding: 40px 56px;
  }
  .flow-header-left h2 { font-size: 2.1rem; }
  .flow-header-left p.muted.small { font-size: 1rem; }
  .instructions-list li { font-size: 0.98rem; }
  .restriction-allowed { font-size: 1rem; }
  .restriction-prohibited { font-size: 0.95rem; }
  .upload-tips-note { font-size: 0.95rem; }
  .select-styled { font-size: 1rem; padding: 13px 16px; }
  .instructions-heading { font-size: 1.12rem; }
}

.upload-panel-left {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.6vh, 18px);
  height: 100%;
}

.flow-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flow-header-left h2 {
  font-size: clamp(1.35rem, 1.8vw, 1.7rem);
  margin: 2px 0 0;
  color: var(--navy-primary);
  line-height: 1.25;
}

.badge-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--blue-subtle);
  color: var(--navy-primary);
  border: 1px solid #bfdbfe;
  padding: 2px 10px;
  border-radius: 99px;
  text-transform: uppercase;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 0.82rem;
}

.flow-header-left p.muted.small {
  font-size: clamp(0.8rem, 0.9vw, 0.88rem);
  line-height: 1.4;
  margin: 0;
}

.template-select-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: clamp(10px, 1.4vh, 16px) clamp(12px, 1.2vw, 18px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.label-tiny {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--navy-light);
  display: block;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.choice-row {
  display: flex;
  gap: 10px;
}

.select-styled {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  padding: clamp(8px, 1.1vh, 11px) 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: clamp(0.86rem, 0.9vw, 0.92rem);
  outline: none;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.select-styled:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.upload-instructions-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: clamp(12px, 1.8vh, 20px) clamp(14px, 1.4vw, 22px);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.4vh, 16px);
  flex: 1;
  justify-content: space-between;
}

.instructions-heading {
  font-size: clamp(0.88rem, 0.95vw, 1rem);
  color: var(--navy-primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

/* File format restriction highlight */
.file-format-restriction-card {
  background: #ffffff;
  border: 1.5px solid #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
  border-radius: var(--radius-sm);
  padding: clamp(8px, 1.2vh, 14px) clamp(10px, 1.2vw, 16px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.restriction-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: clamp(0.66rem, 0.75vw, 0.74rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #1e40af;
  text-transform: uppercase;
}

.restriction-icon {
  font-size: 0.85rem;
}

.restriction-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.restriction-allowed {
  font-size: clamp(0.78rem, 0.85vw, 0.88rem);
  color: #0f2b48;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  line-height: 1.4;
}

.restriction-allowed .check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.7rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}

.restriction-prohibited {
  font-size: clamp(0.75rem, 0.82vw, 0.84rem);
  color: #991b1b;
  background: #fef2f2;
  border-left: 3px solid #ef4444;
  padding: clamp(5px, 0.8vh, 8px) clamp(8px, 1vw, 12px);
  border-radius: 4px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  line-height: 1.35;
}

.restriction-prohibited .cross-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.7rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}

.instructions-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 1.2vh, 14px) clamp(10px, 1.4vw, 18px);
  flex: 1;
  align-content: space-evenly;
}

.instructions-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: clamp(0.76rem, 0.82vw, 0.86rem);
  color: var(--text-main);
  line-height: 1.35;
}

.bullet-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue-subtle);
  border: 1px solid #bfdbfe;
  color: var(--blue-royal);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.upload-tips-note {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: clamp(6px, 1vh, 10px) clamp(10px, 1.2vw, 14px);
  font-size: clamp(0.74rem, 0.8vw, 0.82rem);
  color: var(--navy-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin-top: auto;
  line-height: 1.35;
}

.upload-panel-right {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.6vh, 18px);
  justify-content: space-between;
  height: 100%;
}

.upload-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 2px;
}

.upload-panel-right .dropzone {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: clamp(200px, 28vh, 380px);
  gap: clamp(12px, 1.6vh, 20px);
  padding: clamp(20px, 3vh, 44px) clamp(20px, 2vw, 36px);
}

.action-footer {
  margin-top: 4px;
}

.action-footer .btn {
  width: 100%;
  padding: clamp(12px, 1.6vh, 18px) 28px;
  font-size: clamp(0.92rem, 1vw, 1.05rem);
}

/* ==========================================================
   DROPZONE (White & Navy Blue)
   ========================================================== */
.dropzone {
  border: 2px dashed #93c5fd;
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-card);
}

.dropzone:hover, .dropzone.dragover, .dropzone:focus {
  border-color: var(--blue-vibrant);
  background: #f0f7ff;
  outline: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.dropzone.has-file {
  padding: 16px 16px;
  gap: 6px;
}

.dropzone.has-file.is-pdf {
  border-color: #fca5a5;
  background: #fffafa;
}

.dropzone.has-file.is-pdf:hover, .dropzone.has-file.is-pdf.dragover, .dropzone.has-file.is-pdf:focus {
  border-color: #ef4444;
  background: #fff5f5;
  box-shadow: 0 12px 32px -4px rgba(239, 68, 68, 0.18);
}

.dropzone.has-file.is-docs {
  border-color: #93c5fd;
  background: #f8fbff;
}

.dropzone.has-file.is-docs:hover, .dropzone.has-file.is-docs.dragover, .dropzone.has-file.is-docs:focus {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 12px 32px -4px rgba(37, 99, 235, 0.18);
}

.drop-illustration {
  margin-bottom: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.drop-circle {
  width: clamp(54px, 6.5vh, 74px);
  height: clamp(54px, 6.5vh, 74px);
  border-radius: 50%;
  background: var(--blue-subtle);
  border: 1px solid #bfdbfe;
  color: var(--blue-royal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.6rem, 2.2vh, 2.2rem);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

.file-format-logo {
  display: block;
  width: clamp(56px, 6.8vh, 76px);
  height: clamp(56px, 6.8vh, 76px);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: logoPopIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dropzone:hover .file-format-logo {
  transform: translateY(-2px) scale(1.05);
}

@keyframes logoPopIn {
  0% { transform: scale(0.65); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.drop-title {
  font-size: 1.05rem;
  color: var(--navy-primary);
  font-weight: 700;
  max-width: 90%;
  word-break: break-word;
}

.drop-file-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
  margin-bottom: 2px;
}

.file-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.file-type-pill.pill-pdf {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.08);
}

.file-type-pill.pill-docs {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  box-shadow: 0 1px 3px rgba(29, 78, 216, 0.08);
}

.file-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.pill-pdf .file-pill-dot {
  background: #dc2626;
  box-shadow: 0 0 6px #ef4444;
}

.pill-docs .file-pill-dot {
  background: #2563eb;
  box-shadow: 0 0 6px #3b82f6;
}

.file-size-pill {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 6px;
}

.file-replace-hint {
  font-size: 0.76rem;
  color: var(--blue-royal);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-weight: 500;
}

.drop-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ==========================================================
   BUTTONS (Strictly White & Navy Blue / Royal Blue)
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  transition: all 0.2s ease;
  color: #fff;
  text-decoration: none;
}

.btn-primary {
  background: var(--navy-primary);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 43, 72, 0.2);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--navy-deep);
  box-shadow: 0 6px 20px rgba(15, 43, 72, 0.3);
}

.btn-glow {
  background: var(--blue-royal);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.28);
}

.btn-glow:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(37, 99, 235, 0.45);
  background: var(--navy-primary);
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--navy-primary);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--blue-subtle);
  border-color: #93c5fd;
  color: var(--blue-royal);
}

.btn-subtle {
  background: #f8fafc;
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 0.82rem;
  padding: 8px 12px;
}

.btn-subtle:hover {
  background: #ffffff;
  border-color: var(--border-strong);
  color: var(--navy-primary);
}

.btn-danger {
  background: #ffffff;
  border: 1px solid #fca5a5;
  color: var(--danger);
}

.btn-danger:hover {
  background: #fef2f2;
  border-color: var(--danger);
}

.btn-large {
  padding: 14px 26px;
  font-size: 0.98rem;
  border-radius: var(--radius-md);
  width: 100%;
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-tiny {
  padding: 4px 10px;
  font-size: 0.75rem;
  height: 28px;
}

.btn-link {
  background: none;
  border: 0;
  color: var(--blue-vibrant);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.btn-link:hover {
  text-decoration: underline;
  color: var(--navy-primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-icon-btn {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--navy-primary);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.btn-icon-btn:hover {
  background: var(--blue-subtle);
  border-color: #93c5fd;
  color: var(--blue-royal);
}

/* Banner Error */
.banner {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.banner-error {
  background: #fef2f2;
  border: 1.5px solid #ef4444;
  color: #991b1b;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.1);
  line-height: 1.5;
}

.banner-error strong {
  display: block;
  font-size: 0.92rem;
  color: #7f1d1d;
  margin-bottom: 3px;
}

/* ==========================================================
   ENHANCED GECO STANDARD LOADING SCREEN OVERLAY
   ========================================================== */
.processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 25, 47, 0.58);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease-out;
}

.geco-loading-card {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-xl);
  padding: 26px 30px;
  max-width: 560px;
  width: 100%;
  text-align: center;
  box-shadow: 
    0 25px 60px -10px rgba(15, 43, 72, 0.35),
    0 0 0 1px rgba(15, 43, 72, 0.04);
  animation: scaleInCard 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@keyframes scaleInCard {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* GECO Brand Header in Loading Modal */
.geco-loading-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.geco-brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--blue-subtle);
  border: 1px solid #bfdbfe;
  padding: 4px 12px;
  border-radius: 99px;
}

.geco-header-badge-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}

.geco-brand-text {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--navy-primary);
  letter-spacing: 0.08em;
}

.geco-status-pill {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy-light);
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
}

/* Animated Enterprise Dual-Ring GECO Spinner with Official Logo */
.geco-loader-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 14px 0 16px;
  position: relative;
}

.geco-spinner {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-pulse-glow {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: rgba(29, 78, 216, 0.08);
  animation: pulseAura 2.2s ease-in-out infinite;
  z-index: 1;
}

.spinner-outer-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3.5px solid #dbeafe;
  border-top-color: var(--blue-vibrant);
  border-right-color: var(--navy-primary);
  animation: spinClockwise 1.3s cubic-bezier(0.5, 0.12, 0.5, 0.88) infinite;
  z-index: 2;
  filter: drop-shadow(0 2px 6px rgba(37, 99, 235, 0.25));
}

.spinner-inner-ring {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  border: 2px dashed #93c5fd;
  border-top-color: var(--navy-light);
  border-bottom-color: var(--blue-royal);
  animation: spinCounterClockwise 1s linear infinite;
  z-index: 3;
}

.spinner-center-logo {
  position: relative;
  width: 58px;
  height: 58px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(15, 43, 72, 0.16), 0 0 0 3px #eff6ff;
  animation: floatBreathing 2.4s ease-in-out infinite;
  z-index: 4;
  overflow: hidden;
}

.geco-spinner-logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
}

@keyframes spinClockwise {
  to { transform: rotate(360deg); }
}

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

@keyframes floatBreathing {
  0%, 100% {
    transform: scale(0.96);
    box-shadow: 0 4px 14px rgba(15, 43, 72, 0.14), 0 0 0 3px #eff6ff;
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.28), 0 0 0 4px #dbeafe;
  }
}

@keyframes pulseAura {
  0%, 100% {
    transform: scale(0.92);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.9;
  }
}

.geco-loading-titles {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0;
  width: 100%;
}

.geco-loading-titles h3 {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
  margin: 0;
  color: var(--navy-primary);
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  white-space: nowrap;
  max-width: 100%;
}

.animated-ellipsis {
  display: inline-flex;
  margin-left: 2px;
}

.animated-ellipsis span {
  display: inline-block;
  color: var(--blue-royal);
  opacity: 0.3;
  animation: ellipsisBounce 1.4s infinite ease-in-out;
}

.animated-ellipsis span:nth-child(1) {
  animation-delay: 0s;
}
.animated-ellipsis span:nth-child(2) {
  animation-delay: 0.22s;
}
.animated-ellipsis span:nth-child(3) {
  animation-delay: 0.44s;
}

@keyframes ellipsisBounce {
  0%, 80%, 100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.geco-loading-titles p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
  margin-top: 6px;
}

/* Dynamic Variant Transformation Rules Box */
.geco-rules-banner {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  text-align: left;
}

.rules-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.rules-caption {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy-light);
}

.rules-variant-badge {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--blue-subtle);
  color: var(--blue-royal);
  border: 1px solid #bfdbfe;
  padding: 2px 8px;
  border-radius: 99px;
}

.rules-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rule-chip {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.rule-chip.active {
  background: #eff6ff;
  color: var(--navy-primary);
  border: 1px solid #bfdbfe;
}

.rule-chip.disabled {
  background: #f1f5f9;
  color: var(--text-dim);
  border: 1px dashed var(--border-strong);
  text-decoration: line-through;
}

.chip-icon {
  font-weight: 800;
  font-size: 0.8rem;
}

/* Animated Shimmer Progress Bar */
.geco-progress-track {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.geco-progress-fill {
  height: 100%;
  width: 25%;
  background: var(--blue-royal);
  border-radius: 99px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.geco-progress-fill::after {
  content: '';
  display: none;
}

/* Steps List */
.progress-steps {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.prog-step {
  padding: 8px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.2s ease;
}

.step-left-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-num-bubble {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e2e8f0;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-label {
  font-weight: 500;
}

.step-check {
  font-size: 0.85rem;
  color: #cbd5e1;
  font-weight: 700;
}

.prog-step.active {
  color: var(--navy-primary);
  background: #eff6ff;
  border-color: #bfdbfe;
  border-left: 4px solid var(--blue-vibrant);
  font-weight: 600;
}

.prog-step.active .step-num-bubble {
  background: var(--blue-vibrant);
  color: #ffffff;
}

.prog-step.active .step-check {
  color: var(--blue-vibrant);
  animation: pulseLogo 1s infinite;
}

.prog-step.completed {
  background: #f8fafc;
  border-color: var(--border);
  color: var(--navy-light);
}

.prog-step.completed .step-num-bubble {
  background: var(--navy-primary);
  color: #ffffff;
}

.prog-step.completed .step-check {
  color: var(--blue-royal);
}

.geco-loading-actions {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

.btn-abort-loader {
  background: #ffffff;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(185, 28, 28, 0.08);
}

.btn-abort-loader:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(239, 68, 68, 0.15);
}

.abort-icon {
  font-size: 0.75rem;
  font-weight: 800;
}

/* ==========================================================
   REVIEW TOOLBAR & LIVE PREVIEW WORKSPACE
   ========================================================== */
.review-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-card);
}

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

.toolbar-title-group h2 {
  font-size: 1.35rem;
  color: var(--navy-primary);
}

.toolbar-meta {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.meta-pill {
  font-size: 0.74rem;
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 99px;
  color: var(--text-muted);
  font-weight: 500;
}

.pill-accent {
  background: var(--blue-subtle);
  border: 1px solid #bfdbfe;
  color: var(--blue-royal);
  font-weight: 600;
}

.pill-success {
  background: #eff6ff;
  color: var(--navy-light);
  border: 1px solid #bfdbfe;
  font-weight: 600;
}

/* Split Workspace - Generous Wide Proportions */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(420px, 480px) 1fr;
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
}

.field-inspector-panel {
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  position: sticky;
  top: 90px;
}

.document-preview-panel {
  min-height: 800px;
}

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

.field-inspector-panel .panel-header {
  padding: 8px 0 10px;
  display: flex;
  align-items: center;
  justify-content: stretch;
}

.field-inspector-panel .panel-header #btn-toggle-cv-source {
  width: 100%;
  justify-content: center;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 8px 12px;
}

.panel-header h3 {
  font-size: 1.05rem;
  color: var(--navy-primary);
}

/* Raw CV Drawer */
.cv-source-drawer {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.82rem;
  color: var(--navy-primary);
}

.code-box {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-main);
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius-sm);
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.45;
}

/* ==========================================================
   CORE CANDIDATE IDENTITY CARD (Prominent White & Navy Card)
   ========================================================== */
.core-candidate-card {
  margin: 14px 0 10px;
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: 0 4px 16px rgba(15, 43, 72, 0.06);
  width: 100%;
  box-sizing: border-box;
}

.core-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  background: #f8fafc;
  padding: 6px 10px;
  border-radius: 8px;
}

.core-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--navy-primary);
  font-weight: 700;
}

.core-badge-icon {
  font-size: 1rem;
}

.tag-accent {
  font-size: 0.68rem;
  background: var(--blue-subtle);
  border: 1px solid #bfdbfe;
  color: var(--blue-royal);
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.core-card-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.core-fields-grid {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 12px;
}

.core-field-item label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--navy-primary);
  margin-bottom: 5px;
}

.core-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.core-input-wrap .input-icon {
  position: absolute;
  left: 10px;
  font-size: 0.85rem;
  pointer-events: none;
  opacity: 0.75;
}

.core-text-input {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 8px 12px 8px 34px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.core-text-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background: #ffffff;
}

/* Guidance card directing users to Edit on Preview for document contents */
.preview-edit-guidance-card {
  margin: 10px 0 16px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.guidance-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--navy-primary);
  font-size: 0.92rem;
  font-weight: 700;
}

.guidance-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.btn-guidance-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #ffffff;
  border: 1.5px solid var(--blue-royal);
  color: var(--blue-royal);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  margin-top: 4px;
}

.btn-guidance-edit:hover {
  background: var(--blue-royal);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.2);
}

.fields-section-title {
  padding: 14px 22px 6px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}

.fields-section-title h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy-primary);
}

/* Fields Form */
.fields-list {
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: all 0.2s;
}

.field-card:hover, .field-card:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 4px 14px rgba(15, 43, 72, 0.06);
  background: #ffffff;
}

.field-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 10px;
  flex-wrap: wrap;
}

.field-label-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 220px;
}

.field-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--navy-primary);
  line-height: 1.35;
  word-break: break-word;
}

.field-tag-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--blue-royal);
  background: var(--blue-subtle);
  border: 1px solid var(--blue-tint);
  padding: 1px 6px;
  border-radius: 4px;
}

.badge-verbatim {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}

.badge-verbatim.verified {
  background: #eff6ff;
  color: var(--navy-light);
  border: 1px solid #bfdbfe;
}

.badge-verbatim.unverified {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-verbatim.empty {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.field-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 85px;
  transition: border 0.2s;
  box-shadow: var(--shadow-sm);
}

.field-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.88rem;
  transition: border 0.2s;
  box-shadow: var(--shadow-sm);
}

.field-textarea:focus, .field-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.field-hint-bar {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
}

/* ==========================================================
   GECO PROFILE FORMAT / BLIND SELECTOR STYLES (White & Navy)
   ========================================================== */
.geco-format-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.format-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy-primary);
  white-space: nowrap;
}

.format-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
}

.btn-format {
  background: #ffffff;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-format:hover {
  color: var(--navy-primary);
  background: #eff6ff;
}

.btn-format.active {
  background: var(--navy-primary);
  border-color: var(--navy-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 43, 72, 0.3);
}

.btn-format[data-variant="blind"].active {
  background: var(--blue-royal);
  border-color: var(--blue-royal);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-format[data-variant="blind_no_company"].active {
  background: var(--navy-deep);
  border-color: var(--navy-deep);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(10, 25, 47, 0.3);
}

.format-icon {
  font-size: 0.88rem;
}

/* Step 1 Choice Card Variant Buttons */
.step1-format-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.format-buttons-sm {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-format-sm {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.btn-format-sm:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: var(--navy-primary);
}

.btn-format-sm.active {
  background: var(--navy-primary);
  border-color: var(--navy-primary);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(15, 43, 72, 0.25);
}

.btn-format-sm[data-variant="blind"].active {
  background: var(--blue-royal);
  border-color: var(--blue-royal);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.25);
}

.btn-format-sm[data-variant="blind_no_company"].active {
  background: var(--navy-deep);
  border-color: var(--navy-deep);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(10, 25, 47, 0.25);
}

/* ==========================================================
   DOCUMENT PREVIEW CONTROLS & AUTHENTIC WORD CANVAS
   ========================================================== */
.preview-controls-header {
  padding: 14px 22px;
  background: #ffffff;
}

.preview-title-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy-primary);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue-vibrant);
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.6);
}

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

.zoom-group {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  padding: 3px 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  gap: 3px;
  box-shadow: inset 0 1px 2px rgba(15, 43, 72, 0.04);
}

.zoom-group .btn-icon-btn {
  background: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.8);
  color: var(--navy-primary);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.zoom-group .btn-icon-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: var(--blue-royal);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(29, 78, 216, 0.1);
}

.zoom-group .btn-icon-btn:active {
  background: #dbeafe;
  border-color: var(--blue-royal);
  transform: translateY(0);
}

.zoom-text {
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--navy-primary);
  min-width: 40px;
  text-align: center;
  font-weight: 700;
  padding: 0 4px;
  user-select: none;
}

.zoom-divider {
  width: 1px;
  height: 18px;
  background: #cbd5e1;
  margin: 0 3px;
  flex-shrink: 0;
}

.btn-zoom-action {
  background: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.9);
  color: var(--navy-primary);
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  user-select: none;
}

.btn-zoom-action .zoom-action-icon {
  font-size: 0.88rem;
  line-height: 1;
  color: var(--blue-royal);
  transition: transform 0.15s ease;
}

.btn-zoom-action:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: var(--blue-royal);
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.12);
  transform: translateY(-1px);
}

.btn-zoom-action:hover .zoom-action-icon {
  transform: scale(1.15);
}

.btn-zoom-action:active {
  background: #dbeafe;
  border-color: var(--blue-royal);
  color: var(--blue-navy);
  transform: translateY(0);
  box-shadow: inset 0 1px 2px rgba(15, 43, 72, 0.1);
}

/* Viewport Wrap: Clean Slate-Blue Backdrop for Pure White Word Pages */
.doc-viewport-wrap {
  background: #edf2f7;
  padding: 32px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: auto;
  max-height: calc(100vh - 220px);
  display: flex;
  justify-content: center;
  box-shadow: inset 0 2px 8px rgba(15, 43, 72, 0.05);
}

.docx-canvas-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  transform-origin: top center;
  transition: transform 0.15s ease-out;
}

.docx-wrapper {
  background: transparent !important;
  padding: 0 !important;
}

.docx-wrapper > section.docx {
  background: #ffffff !important;
  color: #111827 !important;
  font-family: 'Verdana', Geneva, Tahoma, sans-serif !important;
  box-shadow: 0 10px 30px -5px rgba(15, 43, 72, 0.18), 0 4px 10px -2px rgba(15, 43, 72, 0.08) !important;
  border-radius: 2px !important;
  margin-bottom: 24px !important;
}

.docx-canvas-wrap header,
.docx-canvas-wrap footer,
.docx-canvas-wrap .docx-header,
.docx-canvas-wrap .docx-footer,
.docx-canvas-wrap section.docx-header,
.docx-canvas-wrap section.docx-footer {
  display: none !important;
}

.docx-wrapper, .docx-wrapper *, section.docx, section.docx * {
  font-family: 'Verdana', Geneva, Tahoma, sans-serif !important;
}

/* Spacing and Word layout fidelity */
.cert-heading {
  margin-top: 22px !important;
}

.train-heading {
  margin-top: 18px !important;
}

.detailed-heading {
  margin-top: 20px !important;
  margin-bottom: 6px !important;
}

.duration-para {
  margin-top: 14px !important;
}

/* ==========================================================
   DIRECT EDIT ON PREVIEW MODE
   ========================================================== */
.btn-edit-preview {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  color: var(--navy-primary);
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.btn-edit-preview:hover {
  background: var(--blue-subtle);
  border-color: #93c5fd;
  color: var(--blue-royal);
}

.btn-edit-preview.active {
  background: var(--navy-primary);
  border-color: var(--navy-primary);
  color: #fff;
  box-shadow: 0 0 14px rgba(15, 43, 72, 0.35);
}

.btn-success-subtle {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: var(--blue-royal);
  font-weight: 600;
}

.btn-success-subtle:hover {
  background: #dbeafe;
  color: var(--navy-primary);
}

.preview-edit-banner {
  background: #ffffff;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(15, 43, 72, 0.05);
}

.edit-banner-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--navy-primary);
}

.edit-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue-vibrant);
  animation: pulseEdit 1.4s infinite;
}

@keyframes pulseEdit {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.edit-banner-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-banner-action {
  background: var(--blue-subtle);
  border: 1px solid #bfdbfe;
  color: var(--navy-primary);
  font-weight: 600;
}

.btn-banner-action:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.btn-banner-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  font-weight: 600;
}

.btn-banner-danger:hover {
  background: #fee2e2;
}

.banner-divider {
  width: 1px;
  height: 20px;
  background: var(--border-strong);
  margin: 0 4px;
}

.docx-canvas-wrap.direct-editing-active .docx-wrapper > section.docx {
  outline: 2px dashed #3b82f6 !important;
  outline-offset: 4px;
  box-shadow: 0 0 35px rgba(37, 99, 235, 0.2) !important;
  cursor: text !important;
}

.docx-canvas-wrap.direct-editing-active .docx-wrapper > section.docx *:hover {
  background-color: rgba(37, 99, 235, 0.04);
}

.docx-canvas-wrap.direct-editing-active tr.active-preview-row {
  outline: 2px solid var(--blue-vibrant) !important;
  background-color: rgba(37, 99, 235, 0.08) !important;
}

.docx-canvas-wrap.direct-editing-active table.active-preview-table {
  outline: 2px dashed var(--navy-primary) !important;
  outline-offset: 3px;
}

.table-edit-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 3px 10px;
  margin-top: 2px;
  margin-bottom: 3px;
  box-shadow: var(--shadow-sm);
}

.table-label-tag {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--navy-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-del-table-now {
  background: #ef4444;
  color: #fff;
  border: 1px solid #dc2626;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-del-table-now:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.edit-row-actions-td {
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  text-align: center !important;
  vertical-align: middle !important;
  border: none !important;
  background: transparent !important;
  padding: 2px 4px !important;
  user-select: none !important;
}

.btn-del-row-now {
  width: 30px;
  height: 28px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.btn-del-row-now:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #b91c1c;
  transform: scale(1.1);
}

.btn-field-clear {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: all 0.15s;
}

.btn-field-clear:hover {
  color: var(--navy-primary);
}

/* ==========================================================
   VIEW 0: LANDING PORTAL (SaaS Hero Layout with Vector Visual & 2 Action Buttons)
   ========================================================== */
#view-portal {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  min-height: 0;
}

.hero-container {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  animation: fadeIn 0.25s ease-out;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
}

@media (max-width: 1024px) {
  .hero-layout {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .visual-canvas {
    max-width: 440px;
    margin: 0 auto;
  }
}

/* Left Column: Hero Content */
.hero-content {
  display: flex;
  flex-direction: column;
}

.hero-badge-wrap {
  margin-bottom: 12px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-royal);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 4px 12px;
  border-radius: 999px;
}

.badge-svg {
  color: var(--blue-royal);
  flex-shrink: 0;
}

.hero-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.35rem;
  font-weight: 700;
  color: var(--navy-primary);
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 14px;
}

.hero-feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: #eff6ff;
  color: var(--blue-royal);
  border: 1px solid #bfdbfe;
}

.hero-pill svg {
  color: var(--blue-royal);
  flex-shrink: 0;
}

.hero-description {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 22px;
  max-width: 540px;
}

/* Two Action Buttons */
.hero-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.btn-hero-primary {
  padding: 13px 26px;
  font-size: 0.94rem;
  font-weight: 600;
  border-radius: 10px;
  background: var(--blue-royal);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-hero-primary:hover {
  background: var(--navy-primary);
  box-shadow: 0 6px 18px rgba(15, 43, 72, 0.3);
  transform: translateY(-2px);
}

.btn-hero-secondary {
  padding: 12px 24px;
  font-size: 0.94rem;
  font-weight: 600;
  border-radius: 10px;
  background: #ffffff;
  color: var(--blue-royal);
  border: 1.5px solid var(--blue-royal);
  box-shadow: 0 2px 6px rgba(15, 43, 72, 0.04);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-hero-secondary:hover {
  background: #eff6ff;
  border-color: var(--navy-primary);
  color: var(--navy-primary);
  box-shadow: 0 4px 14px rgba(15, 43, 72, 0.12);
  transform: translateY(-2px);
}

.btn-svg {
  flex-shrink: 0;
  color: currentColor;
}

.hero-actions .btn-arrow {
  transition: transform 0.2s ease;
}

.btn-hero-primary:hover .btn-arrow,
.btn-hero-secondary:hover .btn-arrow {
  transform: translateX(4px);
}

/* Trust / Metric Bar */
.hero-trust-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trust-stars {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy-primary);
}

.star-icon {
  color: var(--blue-royal);
  font-size: 1rem;
  letter-spacing: 2px;
}

.trust-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  row-gap: 4px;
  font-size: 0.76rem;
  color: var(--text-dim);
  font-weight: 500;
}

.trust-sep {
  color: #bfdbfe;
}

/* Right Column: Visual Canvas & Floating Cards */
.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.visual-canvas {
  position: relative;
  width: 100%;
  max-width: 460px;
  height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1.5px solid #dbeafe;
  border-radius: 22px;
  box-shadow: 0 8px 30px -4px rgba(15, 43, 72, 0.08), 0 2px 8px rgba(15, 43, 72, 0.04);
}

.vector-hub {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.vector-hub-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.vector-emblem-box {
  width: 210px;
  height: 220px;
}

.vector-emblem-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 6px 14px rgba(29, 78, 216, 0.12));
}

.vector-badge-title {
  margin-top: 10px;
}

.vbt-main {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy-primary);
}

.vbt-sub {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Floating Interactive Cards */
.float-card {
  position: absolute;
  background: #ffffff;
  border: 1.5px solid #bfdbfe;
  border-radius: 12px;
  box-shadow: 0 8px 24px -4px rgba(15, 43, 72, 0.12), 0 2px 6px rgba(15, 43, 72, 0.04);
  z-index: 5;
  transition: transform 0.25s ease;
}

.float-card:hover {
  transform: translateY(-3px);
  border-color: var(--blue-royal);
}

/* Floating Card 1: Template Tags (Top Right) */
.float-card-tags {
  top: -12px;
  right: -24px;
  padding: 10px 12px;
  width: 195px;
}

.float-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  font-size: 0.72rem;
  font-weight: 700;
}

.fc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue-royal);
}

.fc-label {
  color: var(--navy-primary);
  flex: 1;
}

.fc-tag-count {
  color: var(--blue-royal);
  font-size: 0.68rem;
}

.float-tags-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 7px;
}

.ft-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: var(--blue-royal);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.float-mini-bar {
  width: 100%;
  height: 4px;
  background: #eff6ff;
  border-radius: 2px;
  overflow: hidden;
}

.float-mini-bar-fill {
  width: 100%;
  height: 100%;
  background: var(--blue-royal);
  border-radius: 2px;
}

/* Floating Card 2: Verbatim Accuracy (Top Left) */
.float-card-accuracy {
  top: 24px;
  left: -34px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fc-icon-col {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fc-stat-label {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fc-stat-value {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy-primary);
  line-height: 1.1;
}

.fc-stat-sub {
  display: block;
  font-size: 0.66rem;
  color: var(--blue-royal);
  font-weight: 600;
}

/* Floating Card 3: Document Export Status (Bottom Right) */
.float-card-status {
  bottom: -16px;
  right: 6px;
  padding: 10px 14px;
}

.fc-doc-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fc-doc-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fc-doc-name {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--navy-primary);
}

.fc-doc-status {
  display: block;
  font-size: 0.66rem;
  color: var(--text-dim);
}

.fc-badge-ready {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--blue-royal);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 3px 8px;
  border-radius: 6px;
  margin-left: 6px;
  white-space: nowrap;
}

/* Bottom Reputation / Standard Bar */
.hero-bottom-bar {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.hbb-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.hbb-items {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--navy-primary);
  letter-spacing: 0.04em;
  flex-wrap: wrap;
}

.hbb-item {
  white-space: nowrap;
}

.hbb-sep {
  color: #bfdbfe;
}

/* ----------------------------------------------------------
   ADAPTIVE LANDING HERO – scales smoothly from laptop to 4K
   ---------------------------------------------------------- */
@media (min-width: 1200px) {
  .hero-container {
    max-width: min(1760px, 94vw);
  }
  .hero-layout {
    gap: clamp(48px, 5vw, 120px);
  }
  .hero-badge { font-size: clamp(0.72rem, 0.7vw, 0.95rem); padding: 0.35em 1em; }
  .hero-title {
    font-size: clamp(2.35rem, 3.1vw, 4.4rem);
    margin-bottom: clamp(14px, 1.6vh, 26px);
  }
  .hero-pill { font-size: clamp(0.76rem, 0.75vw, 1rem); padding: 0.35em 0.85em; }
  .hero-feature-pills { gap: clamp(8px, 0.8vw, 14px); margin-bottom: clamp(14px, 1.8vh, 26px); }
  .hero-description {
    font-size: clamp(0.92rem, 1vw, 1.3rem);
    max-width: 44em;
    margin-bottom: clamp(22px, 3vh, 40px);
  }
  .hero-actions { gap: clamp(14px, 1.2vw, 22px); margin-bottom: clamp(22px, 3vh, 40px); }
  .btn-hero-primary,
  .btn-hero-secondary {
    font-size: clamp(0.94rem, 0.95vw, 1.2rem);
    padding: clamp(13px, 1.4vh, 20px) clamp(26px, 2.2vw, 42px);
  }
  .trust-stars { font-size: clamp(0.82rem, 0.85vw, 1.1rem); }
  .trust-tags { font-size: clamp(0.76rem, 0.8vw, 1rem); }

  .visual-canvas {
    max-width: clamp(460px, 36vw, 760px);
    height: clamp(380px, 31vw, 640px);
  }
  .vector-emblem-box {
    width: clamp(210px, 17vw, 360px);
    height: clamp(220px, 17.8vw, 376px);
  }
  .vbt-main { font-size: clamp(1.05rem, 1.1vw, 1.5rem); }
  .vbt-sub { font-size: clamp(0.74rem, 0.78vw, 1rem); }
  .float-card-tags { width: clamp(195px, 15.5vw, 320px); padding: clamp(10px, 0.9vw, 16px); }
  .float-card-accuracy,
  .float-card-status { padding: clamp(10px, 0.9vw, 16px) clamp(14px, 1.2vw, 22px); }
  .float-card-header { font-size: clamp(0.72rem, 0.75vw, 1rem); }
  .ft-pill { font-size: clamp(0.62rem, 0.64vw, 0.86rem); }
  .fc-stat-label, .fc-stat-sub, .fc-doc-status { font-size: clamp(0.66rem, 0.7vw, 0.92rem); }
  .fc-stat-value { font-size: clamp(1.2rem, 1.25vw, 1.8rem); }
  .fc-doc-name { font-size: clamp(0.74rem, 0.78vw, 1.05rem); }
  .fc-badge-ready { font-size: clamp(0.68rem, 0.7vw, 0.92rem); }
}

/* Short laptop screens: tighten vertical rhythm so nothing scrolls */
@media (min-width: 1025px) and (max-height: 760px) {
  .hero-title { font-size: clamp(2rem, 2.6vw, 2.35rem); margin-bottom: 10px; }
  .hero-description { margin-bottom: 14px; }
  .hero-actions { margin-bottom: 14px; }
  .visual-canvas { height: min(380px, 52vh); }
}

/* Tablet & phone: stack and let the visual fill the width */
@media (max-width: 1024px) {
  #view-portal { align-items: flex-start; padding: 24px 20px; }
  .hero-visual { padding: 24px 0 36px; }
  .visual-canvas { width: 100%; max-width: min(520px, 92%); height: auto; min-height: 400px; padding: 56px 0 44px; box-sizing: border-box; }
  .float-card-accuracy { left: -8px; }
  .float-card-tags { right: -8px; }
}

@media (max-width: 560px) {
  .hero-title { font-size: clamp(1.6rem, 7vw, 2rem); }
  .hero-actions { flex-direction: column; align-items: stretch; width: 100%; }
  .btn-hero-primary, .btn-hero-secondary { width: 100%; justify-content: center; }
}

/* Role Selector in Topbar */
.role-selector-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================
   VIEW 2: TEMPLATE MANAGER
   ========================================================== */
.templates-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}

.template-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-section h2, .sidebar-section h3 {
  margin-bottom: 6px;
  color: var(--navy-primary);
}

.divider {
  border: 0;
  border-top: 1px solid var(--border);
}

.template-cards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  max-height: 240px;
  overflow-y: auto;
}

.tpl-card-item {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(15, 43, 72, 0.04);
}

.tpl-card-item:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.tpl-card-item.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15), 0 4px 14px rgba(37, 99, 235, 0.1);
}

.tpl-card-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.tpl-item-word-badge {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #1d4ed8;
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tpl-card-text-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tpl-item-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--navy-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tpl-field-pill {
  font-size: 0.7rem;
  color: #1e40af;
  background: #dbeafe;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.tpl-card-arrow {
  color: #94a3b8;
  font-size: 1rem;
  transition: transform 0.2s ease, color 0.2s ease;
}

.tpl-card-item:hover .tpl-card-arrow,
.tpl-card-item.active .tpl-card-arrow {
  color: #2563eb;
  transform: translateX(3px);
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--navy-primary);
  margin-bottom: 5px;
  font-weight: 600;
}

.input-styled {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  box-shadow: var(--shadow-sm);
}

.input-styled:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Enhanced Template Upload Card */
.tpl-upload-card {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: 0 4px 14px rgba(15, 43, 72, 0.05);
}

.tpl-upload-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.tpl-upload-icon-badge {
  font-size: 1.35rem;
  width: 36px;
  height: 36px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tpl-upload-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy-primary);
  margin-bottom: 2px;
}

.tpl-form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--navy-primary);
  margin-bottom: 6px;
}

.label-optional {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 500;
}

.label-req-pill {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 1px 6px;
  border-radius: 4px;
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-inline-icon {
  position: absolute;
  left: 12px;
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0.8;
}

.input-with-icon {
  padding-left: 36px !important;
}

/* Template File Dropzone */
.tpl-dropzone {
  background: #f8fafc;
  border: 1.8px dashed #93c5fd;
  border-radius: var(--radius-md);
  padding: 16px 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  outline: none;
  position: relative;
}

.tpl-dropzone:hover,
.tpl-dropzone:focus-visible,
.tpl-dropzone.dragover {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.tpl-dropzone.has-file {
  background: #f0fdf4;
  border-style: solid;
  border-color: #86efac;
  box-shadow: 0 2px 8px rgba(22, 101, 52, 0.06);
}

.tpl-drop-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.tpl-drop-icon-box {
  width: 44px;
  height: 44px;
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.08);
  transition: transform 0.2s ease;
}

.tpl-dropzone:hover .tpl-drop-icon-box {
  transform: scale(1.08);
}

.tpl-drop-text-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.tpl-drop-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--navy-primary);
}

.tpl-drop-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.tpl-browse-link {
  color: #2563eb;
  font-weight: 700;
  text-decoration: underline;
}

/* Selected File Box in Dropzone */
.tpl-drop-selected {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.tpl-file-badge {
  width: 40px;
  height: 40px;
  background: var(--navy-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(15, 43, 72, 0.25);
}

.tpl-file-badge-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  color: #ffffff;
}

.tpl-file-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.tpl-selected-filename {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--navy-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tpl-selected-filesize {
  font-size: 0.72rem;
  color: #166534;
  font-weight: 600;
}

.btn-tpl-remove {
  background: #ffffff;
  border: 1px solid #fca5a5;
  color: #dc2626;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-tpl-remove:hover {
  background: #fef2f2;
  border-color: #ef4444;
  transform: scale(1.1);
}

.btn-scan-template {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.btn-scan-icon {
  font-size: 1rem;
}

/* Guide Accordion */
.guide-accordion {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.guide-summary {
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--navy-primary);
}

.guide-content {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.guide-content ul {
  padding-left: 18px;
  margin-top: 6px;
}

.guide-content li {
  margin-bottom: 4px;
}

/* Template Inspection Header */
.template-detail-card {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.template-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* Detected Fields Grid */
.summary-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.detected-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.detected-field-badge {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.df-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.df-token {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--blue-royal);
}

.df-type-tag {
  font-size: 0.68rem;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-muted);
}

.df-loc {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Template Document Preview Container & Tables */
.template-doc-preview-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #edf2f7;
  border-radius: var(--radius-md);
  padding: 16px;
  box-sizing: border-box;
}

#template-doc-preview {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

#template-doc-preview table {
  max-width: 100% !important;
  word-break: break-word !important;
}

/* Unified Toast Popup (Glassmorphic Navy with Icons & Crisp Shadows) */
.toast-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(15, 43, 72, 0.96);
  color: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(10, 25, 47, 0.45), 0 0 0 1px rgba(191, 219, 254, 0.25);
  backdrop-filter: blur(12px);
  z-index: 100000;
  animation: slideUpToast 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 440px;
  overflow: hidden;
}

.toast-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #10b981;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}

.toast-popup.toast-error .toast-icon {
  background: #ef4444;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
}

.toast-popup.toast-info .toast-icon {
  background: #3b82f6;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
}

.toast-message {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.4;
  color: #f8fafc;
  flex: 1;
}

.toast-close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.toast-close-btn:hover {
  color: #ffffff;
}

@keyframes slideUpToast {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Unified Modal Custom Styles */
.unified-modal-backdrop {
  z-index: 99999 !important;
}

.unified-modal-card {
  max-width: 440px;
  animation: scaleInCard 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid #bfdbfe;
}

.modal-icon-danger {
  background: #fef2f2 !important;
  border-color: #fecaca !important;
  color: #dc2626 !important;
}

.modal-icon-danger svg {
  color: #dc2626 !important;
}

.modal-icon-warning {
  background: #fffbeb !important;
  border-color: #fde68a !important;
  color: #d97706 !important;
}

.modal-icon-warning svg {
  color: #d97706 !important;
}

.modal-icon-info {
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
  color: #2563eb !important;
}

.modal-icon-info svg {
  color: #2563eb !important;
}

.modal-icon-success {
  background: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
  color: #16a34a !important;
}

.modal-icon-success svg {
  color: #16a34a !important;
}

.unified-modal-text {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Admin Auth Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 47, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 60px rgba(15, 43, 72, 0.25);
  text-align: center;
}

.modal-icon {
  font-size: 2.4rem;
  width: 60px;
  height: 60px;
  margin: 0 auto 18px;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-royal);
}

.modal-icon svg {
  color: var(--blue-royal);
}

.modal-card h3 {
  font-size: 1.35rem;
  margin-bottom: 8px;
  color: var(--navy-primary);
}

.modal-card p {
  margin-bottom: 20px;
  color: var(--text-muted);
}

.modal-card .field-group {
  text-align: left;
  margin-bottom: 16px;
}

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

.modal-actions .btn {
  flex: 1;
}

/* ==========================================================
   MOBILE WORKSPACE SWITCHER (Segmented Control for Phones)
   ========================================================== */
.mobile-workspace-switcher {
  display: none;
  width: 100%;
  background: #e2e8f0;
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  gap: 6px;
  box-shadow: inset 0 1px 3px rgba(15, 43, 72, 0.08);
  box-sizing: border-box;
}

.btn-mobile-switch {
  flex: 1 1 0%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-mobile-switch:hover {
  color: var(--navy-primary);
  background: rgba(255, 255, 255, 0.5);
}

.btn-mobile-switch.active {
  background: #ffffff;
  color: var(--navy-primary);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(15, 43, 72, 0.12);
}

.switch-icon {
  font-size: 0.95rem;
}

/* ==========================================================
   APPLICATION GLOBAL FOOTER
   ========================================================== */
.app-footer {
  flex-shrink: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
  padding: 12px 24px;
  margin-top: auto;
  z-index: 20;
  text-align: center;
  box-sizing: border-box;
}

.footer-container {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.footer-copy {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--navy-primary);
  letter-spacing: -0.01em;
  text-align: center;
}

/* ==========================================================
   DESKTOP & LAPTOP (>= 1024px) 100VH WORKSTATION
   ========================================================== */
@media (min-width: 1024px) {
  body.review-active {
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.review-active .topbar {
    flex-shrink: 0 !important;
    padding: 8px 24px !important;
    position: static !important;
  }

  body.review-active main {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    padding: 6px 18px 4px !important;
    margin: 0 auto !important;
    width: 99% !important;
    max-width: 1920px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  body.review-active #view-profile,
  body.review-active #cv-review-step {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  body.review-active .review-toolbar {
    flex-shrink: 0 !important;
    padding: 6px 16px !important;
    margin-bottom: 6px !important;
    gap: 8px !important;
    border-radius: var(--radius-md) !important;
  }

  body.review-active .toolbar-title-group h2 {
    font-size: 1.1rem !important;
  }

  body.review-active .workspace-grid {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(350px, 420px) 1fr !important;
    gap: 12px !important;
    align-items: stretch !important;
    overflow: hidden !important;
  }

  body.review-active .panel {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  body.review-active .field-inspector-panel {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    position: static !important;
    overflow-y: auto !important;
    padding: 12px 16px !important;
  }

  body.review-active .document-preview-panel {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  body.review-active .preview-controls-header {
    flex-shrink: 0 !important;
    padding: 6px 14px !important;
  }

  body.review-active .preview-edit-banner {
    flex-shrink: 0 !important;
    padding: 6px 14px !important;
  }

  body.review-active .doc-viewport-wrap {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: auto !important;
    padding: 10px 16px !important;
  }

  body.review-active .app-footer {
    flex-shrink: 0 !important;
    padding: 4px 20px !important;
    margin-top: 0 !important;
  }

  body.review-active .footer-copy {
    font-size: 0.76rem !important;
  }

  /* Desktop always displays both panels side-by-side */
  .workspace-grid .field-inspector-panel,
  .workspace-grid .document-preview-panel {
    display: flex !important;
  }
}

/* ----------------------------------------------------------
   LAPTOPS (1024px to 1399px)
   ---------------------------------------------------------- */
@media (max-width: 1399px) and (min-width: 1024px) {
  body.review-active .workspace-grid {
    grid-template-columns: minmax(320px, 360px) 1fr !important;
    gap: 10px !important;
  }
  
  body.review-active .review-toolbar {
    padding: 6px 12px !important;
  }

  .core-fields-grid {
    grid-template-columns: 1fr !important;
  }

  body.review-active .preview-controls-header,
  .preview-controls-header {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px 12px !important;
    padding: 8px 14px !important;
  }

  .preview-title-badge {
    flex: 0 0 auto !important;
  }

  .preview-actions {
    flex: 0 0 auto !important;
    margin-left: auto !important;
  }

  .geco-format-selector {
    order: 3 !important;
    width: 100% !important;
    justify-content: space-between !important;
    padding: 3px 8px !important;
    gap: 8px !important;
    box-sizing: border-box !important;
  }

  .geco-format-selector .format-label {
    font-size: 0.72rem !important;
  }

  .geco-format-selector .format-buttons {
    flex: 1 1 auto !important;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4px !important;
  }

  .btn-format {
    justify-content: center !important;
    padding: 5px 8px !important;
    font-size: 0.72rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

/* ----------------------------------------------------------
   TABLETS & MEDIUM SCREENS (769px to 1023px)
   ---------------------------------------------------------- */
@media (max-width: 1023px) and (min-width: 769px) {
  body.review-active {
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  body.review-active .topbar {
    flex-shrink: 0 !important;
    padding: 8px 16px !important;
    position: static !important;
  }

  body.review-active main {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    padding: 6px 14px 4px !important;
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
  }

  body.review-active #view-profile,
  body.review-active #cv-review-step {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  body.review-active .review-toolbar {
    flex-shrink: 0 !important;
    padding: 6px 12px !important;
    margin-bottom: 6px !important;
  }

  body.review-active .workspace-grid {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(280px, 350px) 1fr !important;
    gap: 10px !important;
    overflow: hidden !important;
  }

  body.review-active .panel {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  body.review-active .field-inspector-panel {
    flex: 1 1 0% !important;
    height: 100% !important;
    max-height: 100% !important;
    position: static !important;
    overflow-y: auto !important;
    padding: 12px 14px !important;
    display: flex !important;
  }

  body.review-active .document-preview-panel {
    flex: 1 1 0% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  body.review-active .doc-viewport-wrap {
    flex: 1 1 0% !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: auto !important;
    padding: 10px 14px !important;
  }

  body.review-active .app-footer {
    flex-shrink: 0 !important;
    padding: 4px 16px !important;
    margin-top: 0 !important;
  }

  .topbar {
    padding: 10px 20px;
    gap: 12px;
  }

  .brand-sub {
    font-size: 0.68rem;
  }

  .upload-2panel-card {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 28px;
    margin: 16px auto;
  }

  .hero-layout {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }

  .hero-content {
    align-items: center;
  }

  .hero-badge-wrap,
  .hero-feature-pills,
  .hero-actions,
  .trust-stars,
  .trust-tags {
    justify-content: center;
  }

  .visual-canvas {
    max-width: 460px;
    margin: 0 auto;
  }

  .templates-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .preview-controls-header {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px 12px !important;
    padding: 10px 14px !important;
  }

  .geco-format-selector {
    order: 3 !important;
    width: 100% !important;
    justify-content: space-between !important;
  }

  .geco-format-selector .format-buttons {
    flex: 1 1 auto !important;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .btn-format {
    justify-content: center !important;
    padding: 6px 10px !important;
    font-size: 0.74rem !important;
  }

  .hero-bottom-bar {
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px !important;
    text-align: center !important;
  }

  .hbb-items {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 6px 10px !important;
  }
}

/* ----------------------------------------------------------
   MOBILE PHONES & SMALL SCREENS (<= 768px)
   Complete elimination of overlaps, sticky collisions & cutoffs
   ---------------------------------------------------------- */
@media (max-width: 768px) {
  /* 1. NON-STICKY TOPBAR: Prevents headers from floating over card content */
  .topbar {
    position: static !important;
    padding: 8px 14px !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    box-shadow: 0 1px 4px rgba(15, 43, 72, 0.06) !important;
    background: #ffffff !important;
    backdrop-filter: none !important;
  }

  /* Row 1: Brand on Left, Role Switcher on Right */
  .topbar-left {
    flex: 0 0 auto !important;
  }

  .brand {
    gap: 8px !important;
  }

  .brand-logo-img {
    width: 30px !important;
    height: 30px !important;
    border-radius: 6px !important;
  }

  .brand-text h1 {
    font-size: 0.95rem !important;
  }

  .brand-sub {
    display: none !important;
  }

  .topbar-right {
    flex: 0 0 auto !important;
    margin-left: auto !important;
  }

  .role-selector-wrap {
    padding: 2px 6px 2px 6px !important;
    gap: 6px !important;
    margin-left: 0 !important;
  }

  .user-session-indicator {
    gap: 5px !important;
  }

  .user-avatar-wrap {
    width: 24px !important;
    height: 24px !important;
    font-size: 0.74rem !important;
  }

  .user-session-label {
    font-size: 0.50rem !important;
  }

  .role-tag {
    font-size: 0.70rem !important;
    padding: 0 !important;
  }

  #btn-portal-return {
    padding: 3px 7px !important;
    font-size: 0.68rem !important;
  }


  /* 2. MAIN CONTAINER */
  main {
    padding: 10px 12px 32px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
  }

  /* When CV Review is active on mobile (<= 768px), lock 100vh workstation layout to maximize space */
  body.review-active {
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  body.review-active .topbar {
    flex-shrink: 0 !important;
    padding: 4px 10px !important;
    position: static !important;
    gap: 4px !important;
  }

  body.review-active .topbar-main-row {
    margin-bottom: 0 !important;
  }


  body.review-active main {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    padding: 4px 8px 2px !important;
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
  }

  body.review-active #view-profile,
  body.review-active #cv-review-step {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* 3. LANDING PORTAL ON MOBILE */
  #view-portal {
    padding: 10px 10px 24px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .hero-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .hero-layout {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    width: 100% !important;
    text-align: center !important;
  }

  .hero-content {
    align-items: center !important;
    width: 100% !important;
  }

  .hero-badge-wrap {
    display: flex !important;
    justify-content: center !important;
  }

  .hero-title {
    font-size: 1.55rem !important;
    line-height: 1.25 !important;
    margin-bottom: 12px !important;
    text-align: center !important;
  }

  .hero-feature-pills {
    justify-content: center !important;
    gap: 6px !important;
    margin-bottom: 12px !important;
  }

  .hero-pill {
    font-size: 0.72rem !important;
    padding: 3px 8px !important;
  }

  .hero-description {
    text-align: center !important;
    font-size: 0.86rem !important;
    line-height: 1.48 !important;
    max-width: 480px !important;
    margin: 0 auto 18px !important;
  }

  .hero-actions {
    flex-direction: column !important;
    width: 100% !important;
    max-width: 380px !important;
    margin: 0 auto 18px !important;
    gap: 10px !important;
  }

  .btn-hero-primary,
  .btn-hero-secondary {
    width: 100% !important;
    justify-content: center !important;
    padding: 13px 18px !important;
    font-size: 0.9rem !important;
    box-sizing: border-box !important;
  }

  .visual-canvas {
    max-width: 100% !important;
    width: 100% !important;
    overflow: hidden !important;
    margin: 8px auto 0 !important;
    position: relative !important;
  }

  .float-card-tags {
    top: 4px !important;
    right: 4px !important;
    width: 150px !important;
    padding: 6px 8px !important;
  }

  .float-card-accuracy {
    top: 8px !important;
    left: 4px !important;
    padding: 6px 10px !important;
  }

  .float-card-status {
    bottom: 4px !important;
    right: 4px !important;
    padding: 6px 10px !important;
  }

  .trust-stars,
  .trust-tags {
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    font-size: 0.72rem !important;
  }

  /* 4. STEP 1 UPLOAD FORM ON MOBILE */
  .upload-2panel-card {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    margin: 8px auto 20px !important;
    padding: 16px 14px !important;
    border-radius: var(--radius-md) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .flow-header-left h2 {
    font-size: 1.25rem !important;
  }

  .upload-panel-left,
  .upload-panel-right {
    gap: 12px !important;
    width: 100% !important;
  }

  .template-select-box {
    padding: 12px 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .template-select-box select {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    font-size: 0.84rem !important;
  }

  .upload-instructions-box,
  .file-format-restriction-card {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .file-format-restriction-card {
    padding: 12px !important;
  }

  .choice-row {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .template-choice-card {
    width: 100% !important;
    padding: 12px 14px !important;
  }

  .format-buttons-sm {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  .btn-format-sm {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
  }

  .dropzone {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 20px 12px !important;
    min-height: 180px !important;
  }

  .dropzone-file-info {
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    word-break: break-all !important;
  }

  #btn-start-extraction {
    width: 100% !important;
    padding: 14px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  /* 5. STEP 2 REVIEW WORKSTATION ON MOBILE */
  /* Review Toolbar */
  .review-toolbar,
  body.review-active .review-toolbar {
    padding: 6px 10px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    margin-bottom: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
  }

  .toolbar-left {
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    flex-wrap: wrap !important;
  }

  .toolbar-left #btn-back-to-upload {
    align-self: auto !important;
    padding: 4px 8px !important;
    font-size: 0.76rem !important;
  }

  .toolbar-title-group {
    width: 100% !important;
  }

  .toolbar-title-group h2,
  body.review-active .toolbar-title-group h2 {
    font-size: 0.92rem !important;
    line-height: 1.2 !important;
  }

  .toolbar-meta {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
  }

  .meta-pill {
    font-size: 0.68rem !important;
    padding: 2px 7px !important;
  }

  .toolbar-right {
    width: 100% !important;
  }

  #btn-download-docx {
    width: 100% !important;
    justify-content: center !important;
    padding: 8px 12px !important;
    font-size: 0.82rem !important;
    box-sizing: border-box !important;
  }

  /* Mobile Segmented Workspace Switcher: Visible on <= 768px */
  .mobile-workspace-switcher,
  body.review-active .mobile-workspace-switcher {
    display: flex !important;
    width: 100% !important;
    background: #e2e8f0 !important;
    padding: 3px !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 6px !important;
    gap: 4px !important;
    box-shadow: inset 0 1px 3px rgba(15, 43, 72, 0.08) !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
  }

  .btn-mobile-switch {
    flex: 1 1 0% !important;
    padding: 6px 4px !important;
    font-size: 0.76rem !important;
    font-weight: 600 !important;
    border-radius: var(--radius-sm) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
  }

  /* Workspace Grid on Mobile (<= 768px) */
  .workspace-grid,
  body.review-active .workspace-grid {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    width: 100% !important;
    margin: 0 !important;
    gap: 6px !important;
    display: flex !important;
    flex-direction: column !important;
  }

  body.review-active .panel {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border-radius: var(--radius-md) !important;
  }

  /* Candidate Info View (Default) */
  .workspace-grid[data-mobile-view="inspector"],
  body.review-active .workspace-grid[data-mobile-view="inspector"] {
    display: flex !important;
    flex-direction: column !important;
  }

  .workspace-grid[data-mobile-view="inspector"] .field-inspector-panel,
  body.review-active .workspace-grid[data-mobile-view="inspector"] .field-inspector-panel {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 8px 10px !important;
    box-sizing: border-box !important;
    position: static !important;
  }

  .workspace-grid[data-mobile-view="inspector"] .document-preview-panel,
  body.review-active .workspace-grid[data-mobile-view="inspector"] .document-preview-panel {
    display: none !important;
  }

  /* Template Preview View */
  .workspace-grid[data-mobile-view="preview"],
  body.review-active .workspace-grid[data-mobile-view="preview"] {
    display: flex !important;
    flex-direction: column !important;
  }

  .workspace-grid[data-mobile-view="preview"] .field-inspector-panel,
  body.review-active .workspace-grid[data-mobile-view="preview"] .field-inspector-panel {
    display: none !important;
  }

  .workspace-grid[data-mobile-view="preview"] .document-preview-panel,
  body.review-active .workspace-grid[data-mobile-view="preview"] .document-preview-panel {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  /* Split View (Side-by-Side on Mobile / Tablets) */
  .workspace-grid[data-mobile-view="split"],
  body.review-active .workspace-grid[data-mobile-view="split"] {
    display: grid !important;
    grid-template-columns: minmax(180px, 34%) 1fr !important;
    gap: 8px !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .workspace-grid[data-mobile-view="split"] .field-inspector-panel,
  body.review-active .workspace-grid[data-mobile-view="split"] .field-inspector-panel {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 6px 8px !important;
    box-sizing: border-box !important;
    position: static !important;
  }

  .workspace-grid[data-mobile-view="split"] .document-preview-panel,
  body.review-active .workspace-grid[data-mobile-view="split"] .document-preview-panel {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  /* Candidate Form Fields on mobile */
  .field-inspector-panel {
    padding: 8px 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .field-inspector-panel .panel-header {
    padding: 4px 0 8px !important;
  }

  .field-inspector-panel .panel-header #btn-toggle-cv-source {
    width: 100% !important;
    justify-content: center !important;
    font-size: 0.78rem !important;
    padding: 6px 10px !important;
  }

  .core-candidate-card {
    margin: 6px 0 !important;
    padding: 10px 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .core-fields-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .core-input-wrap {
    height: 38px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .core-text-input {
    font-size: 0.86rem !important;
    width: 100% !important;
  }

  .preview-edit-guidance-card {
    margin: 6px 0 10px !important;
    padding: 10px 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .btn-guidance-edit {
    width: 100% !important;
    padding: 8px 10px !important;
    justify-content: center !important;
    font-size: 0.84rem !important;
  }

  /* Document Preview Controls Header on mobile */
  .panel-header.preview-controls-header,
  .document-preview-panel .preview-controls-header,
  body.review-active .preview-controls-header,
  .preview-controls-header {
    padding: 10px 12px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .preview-title-badge {
    display: flex !important;
    justify-content: space-between !important;
    width: 100% !important;
  }

  .geco-format-selector {
    width: 100% !important;
    box-sizing: border-box !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    padding: 8px 10px !important;
  }

  .format-buttons {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 4px !important;
  }

  .btn-format {
    width: 100% !important;
    justify-content: center !important;
    padding: 8px 10px !important;
    font-size: 0.74rem !important;
    white-space: normal !important;
    text-align: center !important;
  }

  .preview-actions {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 4px !important;
    flex-wrap: wrap !important;
  }

  .zoom-group {
    width: 100% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 3px !important;
    padding: 3px 4px !important;
    background: #f1f5f9 !important;
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border) !important;
    box-sizing: border-box !important;
  }

  .zoom-group .btn-icon-btn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    font-size: 0.9rem !important;
    border-radius: var(--radius-sm) !important;
  }

  .zoom-group .zoom-text {
    min-width: 34px !important;
    font-size: 0.74rem !important;
    padding: 0 2px !important;
  }

  .zoom-group .zoom-divider {
    height: 16px !important;
    margin: 0 1px !important;
  }

  .zoom-group .btn-zoom-action {
    padding: 0 8px !important;
    font-size: 0.74rem !important;
    height: 28px !important;
    gap: 4px !important;
    border-radius: var(--radius-sm) !important;
  }

  .preview-edit-banner {
    padding: 10px 12px !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .edit-banner-tools {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .edit-banner-tools .btn {
    flex: 1 1 auto !important;
    min-width: 100px !important;
    text-align: center !important;
    justify-content: center !important;
  }

  .doc-viewport-wrap,
  body.review-active .doc-viewport-wrap {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    padding: 6px 4px !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* 6. TEMPLATE MANAGER ON MOBILE */
  .templates-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    width: 100% !important;
  }

  .template-sidebar,
  .template-detail-card {
    padding: 16px 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .form-group input,
  .form-group select {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  #btn-upload-template,
  #btn-scan-template {
    width: 100% !important;
    justify-content: center !important;
    padding: 12px !important;
    box-sizing: border-box !important;
  }

  .template-detail-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .header-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .header-actions .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  .detected-fields-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .fields-table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .template-doc-preview-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 10px 8px !important;
    box-sizing: border-box !important;
  }

  #template-doc-preview {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
  }

  #template-doc-preview table {
    width: 100% !important;
    max-width: 100% !important;
    word-break: break-word !important;
    table-layout: auto !important;
  }

  /* 7. MODALS ON MOBILE */
  .modal-card {
    width: calc(100% - 24px) !important;
    max-width: 100% !important;
    margin: 12px !important;
    padding: 22px 16px !important;
    border-radius: var(--radius-lg) !important;
  }

  .modal-actions {
    flex-direction: column-reverse !important;
    gap: 8px !important;
  }

  .modal-actions .btn {
    width: 100% !important;
    padding: 12px !important;
  }

  /* 7b. PROCESSING OVERLAY MODAL ON MOBILE */
  .geco-loading-card {
    padding: 20px 16px !important;
    width: calc(100% - 24px) !important;
    max-width: 100% !important;
    margin: 12px auto !important;
    gap: 12px !important;
  }

  .geco-loading-titles h3 {
    font-size: 1.3rem !important;
  }

  .geco-loading-titles p {
    font-size: 0.8rem !important;
  }

  .prog-step {
    padding: 8px 10px !important;
    font-size: 0.78rem !important;
  }

  /* 8. TOASTS ON MOBILE */
  .toast-popup {
    left: 12px !important;
    right: 12px !important;
    bottom: 12px !important;
    font-size: 0.8rem !important;
    padding: 10px 14px !important;
    text-align: center !important;
  }

  /* 9. FOOTER ON MOBILE */
  .app-footer {
    padding: 10px 14px !important;
    position: static !important;
    margin-top: 24px !important;
  }

  body.review-active .app-footer {
    flex-shrink: 0 !important;
    padding: 3px 12px !important;
    position: static !important;
    margin-top: 0 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    border-top: 1px solid var(--border) !important;
    box-sizing: border-box !important;
  }

  .footer-copy {
    font-size: 0.74rem !important;
  }

  body.review-active .footer-copy {
    font-size: 0.72rem !important;
    margin: 0 !important;
  }
}

/* ----------------------------------------------------------
   EXTRA SMALL SCREENS (<= 380px)
   ---------------------------------------------------------- */
@media (max-width: 380px) {
  .hero-title {
    font-size: 1.35rem !important;
  }

  .btn-format {
    font-size: 0.7rem !important;
    padding: 6px !important;
  }

  .zoom-text {
    min-width: 32px !important;
    font-size: 0.72rem !important;
  }

  .btn-zoom-action {
    padding: 0 4px !important;
    font-size: 0.68rem !important;
  }
}

/* ==========================================================
   ADAPTIVE REVIEW / EDIT-ON-PREVIEW (phones & small tablets)
   Compacts the preview controls so the document gets the space
   ========================================================== */
@media (max-width: 768px) {
  /* The preview panel scrolls as a whole; the page itself keeps a usable height */
  .workspace-grid[data-mobile-view="preview"] .document-preview-panel,
  body.review-active .workspace-grid[data-mobile-view="preview"] .document-preview-panel {
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .document-preview-panel .doc-viewport-wrap,
  body.review-active .document-preview-panel .doc-viewport-wrap {
    flex: 1 0 auto !important;
    height: auto !important;
    max-height: none !important;
    min-height: 60vh !important;
    min-height: 60dvh !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    padding: 6px 0 !important;
  }

  /* Compact header: title + save on one line, zoom controls on one line */
  .document-preview-panel .preview-controls-header {
    padding: 6px 8px !important;
    gap: 6px !important;
  }
  .document-preview-panel .preview-title-badge {
    font-size: 0.78rem !important;
  }
  .document-preview-panel .preview-actions {
    flex-wrap: nowrap !important;
    gap: 6px !important;
  }
  .document-preview-panel .preview-actions #btn-sync-preview-edits {
    flex: 0 0 auto !important;
    padding: 4px 8px !important;
    font-size: 0.72rem !important;
  }
  .document-preview-panel .zoom-group {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  /* Edit banner: short, with the four insert tools in a 2x2 grid */
  .document-preview-panel .preview-edit-banner {
    padding: 6px 8px !important;
    gap: 6px !important;
  }
  .document-preview-panel .edit-banner-info {
    font-size: 0.72rem !important;
    line-height: 1.3 !important;
  }
  .document-preview-panel .edit-banner-tools {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 5px !important;
  }
  .document-preview-panel .edit-banner-tools .btn {
    min-width: 0 !important;
    padding: 6px 4px !important;
    font-size: 0.7rem !important;
    white-space: normal !important;
    line-height: 1.2 !important;
  }
}

/* Short landscape phones: keep the document large, tools tiny */
@media (max-width: 900px) and (max-height: 520px) {
  .document-preview-panel .doc-viewport-wrap,
  body.review-active .document-preview-panel .doc-viewport-wrap {
    min-height: 85vh !important;
  }
}
