/* ===========================================================
   MyFreePDFEdit — Apple Preview-inspired stylesheet
   =========================================================== */

:root {
  /* Apple system font stack */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
               "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;

  /* Light theme — Apple Preview palette */
  --bg: #ffffff;
  --bg-elevated: #f5f5f7;
  --bg-card: #ffffff;
  --bg-subtle: #fbfbfd;
  --text: #1d1d1f;
  --text-secondary: #515154;
  --text-muted: #86868b;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --accent: #0071e3;          /* Apple system blue */
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.08), 0 8px 16px rgba(0, 0, 0, 0.04);
  --nav-bg: rgba(255, 255, 255, 0.72);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;

  --container: 1120px;
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --bg-card: #1c1c1e;
  --bg-subtle: #0a0a0a;
  --text: #f5f5f7;
  --text-secondary: #aeaeb2;
  --text-muted: #8e8e93;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-soft: rgba(10, 132, 255, 0.15);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.6);
  --nav-bg: rgba(22, 22, 23, 0.72);
}

/* Respect system preference if user hasn't toggled */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --bg-card: #1c1c1e;
    --bg-subtle: #0a0a0a;
    --text: #f5f5f7;
    --text-secondary: #aeaeb2;
    --text-muted: #8e8e93;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-soft: rgba(10, 132, 255, 0.15);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.6);
    --nav-bg: rgba(22, 22, 23, 0.72);
  }
}

/* ----------------------------- Reset ----------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img, svg { display: block; max-width: 100%; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* ----------------------------- Navigation ----------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 52px;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); }
.brand-mark { width: 22px; height: 22px; color: var(--accent); }
.brand-text { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  font-size: 13px; color: var(--text-secondary);
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--text); }

.theme-toggle {
  background: transparent; border: none; padding: 6px;
  border-radius: 8px; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover { background: var(--bg-elevated); color: var(--text); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* ----------------------------- Hero ----------------------------- */
.hero {
  padding: 88px 0 64px;
  text-align: center;
  background:
    radial-gradient(ellipse at top, var(--accent-soft) 0%, transparent 60%),
    var(--bg);
}
.eyebrow {
  display: inline-block;
  font-size: 13px; font-weight: 500; letter-spacing: 0.02em;
  color: var(--accent); margin: 0 0 12px;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1.05; font-weight: 600; letter-spacing: -0.03em;
  margin: 0 0 16px; color: var(--text);
}
.hero-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #5e5ce6 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  font-size: clamp(17px, 2vw, 21px);
  color: var(--text-secondary);
  max-width: 620px; margin: 0 auto 32px;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 40px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 22px;
  border-radius: 980px; /* Apple pill */
  font-size: 15px; font-weight: 500; letter-spacing: -0.01em;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
}
.btn-primary {
  background: var(--accent); color: white;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-ghost {
  background: transparent; color: var(--accent);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-elevated); }

.hero-trust {
  display: flex; gap: 28px; justify-content: center; flex-wrap: wrap;
  font-size: 13px; color: var(--text-muted);
}
.trust-item { display: inline-flex; align-items: center; gap: 6px; }
.trust-item svg { width: 16px; height: 16px; }

/* ----------------------------- Tools grid ----------------------------- */
.tools { padding: 80px 0; }
.section-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600; letter-spacing: -0.02em;
  margin: 0 0 8px; text-align: center;
}
.section-sub {
  text-align: center; color: var(--text-secondary);
  margin: 0 0 48px; font-size: 17px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.tool-card {
  display: block;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.tool-icon {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  color: white;
}
.tool-icon svg { width: 24px; height: 24px; }
.tool-icon-1 { background: linear-gradient(135deg, #007aff, #5e5ce6); }
.tool-icon-2 { background: linear-gradient(135deg, #ff9500, #ff6482); }
.tool-icon-3 { background: linear-gradient(135deg, #34c759, #30b0c7); }
.tool-icon-4 { background: linear-gradient(135deg, #af52de, #ff2d55); }
.tool-icon-5 { background: linear-gradient(135deg, #5856d6, #007aff); }
.tool-icon-6 { background: linear-gradient(135deg, #ff2d55, #ff9500); }
.tool-icon-7 { background: linear-gradient(135deg, #30b0c7, #5e5ce6); }
.tool-icon-8 { background: linear-gradient(135deg, #ffcc00, #ff9500); }

.tool-card h3 {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 600; letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.tool-card p {
  margin: 0; color: var(--text-secondary); font-size: 14px;
}

/* ----------------------------- How it works ----------------------------- */
.how {
  padding: 80px 0;
  background: var(--bg-elevated);
}
.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 48px;
}
.how-step {
  background: var(--bg-card);
  padding: 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.how-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 50%; font-weight: 600; font-size: 15px;
  margin-bottom: 16px;
}
.how-step h3 {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 600; letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.how-step p { margin: 0; color: var(--text-secondary); font-size: 15px; }

/* ----------------------------- FAQ ----------------------------- */
.faq { padding: 80px 0; }
.faq .container { max-width: 760px; }
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 20px;
  margin-bottom: 10px;
  transition: border-color 0.15s ease;
}
.faq-item[open] { border-color: var(--border-strong); }
.faq-item summary {
  cursor: pointer;
  padding: 16px 0;
  font-weight: 500; font-size: 16px;
  list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; font-size: 22px; font-weight: 300;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item p {
  margin: 0 0 16px; color: var(--text-secondary);
  font-size: 15px; line-height: 1.55;
}

/* ----------------------------- Footer ----------------------------- */
.footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 56px 0 24px;
  font-size: 13px;
  color: var(--text-secondary);
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 48px;
  margin-bottom: 40px;
}
.footer-tag { margin: 8px 0 0; color: var(--text-muted); }
.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.footer-cols h4 {
  font-size: 13px; font-weight: 600;
  color: var(--text); margin: 0 0 12px;
}
.footer-cols a {
  display: block; padding: 4px 0;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}
.footer-cols a:hover { color: var(--text); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  color: var(--text-muted);
}

/* ----------------------------- Tool page layout ----------------------------- */
.tool-page { padding: 56px 0; }
.tool-header {
  text-align: center;
  margin-bottom: 40px;
}
.tool-header h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 600; letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.tool-header p {
  color: var(--text-secondary);
  font-size: 18px; margin: 0 auto; max-width: 580px;
}

.dropzone {
  background: var(--bg-card);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 64px 24px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  color: var(--accent);
}
.dropzone h2 {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 500;
  margin: 0 0 8px;
}
.dropzone p { margin: 0; color: var(--text-muted); font-size: 14px; }
.dropzone input[type="file"] { display: none; }

.file-list {
  margin-top: 24px;
  display: flex; flex-direction: column; gap: 8px;
}
.file-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}
.file-row .file-icon {
  width: 32px; height: 40px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
  flex-shrink: 0;
}
.file-row .file-meta { flex: 1; min-width: 0; }
.file-row .file-name {
  font-weight: 500; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-row .file-size { font-size: 12px; color: var(--text-muted); }
.file-row .file-actions { display: flex; gap: 4px; }
.icon-btn {
  background: transparent; border: none;
  width: 28px; height: 28px;
  border-radius: 6px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.icon-btn:hover { background: var(--bg-elevated); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

.action-bar {
  margin-top: 24px;
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}
.status {
  margin-top: 16px; text-align: center;
  font-size: 14px; color: var(--text-secondary);
  min-height: 20px;
}
.status.error { color: #ff3b30; }
.status.success { color: #34c759; }

/* ----------------------------- Responsive ----------------------------- */
@media (max-width: 700px) {
  .nav-links { gap: 16px; }
  .nav-links a:not(.theme-toggle) { display: none; }
  .hero { padding: 56px 0 40px; }
  .footer-inner { grid-template-columns: 1fr; gap: 32px; }
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
  .dropzone { padding: 40px 20px; }
}

/* ===========================================================
   Unified editor (/editor/)
   =========================================================== */

.editor-shell {
  display: grid;
  grid-template-columns: 210px 116px 1fr 312px;
  gap: 0;
  height: calc(100vh - 52px);
  background: var(--bg-elevated);
  overflow: hidden;
}

.editor-sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  overflow-y: auto;
}
.editor-sidebar h3 {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 16px 8px 6px;
}
.editor-sidebar h3:first-child { margin-top: 0; }

.tool-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px;
  background: transparent; border: none;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px; text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.tool-btn:hover { background: var(--bg-elevated); }
.tool-btn.active { background: var(--accent-soft); color: var(--accent); }
.tool-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.tool-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.tool-btn-accent { color: var(--accent); font-weight: 600; }
.tool-btn-accent:not([disabled]) { background: var(--accent-soft); }

/* ---------- Page rail ---------- */
.editor-pages {
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.pg-thumb {
  position: relative;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 3px;
  cursor: pointer;
  background: var(--bg-card);
  transition: border-color 0.12s ease;
}
.pg-thumb img { width: 100%; height: auto; display: block; border-radius: 3px; box-shadow: var(--shadow-sm); background: #fff; }
.pg-thumb:hover { border-color: var(--border-strong); }
.pg-thumb.current { border-color: var(--accent); }
.pg-thumb.selected { border-color: var(--accent); background: var(--accent-soft); }
.pg-num {
  position: absolute; bottom: 5px; right: 5px;
  background: rgba(0,0,0,0.6); color: #fff;
  font-size: 10px; padding: 1px 5px; border-radius: 4px;
}

/* ---------- Viewer ---------- */
.editor-viewer { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.viewer-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.vt-group { display: flex; align-items: center; gap: 6px; }
.vt-file {
  flex: 1; text-align: center; min-width: 0;
  font-size: 13px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vt-btn {
  min-width: 30px; height: 30px; padding: 0 8px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text);
  font-size: 16px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 0.12s ease;
}
.vt-btn:hover { background: var(--border); }
.vt-btn-text { font-size: 13px; }
.vt-page { font-size: 13px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 4px; }
.vt-page input {
  width: 44px; padding: 4px 6px; text-align: center;
  background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: 6px; color: var(--text); font-size: 13px;
}
.vt-zoom { font-size: 13px; color: var(--text-secondary); min-width: 42px; text-align: center; }

.viewer-scroll {
  flex: 1; overflow: auto;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 28px;
}
.viewer-scroll .editor-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; min-height: 60vh;
}
.viewer-scroll .editor-empty .dropzone { width: 100%; max-width: 520px; }

/* ---------- Live page stage ---------- */
.page-stage {
  position: relative;
  box-shadow: var(--shadow-lg);
  background: #fff;
  flex-shrink: 0;
}
.page-stage canvas { display: block; }

/* Text-run layer sits ABOVE the annotation layer while editing existing text,
   but only the run boxes capture clicks — empty space falls through. */
.text-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.text-run {
  position: absolute;
  border-radius: 2px;
  cursor: text;
  pointer-events: auto;
  transition: background-color 0.1s ease, outline-color 0.1s ease;
  outline: 1px solid transparent;
}
.text-run:hover { background: rgba(10,132,255,0.16); outline-color: var(--accent); }

.ann-layer { position: absolute; inset: 0; z-index: 2; }

/* Placement cursors per tool */
.page-stage[data-tool="text"] .ann-layer,
.page-stage[data-tool="sign"] .ann-layer { cursor: copy; }
.page-stage[data-tool="redact"] .ann-layer { cursor: crosshair; }

.ann { position: absolute; box-sizing: border-box; }
.ann.selected { outline: 1.5px solid var(--accent); outline-offset: 1px; }

.ann-text { min-width: 8px; padding: 0; }
.ann-text .ann-text-edit {
  font-family: Helvetica, Arial, sans-serif;
  line-height: 1.2;
  white-space: pre;
  outline: none;
  cursor: text;
  min-width: 6px;
  min-height: 1em;
}
.ann-text.selected { outline-style: dashed; }

.ann-signature img { width: 100%; height: 100%; display: block; pointer-events: none; }
.ann-signature, .ann-redact { cursor: move; }
.ann-redact { background: #000; }

.ann-move {
  position: absolute; top: -9px; left: -9px;
  width: 16px; height: 16px;
  background: var(--accent); border: 2px solid #fff;
  border-radius: 50%; cursor: move;
  display: none; box-shadow: var(--shadow-sm);
}
.ann-text.selected .ann-move { display: block; }

.ann-resize {
  position: absolute; right: -7px; bottom: -7px;
  width: 14px; height: 14px;
  background: var(--accent); border: 2px solid #fff;
  border-radius: 50%; cursor: nwse-resize;
  display: none;
}
.ann.selected .ann-resize { display: block; }

.check {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px; color: var(--text-secondary); cursor: pointer;
  line-height: 1.4;
}
.check input { margin-top: 2px; }

.editor-inspector {
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
}
.editor-inspector h3 {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600;
  margin: 0 0 8px;
}
.editor-inspector p.hint {
  font-size: 13px; color: var(--text-muted);
  margin: 0 0 16px;
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px; font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.field input[type="text"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: inherit; font-size: 14px;
  color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-row {
  display: flex; gap: 8px;
}
.field-row .field { flex: 1; }

.btn-block { width: 100%; }

.inspector-divider {
  height: 1px; background: var(--border);
  margin: 16px 0;
}

.file-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 8px;
}
.file-pill .file-pill-name {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Signature canvas */
.sig-pad {
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  width: 100%; height: 120px;
  cursor: crosshair;
  touch-action: none;
}

/* Editor responsive */
@media (max-width: 1180px) {
  .editor-shell { grid-template-columns: 180px 96px 1fr 280px; }
}
@media (max-width: 1000px) {
  .editor-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    height: auto; min-height: calc(100vh - 52px);
    overflow: visible;
  }
  .editor-sidebar {
    border-right: none; border-bottom: 1px solid var(--border);
    display: flex; overflow-x: auto; padding: 12px;
    gap: 4px;
  }
  .editor-sidebar h3 { display: none; }
  .tool-btn { width: auto; padding: 8px 12px; white-space: nowrap; }
  .editor-pages {
    border-right: none; border-bottom: 1px solid var(--border);
    flex-direction: row; overflow-x: auto;
    max-height: 110px;
  }
  .editor-pages .pg-thumb { flex-shrink: 0; width: 72px; }
  .editor-viewer { min-height: 60vh; }
  .editor-inspector {
    border-left: none; border-top: 1px solid var(--border);
    max-height: 50vh;
  }
}

/* Cross-link banner from tool pages to editor */
.editor-link {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin: 32px auto;
  max-width: 760px;
}
.editor-link .editor-link-text {
  font-size: 14px; color: var(--text-secondary);
}
.editor-link .editor-link-text strong {
  display: block; color: var(--text); font-size: 16px;
  margin-bottom: 2px;
}
