/* TableFig Editorial Visual Studio Stylesheet */
:root {
  --bg: #f8f7f4;
  --surface: #ffffff;
  --surface-alt: #f3f1eb;
  --ink: #14171f;
  --muted: #525966;
  --faint: #7c8494;
  --border: #e3dfd4;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #eef2ff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.04);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'PingFang SC', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, 'Charter', 'Songti SC', serif;
  --font-mono: 'SFMono-Regular', 'JetBrains Mono', Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1260px; margin: 0 auto; padding: 0 22px; }
.wrap.narrow { max-width: 820px; }

/* Single Clean Site Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
}
.header-left { display: flex; align-items: center; gap: 14px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.trust-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
}
.main-nav { display: flex; align-items: center; gap: 6px; }
.main-nav a {
  padding: 6px 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.main-nav a:hover, .main-nav a.active {
  background: var(--surface-alt);
  color: var(--ink);
  text-decoration: none;
}

/* Hero + Visual Icon Mode Bar */
.hero-strip { padding: 22px 0 14px; }
.breadcrumb { font-size: 13px; color: var(--faint); margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }
h1 {
  margin: 0 0 6px;
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.18;
  letter-spacing: -0.025em;
}
.lead { margin: 0 0 16px; color: var(--muted); font-size: 15px; max-width: 840px; }

.tool-icon-bar {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
}
.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 6px;
  border-radius: 11px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  transition: all 0.14s ease;
}
.mode-card:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}
.mode-card.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  box-shadow: 0 4px 12px rgba(20, 23, 31, 0.16);
}

/* Main Studio Workspace */
.studio-wrap { padding: 6px 0 36px; }
.studio-grid {
  display: grid;
  grid-template-columns: 372px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.studio-controls, .studio-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.studio-controls { padding: 18px; }
.studio-stage {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.studio-controls h2 {
  margin: 0;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.studio-controls h3 { margin: 0; font-size: 13px; color: var(--muted); }
.parse-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* Excel / CSV File Drop Zone */
.file-drop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  margin-bottom: 8px;
  border: 1.5px dashed var(--border);
  border-radius: 9px;
  background: #fcfbf9;
  transition: border-color 0.15s, background 0.15s;
}
.file-drop-row.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.btn-file-import {
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn-file-import:hover { border-color: var(--accent); color: var(--accent); }
.file-drop-hint { font-size: 12px; color: var(--faint); }

.sheet-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sheet-row label { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.sheet-row select {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 12.5px;
  background: #fff;
}

textarea#tf-data {
  width: 100%;
  min-height: 144px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fcfbf9;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.48;
  resize: vertical;
}
textarea#tf-data:focus,
.title-attr-drawer input:focus,
.inline-editor-popover input:focus {
  outline: 2px solid rgba(29, 78, 216, 0.24);
  border-color: var(--accent);
}

.mini-actions, .title-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-actions { margin-top: 8px; }
.btn-tiny {
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.btn-tiny:hover { border-color: var(--ink); color: var(--ink); }
.btn-accent-tiny {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.md-output-box {
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
}
.md-output-box h3 { color: #94a3b8; }
.md-output-box pre {
  margin: 6px 0 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  overflow-x: auto;
  white-space: pre;
  max-height: 130px;
}

.panel-divider { height: 1px; background: var(--border); margin: 14px 0 12px; }

.control-row { margin-top: 11px; }
.control-row label, .field-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}

/* Tactile Visual Aspect Ratio Buttons */
.aspect-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
}
.aspect-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 2px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
.aspect-btn:hover { border-color: var(--accent); color: var(--accent); }
.aspect-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.ratio-box {
  display: block;
  border: 1.7px solid currentColor;
  border-radius: 3px;
}
.ratio-box.dashed { border-style: dashed; }
.ratio-lbl { font-size: 11px; font-weight: 700; }

/* Visual Theme Swatch Buttons */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.theme-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.theme-pill.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.theme-pill .swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid;
}
.theme-pill .swatch i { display: block; width: 8px; height: 8px; border-radius: 99px; }

/* Segmented Controls & Chips (Replacing All Dropdowns) */
.seg-bar {
  display: flex;
  padding: 3px;
  border-radius: 9px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  gap: 2px;
}
.seg-btn {
  flex: 1;
  padding: 5px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.seg-btn.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.font-opt-sans { font-family: var(--font-sans); }
.font-opt-serif { font-family: var(--font-serif); }
.font-opt-mono { font-family: var(--font-mono); font-size: 11px; }

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.seg-chip {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.seg-chip:hover { border-color: var(--accent); color: var(--accent); }
.seg-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.control-split {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 10px;
  align-items: end;
}
.toggle-chip {
  display: flex !important;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fcfbf9;
  margin-bottom: 0 !important;
  cursor: pointer;
  font-size: 12px !important;
  white-space: nowrap;
}
.toggle-chip input { margin: 0; accent-color: var(--accent); }

/* Click-on-Canvas Text Quick Bar */
.canvas-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fcfbf9;
  border: 1px solid var(--border);
}
.meta-bar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meta-hint { font-size: 12.5px; color: var(--faint); font-weight: 600; }
.meta-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.meta-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--border);
}
.meta-chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.meta-chip.active::before { background: var(--accent); }

.title-attr-drawer {
  padding: 12px 14px;
  border-radius: 10px;
  background: #fcfbf9;
  border: 1px solid var(--border);
}
.title-attr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
.field-group input[type="text"] {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

/* Preview Canvas & Direct Inline Popover Editor */
.preview-wrap { position: relative; }
.preview-shell {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 410px;
  padding: 14px;
  border-radius: 12px;
  background: repeating-conic-gradient(#f1efe9 0% 25%, #faf9f6 0% 50%) 50% / 20px 20px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.preview-shell svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 700px;
  border-radius: 10px;
}
.preview-shell svg .tf-editable { cursor: text; }
.preview-shell svg .tf-editable:hover rect {
  stroke: #1d4ed8;
  stroke-width: 1.8;
  stroke-dasharray: 5 4;
}

.inline-editor-popover {
  position: absolute;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  width: min(620px, calc(100% - 32px));
  background: rgba(255, 255, 255, 0.98);
  border: 1.5px solid var(--accent);
  border-radius: 11px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}
.inline-editor-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  white-space: nowrap;
}
.inline-editor-popover input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  color: var(--ink);
}

.slide-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}
.slide-tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.slide-tab {
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.slide-tab.active { background: #fff; border-color: var(--border); color: var(--ink); }

/* Bottom Download Panel */
.download-panel {
  padding: 13px 14px;
  border-radius: 11px;
  background: #fcfbf9;
  border: 1px solid var(--border);
}
.export-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.export-primary { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: var(--font-sans);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-secondary { background: #fff; border-color: var(--border); color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink); text-decoration: none; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); padding: 6px 12px; font-size: 12.5px; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.status-msg { font-size: 12.5px; color: var(--faint); font-weight: 500; }

/* Dialog */
.switch-dialog {
  border: none;
  padding: 0;
  border-radius: 16px;
  background: transparent;
  max-width: 440px;
  width: calc(100% - 32px);
}
.switch-dialog::backdrop { background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(4px); }
.dialog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.22);
}
.dialog-card h3 { margin: 0 0 8px; font-size: 18px; }
.dialog-card p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* SEO Content, Specs, FAQs & Related */
.content-band, .faq-band, .related-band, .info-band {
  padding: 34px 0;
  border-top: 1px solid var(--border);
}
.content-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 22px; }
.content-card, .faq-item, .related-card, .info-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.content-card h2, .faq-band h2, .related-band h2 { margin: 0 0 14px; font-size: 20px; letter-spacing: -0.015em; }
.step-list { margin: 0; padding-left: 20px; color: var(--muted); }
.step-list li { margin-bottom: 10px; }

.spec-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec-table th, .spec-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.spec-table th { width: 34%; color: var(--ink); font-weight: 600; }
.spec-table td { color: var(--muted); }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: none; }

.faq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.faq-item h3 { margin: 0 0 8px; font-size: 16px; }
.faq-item p { margin: 0; color: var(--muted); font-size: 14.5px; }

.related-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.related-card { display: flex; flex-direction: column; gap: 6px; color: var(--ink); }
.related-card:hover { border-color: var(--accent); text-decoration: none; }
.related-card strong { font-size: 15px; }
.related-card span { font-size: 13px; color: var(--muted); }

.info-block { margin-bottom: 16px; }
.info-block h2 { margin: 0 0 10px; font-size: 19px; }
.info-block p { margin: 0 0 10px; color: var(--muted); }
.info-block p:last-child { margin-bottom: 0; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 40px 0 28px;
  margin-top: 24px;
}
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 24px; }
.footer-brand p { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.footer-meta { font-size: 12.5px !important; color: var(--faint) !important; }
.site-footer h3 { margin: 0 0 10px; font-size: 13.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 7px; font-size: 14px; }
.site-footer li a { color: var(--muted); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--faint);
}

@media (max-width: 1120px) {
  .tool-icon-bar { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .studio-grid, .content-grid, .faq-grid { grid-template-columns: 1fr; }
  .related-grid, .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .tool-icon-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .title-attr-grid, .related-grid, .footer-grid { grid-template-columns: 1fr; }
  .trust-pill { display: none; }
}
