/* ── Document Review v5 — Professional Aesthetics & CRUD ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-secondary: #64748b;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #eef2ff;
  --success: #10b981;
  --error: #ef4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 24px;
  --radius-xl: 40px;
  --topbar-h: 64px;
}

html,
body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

body {
  overflow-x: hidden;
  overflow-y: auto;
}

/* Allow scrolling on landing; JS will lock for workspace */

/* Global Tool Cursors */
[data-active-tool="select"] .viewer,
[data-active-tool="select"] .pdf-page:hover,
[data-active-tool="select"] .docx-content:hover,
[data-active-tool="select"] .xlsx-sheet:hover,
[data-active-tool="select"] .fabric-canvas:hover {
  cursor: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0iYmxhY2siIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNSAzbDMuMDU3IDE0Ljk0MyAzLjMzMy01LjMzMyA0LjYxIDQuMzkgMi0yLTQuNjEtNC4zOSA1LjMzMy0zLjMzM3oiIC8+PC9zdmc+'), auto;
}

[data-active-tool="hl"] .viewer {
  cursor: default;
}
[data-active-tool="hl"] .textLayer span {
  cursor: text;
}

/* Pen tool handled by crosshair default */

[data-active-tool="pen"] .viewer {
  cursor: crosshair;
}

[data-active-tool="rect"] .viewer {
  cursor: crosshair;
}

[data-active-tool="circle"] .viewer {
  cursor: crosshair;
}

[data-active-tool="eraser"] .viewer {
  cursor: url('data:image/svg+xml;utf8,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" xmlns="http://www.w3.org/2000/svg"><path d="M20 20H7L3 16L10 9L21 20H20Z" stroke="%2364748b"/></svg>'), auto;
}

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar__logo {
  text-decoration: none;
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__logo b {
  color: var(--accent);
}

.topbar__title {
  font-size: 14px;
  color: var(--text-secondary);
  margin-left: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

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

.tool-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.tool-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.tool-btn svg {
  width: 20px;
  height: 20px;
}

.tool-btn.has-child {
  width: 42px;
  gap: 4px;
}

.dropdown-icon {
  width: 10px;
  height: 10px;
  opacity: 0.5;
}

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

.tool-group {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}

.zoom-label {
  font-size: 12px;
  font-weight: 600;
  padding: 0 6px;
  min-width: 44px;
  text-align: center;
}

.topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  background: #fff;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  outline: none;
  position: relative;
  user-select: none;
}

.tb-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #fdfdfd;
  box-shadow: 0 4px 12px rgba(79, 70, 233, 0.1);
  transform: translateY(-1px);
}

.tb-btn:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.tb-btn:active {
  transform: translateY(0) scale(0.96);
  opacity: 0.9;
}

.tb-btn svg {
  transition: transform 0.2s;
}

.tb-btn:hover svg {
  transform: translateY(-1px);
}

.tb-count {
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
}

/* WORKSPACE */
.workspace {
  display: flex;
  height: calc(100vh - var(--topbar-h));
}

.viewer {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
  background: #f1f5f9;
  scroll-behavior: smooth;
}

.viewer__body {
  max-width: 1000px;
  margin: 0 auto;
  position: relative;
}

.pdf-page,
.docx-content,
.xlsx-sheet {
  background: #fff;
  margin-bottom: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  position: relative;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0.2, 1);
}

.pdf-page canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: -webkit-optimize-contrast;
  /* Crucial for iOS Safari sharpness */
  image-rendering: crisp-edges;
  -webkit-font-smoothing: antialiased;
}

.docx-content,
.xlsx-sheet {
  padding: 40px;
  min-height: 800px;
}

/* ── INTERACTION LAYERS ── */
.textLayer {
  position: absolute;
  inset: 0;
  opacity: 1;
  z-index: 20;
  pointer-events: auto;
  line-height: 1;
  overflow: hidden;
}

.textLayer>span {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0 0;
}

.textLayer>span::selection {
  background: rgba(99, 102, 241, 0.2);
  border-bottom: 2px solid var(--accent);
}

.hl-mark-group {
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0.38;
  transition: opacity 0.15s ease;
}

.hl-mark-group:hover {
  opacity: 0.55;
}

.hl-rect {
  position: absolute;
  pointer-events: none;
  border-radius: 3px;
}

/* NEW PROFESSIONAL PIN DESIGN */
.pin-anchor {
  position: absolute;
  pointer-events: none;
  z-index: 31;
}

/* PIN PIN POSITIONING: TOP-RIGHT CORNER */
.note-pin {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 4px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%), var(--pin-bg, #ef4444);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.25),
    0 0 0 2px #fff,
    inset 0 1px 1px rgba(255,255,255,0.4);
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
  transform: translate(-50%, -50%); /* Centered on the anchor point */
  animation: pinEnter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  z-index: 1000;
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

@keyframes pinEnter {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.5) rotate(-20deg); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

.note-pin:hover {
  transform: translate(-50%, -50%) scale(1.15) !important;
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.35),
    0 0 0 2.5px #fff,
    inset 0 1px 1px rgba(255,255,255,0.4);
}

@keyframes pinFade {
  from {
    opacity: 0;
    transform: translate(-100%, -110%) scale(0.8);
  }

  to {
    opacity: 1;
    transform: translate(-100%, -100%) scale(1);
  }
}

.note-pin:hover {
  transform: translate(-100%, -100%) scale(1.15);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), 0 0 0 2px #fff;
}

/* POPUPS - SaaS PREMIUM REFINEMENT */
.comment-box,
.note-popup {
  position: fixed;
  width: 340px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 999999 !important;
  overflow: hidden;
  animation: popSaaS 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  border: none;
  pointer-events: auto !important;
  user-select: text !important;
  -webkit-user-select: text !important;
}

@keyframes popSaaS {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(15px);
  }
}

.comment-box__head,
.note-popup__head {
  padding: 14px 18px;
  background: #1e293b;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
}

.comment-box__head span,
.note-popup__head span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.note-popup__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.np-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  color: #cbd5e1;
  transition: all 0.2s;
}

.np-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.np-btn--del:hover {
  background: #ef4444;
  color: #fff;
}

.btn-close {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-close:hover {
  background: #ef4444;
  color: #fff;
}

.comment-box__body,
.note-popup__body {
  padding: 20px;
  font-size: 14px;
  color: #334155;
  line-height: 1.6;
}

.note-popup__meta {
  margin-top: 12px;
  font-size: 11px;
  color: #94a3b8;
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
}

.comment-box__body textarea,
.edit-area {
  width: 100%;
  height: 120px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s;
  resize: none;
  color: #1e293b;
}

.comment-box__body textarea:focus,
.edit-area:focus {
  border-color: #4f46e5;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.comment-box__foot {
  padding: 0 20px 20px;
  display: flex;
  justify-content: flex-end;
}

.cb-done {
  background: #4f46e5;
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(79, 70, 233, 0.3);
}

.cb-done:hover {
  background: #4338ca;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 233, 0.4);
}

.edit-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

/* SIDEBAR */
.panel {
  width: 320px;
  background: #fff;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

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

.panel__head h3 {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.note-item {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  display: flex;
  gap: 14px;
  transition: all 0.2s;
  background: #fff;
  position: relative;
}

.note-item:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

.note-item__id {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.note-item__type-icon {
  position: absolute;
  bottom: 12px;
  left: 12px;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  font-size: 8px;
  color: var(--text-secondary);
}

.note-item__text strong {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
  line-height: 1.4;
}

.note-item__text p {
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* MISC */
.zoom-container {
  transform-origin: top left;
  transition: transform 0.2s;
}

.mob-page-nav {
  display: none;
}

/* Mobile-only feature */
.status-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  display: none;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 700;
  z-index: 500;
}

.status-bar.visible {
  display: flex;
}

/* Desktop Toast */
.desktop-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e293b;
  color: #fff;
  padding: 12px 28px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  z-index: 3000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.loading {
  position: fixed;
  inset: 0;
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: blur(8px);
  z-index: 5000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.upload-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: calc(100vh - var(--topbar-h));
  background: var(--bg);
  overflow-y: auto;
  padding: 80px 24px;
  position: relative;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(99, 102, 241, 0.05) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(168, 85, 247, 0.05) 0px, transparent 50%);
}

.upload-screen::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 600px;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, var(--bg) 100%);
  pointer-events: none;
  z-index: 1;
}

.upload-box {
  width: 100%;
  max-width: 800px;
  padding: 80px 48px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-xl);
  text-align: center;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.02),
    0 20px 40px -4px rgba(0, 0, 0, 0.05),
    inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  position: relative;
  z-index: 10;
  margin-bottom: 60px;
}

.upload-box:hover {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 
    0 10px 15px -3px rgba(0, 0, 0, 0.02),
    0 40px 80px -10px rgba(0, 0, 0, 0.08);
}

.upload-box.dragover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.95);
  transform: scale(1.01);
  box-shadow: 0 40px 100px rgba(99, 102, 241, 0.1), 0 0 0 8px rgba(99, 102, 241, 0.05);
}

/* FORMAT BADGES */
.format-badges-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.format-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
}

.fb-pdf {
  background: #ef4444;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.fb-docx {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.fb-xlsx {
  background: #16a34a;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2);
}

/* IMMERSIVE DROP OVERLAY */
#drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(79, 70, 229, 0.1);
  backdrop-filter: blur(12px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

#drop-overlay.visible {
  display: flex;
  opacity: 1;
}

.drop-message {
  padding: 40px 80px;
  background: #fff;
  border-radius: 32px;
  box-shadow: 0 50px 100px rgba(0, 0, 0, 0.1);
  text-align: center;
  border: 2px dashed var(--accent);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#drop-overlay.visible .drop-message {
  transform: scale(1);
}

.drop-message svg {
  color: var(--accent);
  margin-bottom: 16px;
  width: 64px;
  height: 64px;
}

.drop-message h3 {
  font-size: 24px;
  font-weight: 900;
  color: #1e293b;
  margin: 0;
}

.upload-icon {
  width: 64px;
  height: 64px;
  background: #f1f5f9;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin: 0 auto 24px;
  transition: transform 0.3s;
}

.upload-box.dragover .upload-icon {
  transform: translateY(-10px) scale(1.1);
}

.hero-title-main {
  font-size: 48px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.05em;
  line-height: 1.1;
  margin-bottom: 24px;
}

.hero-subtitle-main {
  font-size: 18px;
  color: #64748b;
  margin-bottom: 48px;
  line-height: 1.6;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.upload-btn-premium {
  display: inline-flex;
  align-items: center;
  padding: 22px 48px;
  background: var(--accent);
  color: #fff;
  border-radius: 100px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 20px 40px rgba(79, 70, 229, 0.25);
}

.upload-btn-premium:hover {
  transform: translateY(-4px) scale(1.02);
  background: #4338ca;
  box-shadow: 0 30px 60px rgba(79, 70, 229, 0.35);
}

.upload-btn-premium:active {
  transform: translateY(0) scale(0.96);
  opacity: 0.9;
}

.feature-bar {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 48px 0;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.trust-badge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
  opacity: 0.6;
}

.trust-badge-row span {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.trust-badge-row svg {
  color: #10b981;
}

.upload-hint-premium {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 24px;
  display: block;
  font-weight: 500;
}

/* COLOR PICKER DROPDOWN */
.color-dropdown {
  position: fixed;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  z-index: 2000;
}

.picker-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s;
  border: 2px solid transparent;
}

.picker-swatch:hover {
  transform: scale(1.2);
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--border);
}

/* PIN POSITIONING OVERRIDE */
.note-pin {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 2px solid #fff;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform: translate(-20%, -80%);
  animation: pinDrop 0.3s forwards;
}

/* RICH TEXT EDITOR */
.cb-toolbar {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 12px 12px 0 0;
}

.cbt-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 800;
  font-size: 13px;
}

.cbt-btn:hover {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.cbt-btn.active {
  background: var(--accent);
  color: #fff;
}

.editable-area {
  min-height: 120px;
  padding: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #1e293b;
  outline: none;
  background: #fff;
  border: 1.5px solid transparent;
  border-radius: 0 0 12px 12px;
  transition: all 0.2s;
}

.editable-area:empty:before {
  content: attr(placeholder);
  color: #94a3b8;
  pointer-events: none !important;
}

.editable-area h1 {
  font-size: 18px;
  font-weight: 800;
  margin: 12px 0 6px;
  color: #0f172a;
}

.editable-area h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 10px 0 4px;
  color: #1e293b;
}

.editable-area b,
.editable-area strong {
  font-weight: 700;
}

.editable-area ul {
  padding-left: 20px;
  margin: 8px 0;
}

.editable-area li {
  margin-bottom: 4px;
}

/* REPORT RENDERING */
.report-comment h1 {
  font-size: 18px;
  font-weight: 800;
  margin: 12px 0 6px;
}

.report-comment h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 10px 0 4px;
}

.report-comment ul {
  padding-left: 20px;
  margin: 8px 0;
}

/* TAGS & WORKFLOW */
.tag-row {
  display: flex;
  gap: 6px;
  padding: 0 16px 12px;
  margin-top: -8px;
}

.np-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
  cursor: pointer;
  background: #f1f5f9;
  color: #475569;
  transition: all 0.2s;
}

.np-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.np-tag.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(79, 70, 233, 0.2);
}

.tag-critical {
  border-color: #fee2e2;
  color: #ef4444;
  background: #fef2f2;
}

.tag-legal {
  border-color: #e0f2fe;
  color: #0ea5e9;
  background: #f0f9ff;
}

.note-item.resolved {
  opacity: 0.6;
}

.note-item.resolved .note-item__id {
  background: #10b981 !important;
}

.note-item.resolved .report-comment {
  text-decoration: line-through;
  color: #94a3b8;
}

.status-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: auto;
}

.status-pending {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #ffedd5;
}

.status-done {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #d1fae5;
}

.hl-mark.resolved,
.hl-mark-group.resolved {
  opacity: 0.15 !important;
  mix-blend-mode: normal !important;
  filter: grayscale(1);
}

.note-pin.flash-highlight {
  animation: flash-pulse 1.5s ease-out;
  border-radius: 4px;
  position: relative;
  z-index: 10;
}

@keyframes flash-pulse {
  0% { background-color: rgba(79, 70, 229, 0.4); box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7); }
  70% { background-color: rgba(79, 70, 229, 0.1); box-shadow: 0 0 0 15px rgba(79, 70, 229, 0); }
  100% { background-color: transparent; box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

.resolved {
  opacity: 0.5;
  filter: grayscale(0.5);
  transition: all 0.3s ease;
}

/* SIGNATURE & DECISION */
.report-decision {
  margin-top: 60px;
  padding: 32px;
  border: 2px solid #1e293b;
  border-radius: 12px;
  background: #f8fafc;
  page-break-inside: avoid;
}

.rd-head {
  font-size: 18px;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 24px;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.rd-field {
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 8px;
}

.rd-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 20px;
  display: block;
}

.rd-val {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

.rd-sig {
  height: 60px;
  font-style: italic;
  font-family: 'Times New Roman', serif;
  display: flex;
  align-items: flex-end;
  font-size: 20px;
  color: #1e293b;
}

.export-report {
  padding: 40px;
  background: #fff;
  font-family: 'Inter', sans-serif;
  color: #1e293b;
  max-width: 850px;
  margin: 40px auto;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  page-break-before: always;
}

.report-header {
  border-bottom: 2px solid #1e293b;
  padding-bottom: 16px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.report-header h1 {
  font-size: 24px;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.report-header .date {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

.report-section {
  margin-bottom: 32px;
}

.report-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-left: 4px solid var(--accent);
  padding-left: 10px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.report-table th {
  text-align: left;
  background: #f8fafc;
  padding: 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e2e8f0;
  color: #64748b;
}

.report-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.5;
}

.report-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  margin-right: 12px;
  flex-shrink: 0;
}

.report-content-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-context {
  font-style: italic;
  color: #64748b;
  font-size: 12px;
  border-left: 2px solid #e2e8f0;
  padding-left: 8px;
  margin-bottom: 6px;
}

.report-comment {
  font-weight: 600;
  color: #1e293b;
  font-size: 14px;
}

.report-footer {
  margin-top: 50px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 500;
}

/* MODAL & SIGNATURE */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sig-container {
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  touch-action: none;
}

.sig-container .canvas-container {
  margin: 0 auto;
}

.sig-container canvas {
  cursor: crosshair;
  touch-action: none !important;
}

.verdict-btn {
  transition: all 0.2s;
}

.verdict-btn:hover {
  background: #f8fafc;
  transform: translateY(-1px);
  border-color: var(--accent) !important;
  color: var(--accent);
}

.verdict-console {
  animation: fadeIn 0.5s ease;
}

.status-badge {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── DOCUMENTATION & LANDING OVERHAUL ── */
.upload-screen {
  overflow-y: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  padding: 80px 24px !important;
  background: radial-gradient(circle at top left, #f8fafc, #f1f5f9) !important;
}

.hero-title-main {
  font-size: 48px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle-main {
  font-size: 18px;
  color: #64748b;
  max-width: 500px;
  margin: 0 auto 40px;
  line-height: 1.6;
}

.upload-actions-wrapper {
  margin-bottom: 32px;
}

.upload-btn-premium {
  display: inline-flex;
  align-items: center;
  padding: 18px 44px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 10px 25px -5px rgba(99, 102, 241, 0.4),
    0 8px 10px -6px rgba(99, 102, 241, 0.4);
}

.upload-btn-premium:hover {
  background: var(--accent-hover);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 20px 35px -5px rgba(99, 102, 241, 0.5),
    0 15px 15px -6px rgba(99, 102, 241, 0.5);
}

.feature-bar {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.upload-hint-premium {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 80px;
}

/* Docs Section Styles */
.docs-section {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 100px 0;
  position: relative;
  z-index: 10;
}

.docs-header {
  text-align: center;
  margin-bottom: 80px;
}

.docs-header h2 {
  font-size: 40px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.docs-header p {
  color: #64748b;
  font-size: 18px;
  max-width: 600px;
  margin: 0 auto;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.docs-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 40px;
  border-radius: var(--radius-lg);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.docs-card:hover {
  transform: translateY(-8px);
  border-color: var(--accent);
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.05), 0 18px 36px -18px rgba(0, 0, 0, 0.05);
}

.docs-card__icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  transition: transform 0.3s ease;
}

.docs-card:hover .docs-card__icon {
  transform: scale(1.1) rotate(3deg);
}

.docs-card h4 {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.docs-card p {
  color: #64748b;
  line-height: 1.7;
  font-size: 15px;
  margin-bottom: 20px;
}

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

.docs-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
  color: #64748b;
  font-size: 14px;
}

.docs-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 800;
}

.docs-list--ordered {
  padding-left: 20px;
}

.docs-list--ordered li {
  padding-left: 0;
  list-style-type: decimal;
}

.docs-list--ordered li::before {
  display: none;
}

/* LOADING OVERLAY */
.loading {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(8px);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--accent-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ICON BOXES - Professional SaaS Overhaul */
.docs-card__icon {
  width: 52px !important;
  height: 52px !important;
  border-radius: 14px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-bottom: 24px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
  transition: transform 0.2s ease !important;
}

.docs-card:hover .docs-card__icon {
  transform: scale(1.05) !important;
}

.icon-blue {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  color: #ffffff !important;
}

.icon-amber {
  background: linear-gradient(135deg, #eab308, #d97706) !important;
  color: #ffffff !important;
}

.icon-purple {
  background: linear-gradient(135deg, #a855f7, #9333ea) !important;
  color: #ffffff !important;
}

.icon-green {
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
  color: #ffffff !important;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE-FIRST RESPONSIVE SYSTEM
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --mob-topbar-h: 48px;
    --mob-toolbar-h: 56px;
    --mob-safe-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* ── iOS SAFARI: Prevent ALL auto-zoom behavior ── */
  /* touch-action: manipulation disables double-tap-to-zoom globally */
  html {
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    /* Prevent text size adjustment */
  }

  /* Prevent pinch/gesture zoom in the workspace area */
  .workspace,
  .viewer,
  .viewer__body,
  .pdf-page {
    touch-action: pan-x pan-y;
    -webkit-touch-callout: none;
  }

  /* All buttons/interactive: prevent double-tap zoom */
  button,
  .tool-btn,
  .mob-tool-btn,
  .tb-btn,
  .np-tag,
  .cbt-btn,
  .picker-swatch,
  .mob-color-swatch {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  /* Inputs must be >= 16px to prevent iOS auto-zoom on focus */
  input,
  textarea,
  select,
  [contenteditable="true"] {
    font-size: 16px !important;
    touch-action: manipulation;
  }

  /* ── TOPBAR: Compact scrollable row ── */
  .topbar {
    height: var(--mob-topbar-h);
    min-height: var(--mob-topbar-h);
    padding: 0 12px;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
  }

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

  .topbar__logo {
    font-size: 14px;
    flex-shrink: 0;
  }

  .topbar__logo img {
    width: 18px;
    height: 18px;
  }

  .topbar__title {
    display: block !important;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
    flex-shrink: 0;
    margin-left: 0px;
    opacity: 0.7;
  }

  .topbar__actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 0;
  }

  /* ── MOBILE PAGE NAV IN TOPBAR ── */
  .mob-page-nav {
    display: flex !important;
  }

  .mob-page-btn {
    width: 34px;
    height: 34px;
    background: #f1f5f9;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    padding: 0 !important;
    flex-shrink: 0;
  }

  .mob-page-btn:active:not(:disabled) {
    background: #e2e8f0;
    transform: scale(0.9);
  }

  .mob-page-btn:disabled {
    opacity: 0.3;
  }

  .mob-page-btn svg {
    width: 18px;
    height: 18px;
  }

  .mob-page-info {
    font-size: 12px;
    font-weight: 700;
    padding: 0 4px;
    min-width: 40px;
    text-align: center;
    color: var(--text-primary);
  }

  /* Hide desktop toolbar — mobile uses bottom bar */
  .swatches {
    display: none !important;
  }

  /* Action buttons: icon-only, compact */
  .topbar__actions {
    margin-left: auto;
    width: auto;
    border-top: none;
    padding-top: 0;
    margin-top: 0;
    gap: 4px;
  }

  .tb-btn {
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 12px;
    border-width: 1px;
  }

  .tb-btn span {
    display: none;
  }

  .tb-btn svg {
    width: 16px;
    height: 16px;
  }

  /* ── MOBILE TOPBAR ZOOM CONTROLS ── */
  .mob-zoom-controls {
    display: flex !important;
    margin-right: 6px;
  }

  #mob-zoom-out,
  #mob-zoom-in {
    background: #f1f5f9;
    border-radius: 8px;
    border: 1px solid var(--border);
    width: 34px;
    height: 34px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #mob-zoom-out svg,
  #mob-zoom-in svg {
    width: 18px;
    height: 18px;
  }

  /* ── FIX: On mobile, ALLOW native text selection for highlight mode ── */
  /* Desktop uses custom mousedown drag, but mobile needs native long-press + handles */


  /* Ensure text layers are selectable on mobile */
  .textLayer>span {
    -webkit-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
  }

  .rich-text-container,
  .docx-content,
  .xlsx-sheet {
    -webkit-user-select: text !important;
    user-select: text !important;
  }

  /* ── MOBILE FLOATING HIGHLIGHT BAR ── */
  .mob-hl-bar {
    position: fixed;
    z-index: 600;
    display: none;
    align-items: center;
    gap: 6px;
    background: #1e293b;
    border-radius: 14px;
    padding: 6px 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.08);
    animation: mobHlBarPop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .mob-hl-bar.visible {
    display: flex;
  }

  .mob-hl-bar::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: #1e293b;
    border-radius: 2px;
    transform: translateX(-50%) rotate(45deg);
    z-index: -1;
  }

  @keyframes mobHlBarPop {
    from {
      opacity: 0;
      transform: scale(0.85) translateY(8px);
    }

    to {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
  }

  .mob-hl-btn {
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
  }

  .mob-hl-btn.primary {
    background: var(--accent);
    color: white;
  }

  .mob-hl-btn.primary:active {
    background: #4338ca;
    transform: scale(0.95);
  }

  .mob-hl-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
  }

  .mob-hl-btn.secondary:active {
    background: rgba(255, 255, 255, 0.15);
  }

  .tb-count {
    font-size: 10px;
    padding: 1px 6px;
    min-width: 18px;
    text-align: center;
  }

  /* ── WORKSPACE: Full-screen viewer, no sidebar ── */
  .workspace {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    padding-top: var(--mob-topbar-h);
  }

  .viewer {
    flex: 1;
    padding: 12px 8px;
    padding-bottom: calc(var(--mob-toolbar-h) + var(--mob-safe-bottom) + 16px);
    height: auto;
    border-bottom: none;
    overflow-y: auto;
    overflow-x: auto;
    /* ALLOW HORIZONTAL SCROLL ON ZOOM */
    -webkit-overflow-scrolling: touch;
  }

  .viewer__body {
    max-width: none !important;
    width: fit-content;
    margin: 0 auto;
  }

  /* Hide desktop sidebar — mobile uses sheet */
  .panel {
    display: none !important;
  }

  .resizer {
    display: none !important;
  }

  /* ── MOBILE BOTTOM TOOLBAR ── */
  .mob-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--mob-toolbar-h) + var(--mob-safe-bottom));
    padding-bottom: var(--mob-safe-bottom);
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    z-index: 300;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 2px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .mob-toolbar::-webkit-scrollbar {
    display: none;
  }

  .mob-tool-btn {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s;
    position: relative;
  }

  .mob-tool-btn svg {
    width: 20px;
    height: 20px;
  }

  .mob-tool-btn.active {
    background: var(--accent-light);
    color: var(--accent);
  }

  .mob-tool-btn:active:not(:disabled) {
    transform: scale(0.9);
  }

  .mob-tool-btn:disabled {
    opacity: 0.3;
  }

  .mob-tool-label {
    font-size: 8px;
    font-weight: 700;
    margin-top: 1px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  .mob-tool-divider {
    flex-shrink: 0;
    width: 1px;
    height: 28px;
    background: var(--border);
    margin: 0 4px;
  }

  /* ── Color Swatch indicator on toolbar ── */
  .mob-color-dot {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  }

  /* ── MOBILE NOTES PANEL SHEET ── */
  .mob-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  .mob-panel-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .mob-panel-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 75vh;
    background: #fff;
    border-radius: 20px 20px 0 0;
    z-index: 2200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: boxEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.12);
    padding-bottom: var(--mob-safe-bottom);
  }

  .mob-panel-backdrop.visible+.mob-panel-sheet,
  .mob-panel-sheet.visible {
    transform: translateY(0);
  }

  .mob-panel-handle {
    width: 36px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 10px auto 6px;
    flex-shrink: 0;
  }

  .mob-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .mob-panel-header h3 {
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
  }

  .mob-panel-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #f1f5f9;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
  }

  .mob-panel-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
  }

  .mob-panel-body .note-item {
    margin-bottom: 10px;
  }

  .mob-panel-body .reviewer-settings {
    padding: 0 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
  }

  /* ── MOBILE COLOR PICKER SHEET ── */
  .mob-color-sheet {
    position: fixed;
    bottom: calc(var(--mob-toolbar-h) + var(--mob-safe-bottom) + 8px);
    left: 12px;
    right: 12px;
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    display: none;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
    z-index: 350;
  }

  .mob-color-sheet.visible {
    display: block;
  }

  .mob-color-sheet-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
  }

  .mob-color-grid {
    display: flex;
    gap: 12px;
    justify-content: center;
  }

  .mob-color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .mob-color-swatch.active {
    border-color: var(--accent);
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }

  /* ── MOBILE COMMENT BOX (Bottom Sheet) ── */
  .comment-box,
  .note-popup {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 80vh;
    overflow-y: auto;
    animation: mobSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    padding-bottom: var(--mob-safe-bottom);
  }

  @keyframes mobSlideUp {
    from {
      transform: translateY(100%);
      opacity: 0.5;
    }

    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  .comment-box__body,
  .note-popup__body {
    padding: 16px;
  }

  .editable-area {
    min-height: 80px;
  }

  .tag-row {
    padding: 0 16px 10px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .comment-box__foot {
    padding: 0 16px 16px;
  }

  /* ── Desktop color picker — hide on mobile ── */
  #color-picker-dropdown {
    display: none !important;
  }

  /* ── STATUS BAR — hide on mobile ── */
  .status-bar {
    display: none !important;
  }

  /* ── UPLOAD SCREEN ── */
  .upload-screen {
    padding: 40px 16px !important;
    min-height: calc(100vh - var(--mob-topbar-h));
    padding-top: calc(var(--mob-topbar-h) + 40px) !important;
    background-image: 
      radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
      radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.08) 0px, transparent 50%);
  }

  .upload-box {
    width: 100%;
    padding: 40px 24px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin-bottom: 40px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  }

  .hero-title-main {
    font-size: 32px !important;
    letter-spacing: -0.04em !important;
    margin-bottom: 12px;
  }

  .hero-subtitle-main {
    font-size: 15px !important;
    margin-bottom: 32px;
    opacity: 0.8;
  }

  .upload-btn-premium {
    width: 100%;
    justify-content: center;
    padding: 16px !important;
    font-size: 15px !important;
    border-radius: 12px;
  }

  .feature-bar {
    display: none !important;
  }

  .docs-section {
    padding: 60px 0;
  }

  .docs-header h2 {
    font-size: 28px;
  }

  .docs-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .docs-card {
    padding: 24px;
    border-radius: var(--radius-md);
  }

  /* ── SIGNATURE MODAL (Full-screen on mobile) ── */
  .modal {
    padding: 12px;
  }

  .modal .modal-content {
    max-width: 100% !important;
    width: 100% !important;
    padding: 20px !important;
    border-radius: 20px !important;
    max-height: 90vh;
    overflow-y: auto;
  }

  .sig-container {
    aspect-ratio: 4/3 !important;
  }


  /* ── Zoom container: Allow JS-driven zoom on mobile ── */

  /* ── MOBILE TOAST ── */
  .mob-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    color: #fff;
    padding: 14px 28px;
    border-radius: 40px;
    font-size: 13px;
    font-weight: 700;
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    text-align: center;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .mob-toast.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  /* ── MOBILE TOOLBAR REFINEMENT ── */
  .mob-toolbar {
    height: calc(var(--mob-toolbar-h) + var(--mob-safe-bottom) + 4px) !important;
  }

  .mob-tool-btn {
    height: 48px !important;
    width: 46px !important;
  }

  .mob-tool-label {
    font-size: 7px !important;
    opacity: 0.8;
  }

  /* ── MOBILE PIN ENHANCEMENT ── */
  .note-pin {
    min-width: 26px !important;
    height: 26px !important;
    font-size: 12px !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 0 0 2px #fff !important;
  }

}