﻿/* =========================================================
   Forma Print Studio — UI phase
   Design tokens, shell chrome, banded canvas, inspector
   ========================================================= */

#formaPrintDesigner {
  --font-sans: "Inter", "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --ink: #111827;
  --text: #243044;
  --muted: #667085;
  --subtle: #98a2b3;
  --line: #e5eaf2;
  --line-soft: #eef1f6;
  --line-strong: #d7dee9;
  --panel: #ffffff;
  --canvas: #eef1f5;
  --accent: #335cff;
  --accent-deep: #2447d8;
  --accent-soft: #eef2ff;
  --accent-line: #c9d4ff;
  --violet: #7c6cf2;
  --cyan: #0ea5b7;
  --amber: #e89a17;
  --green: #16a66a;
  --pink: #e25a9a;
  --danger: #e5484d;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 11px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .09), 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-paper: 0 22px 55px rgba(21, 32, 55, .15), 0 2px 8px rgba(21, 32, 55, .08);
  --zoom: .7;
  --ui-scale: 1.4286;

  /* ---------------------------------------------------------
     Typography primitives
     Dense desktop UI scale. Keep component rules on --text-*.
     --------------------------------------------------------- */
  --font-size-3xs: 8px;
  --font-size-2xs: 9px;
  --font-size-xs: 9.5px;
  --font-size-sm: 10.5px;
  --font-size-md: 11.5px;
  --font-size-base: 12.5px;
  --font-size-lg: 13.5px;
  --font-size-xl: 14.5px;
  --font-size-2xl: 16px;
  --font-size-3xl: 18px;

  /* Semantic text roles */
  --text-micro: var(--font-size-3xs);
  --text-caption: var(--font-size-2xs);
  --text-meta: var(--font-size-xs);
  --text-label: var(--font-size-sm);
  --text-body: var(--font-size-md);
  --text-control: var(--font-size-base);
  --text-section-title: var(--font-size-lg);
  --text-panel-title: var(--font-size-xl);
  --text-page-title: var(--font-size-2xl);
  --text-display: var(--font-size-3xl);

  height: var(--forma-designer-height, 100%);
  min-height: var(--forma-designer-min-height, 520px);
  width: 100%;
  min-width: 0;
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  color: var(--text);
  background: #f6f7fa;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  &[data-forma-layout="viewport"] {
    height: 100vh;
    width: 100vw;
  }


  &,
  & * { box-sizing: border-box; }
  button, input, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; }
  button:disabled { cursor: default; }
  h1, h2, h3, p { margin: 0; }
  b, strong { font-weight: 650; }
  svg { display: block; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.icon-12 { width: 12px; height: 12px; }
.icon-13 { width: 13px; height: 13px; }
.icon-14 { width: 14px; height: 14px; }
.icon-15 { width: 15px; height: 15px; }
.icon-16 { width: 16px; height: 16px; }
.icon-17 { width: 17px; height: 17px; }
.icon-18 { width: 18px; height: 18px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

  & ::selection { background: rgba(51, 92, 255, .18); }
  & :focus-visible { outline: 2px solid rgba(51, 92, 255, .42); outline-offset: 2px; }

  & *::-webkit-scrollbar { width: 8px; height: 8px; }
  & *::-webkit-scrollbar-thumb { background: #cfd6e2; border-radius: 20px; border: 2px solid transparent; background-clip: padding-box; }
  & *::-webkit-scrollbar-thumb:hover { background: #b6c0d0; border: 2px solid transparent; background-clip: padding-box; }
  & *::-webkit-scrollbar-track { background: transparent; }

  .app {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

/* ---------------------------------------------------------
   Header
   --------------------------------------------------------- */
.app-header {
  height: 60px;
  flex: 0 0 60px;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 14px 0 16px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}
.brand {
  width: 248px;
  flex: 0 0 248px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, #4a76ff 0%, #335cff 48%, #2141cd 100%);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 5px 12px rgba(51, 92, 255, .25), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-copy { display: flex; flex-direction: column; gap: 2px; line-height: 1; }
.brand-copy strong { font-size: var(--text-page-title); font-weight: 750; letter-spacing: -.035em; color: #121a2a; }
.brand-copy span { font-size: var(--text-meta); font-weight: 550; color: #8b95a7; letter-spacing: .03em; }
.brand-env {
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: .08em;
  color: #8a94a6;
  border: 1px solid #e2e7ef;
  background: #f8fafc;
  border-radius: 4px;
  padding: 2px 4px;
  margin-left: 1px;
  align-self: flex-start;
  margin-top: 4px;
}
.doc-context { min-width: 340px; display: flex; flex-direction: column; gap: 3px; padding-left: 2px; }
.breadcrumb { display: flex; align-items: center; gap: 4px; font-size: var(--text-meta); color: #9aa4b5; line-height: 1; }
.breadcrumb .icon { color: #bcc5d3; }
.breadcrumb-current { color: #677184; }
.doc-title-line { display: flex; align-items: center; gap: 8px; }
.doc-title-line h1 { font-size: var(--text-page-title); line-height: 1.15; font-weight: 680; letter-spacing: -.015em; color: #1a2335; }
.version-chip {
  font-size: var(--text-caption);
  font-weight: 600;
  color: #5b6b86;
  background: #f2f5f9;
  border: 1px solid #e8edf5;
  padding: 2.5px 5px;
  border-radius: 4px;
  line-height: 1;
}
.draft-indicator { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-meta); color: #a87316; white-space: nowrap; }
.draft-indicator i { width: 5px; height: 5px; border-radius: 50%; background: #e6a422; box-shadow: 0 0 0 2px rgba(230, 164, 34, .14); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.save-state { display: flex; align-items: center; gap: 5px; font-size: var(--text-label); color: #8c97a8; white-space: nowrap; }
.save-state .icon { color: #7e8b9f; }
.save-state.is-saving { color: var(--accent); }
.save-state.is-unsaved { color: #a87316; }
.header-divider { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }
.icon-group { display: flex; align-items: center; gap: 0; background: #f8fafc; border: 1px solid #eef2f7; border-radius: 8px; padding: 1px; }
.icon-btn {
  width: 32px;
  height: 30px;
  border: 0;
  background: transparent;
  color: #718096;
  border-radius: 7px;
  display: grid;
  place-items: center;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: #f1f4f9; color: #283449; }
.icon-btn:disabled { color: #c4cbd7; background: transparent; }
.btn {
  height: 34px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  font-size: var(--text-body);
  font-weight: 580;
  letter-spacing: -.005em;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: #4c586d; }
.btn-ghost:hover { background: #f3f6fa; }
.btn-secondary { background: #fff; border-color: #e2e8f0; color: #334155; box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: #f9fafc; border-color: #d6deea; }
.btn-primary {
  background: linear-gradient(180deg, #4169ff, #2f55ed);
  border-color: #2e51dd;
  color: #fff;
  box-shadow: 0 2px 4px rgba(51, 92, 255, .22), inset 0 1px 0 rgba(255, 255, 255, .18);
  padding-right: 9px;
}
.btn-primary:hover { background: linear-gradient(180deg, #3b62f4, #294edc); box-shadow: 0 4px 9px rgba(51, 92, 255, .27); }
.btn-key {
  margin-left: 3px;
  font-size: var(--text-caption);
  color: rgba(255, 255, 255, .68);
  background: rgba(255, 255, 255, .13);
  border-radius: 3px;
  padding: 2px 4px;
  letter-spacing: .02em;
}
.avatar {
  width: 32px;
  height: 32px;
  margin-left: 2px;
  border-radius: 9px;
  border: 1px solid #dbe2ed;
  background: linear-gradient(145deg, #1d293d, #0f172a);
  color: #fff;
  font-size: var(--text-meta);
  font-weight: 650;
  letter-spacing: .04em;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}

/* ---------------------------------------------------------
   Main shell
   --------------------------------------------------------- */
.app-main { flex: 1; min-height: 0; display: flex; }
.left-panel {
  width: 276px;
  flex: 0 0 276px;
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 8;
}
.inspector {
  width: 328px;
  flex: 0 0 328px;
  min-height: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 8;
}

/* ---------------------------------------------------------
   Left panel
   --------------------------------------------------------- */
.side-tabs {
  display: flex;
  gap: 3px;
  padding: 9px 12px 8px;
  border-bottom: 1px solid var(--line-soft);
}
.side-tab {
  flex: 1;
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #738096;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: var(--text-label);
  font-weight: 560;
  transition: background .15s ease, color .15s ease;
}
.side-tab .icon { opacity: .8; }
.side-tab:hover { background: #f5f7fa; color: #344054; }
.side-tab.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.side-tab.is-active .icon { opacity: 1; }
.side-search { padding: 9px 13px 3px; }
.search-box {
  height: 33px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 0 9px;
  border: 1px solid #e8edf4;
  background: #f7f9fc;
  border-radius: 8px;
  color: #9aa5b6;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.search-box:focus-within { background: #fff; border-color: #b9c8ff; box-shadow: 0 0 0 3px rgba(51, 92, 255, .08); }
.search-box input { min-width: 0; flex: 1; height: 100%; border: 0; outline: 0; background: transparent; font-size: var(--text-label); color: #344054; }
.search-box input::placeholder { color: #a2acbd; }
.search-box kbd {
  font-family: var(--font-sans);
  font-size: var(--text-caption);
  color: #9aa5b6;
  border: 1px solid #e3e9f1;
  background: #fff;
  border-radius: 4px;
  padding: 2px 4px;
  white-space: nowrap;
}
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.side-panel { display: none; padding: 0 13px 20px; }
.side-panel.is-active { display: block; }
.panel-section { margin-top: 13px; }
.panel-section:first-child { margin-top: 10px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; min-height: 18px; margin-bottom: 8px; }
.section-heading h2 { font-size: var(--text-label); font-weight: 660; letter-spacing: .01em; color: #344054; }
.section-heading > span { font-size: var(--text-caption); color: #a1aabb; }
.section-badge {
  color: #7b61e8 !important;
  background: #f2efff;
  border-radius: 4px;
  padding: 2px 5px;
  font-weight: 600;
}
.element-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.element-card {
  position: relative;
  height: 65px;
  border: 1px solid #e9edf4;
  border-radius: 9px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 2px;
  color: #48556b;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease;
}
.element-card:hover {
  border-color: #bdcbff;
  background: #fbfcff;
  box-shadow: 0 4px 12px rgba(51, 92, 255, .08);
  transform: translateY(-1px);
}
.element-card:active { transform: translateY(0); }
.element-icon {
  width: 27px;
  height: 27px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #4e5c74;
}
.element-icon .icon { width: 16px; height: 16px; stroke-width: 1.65; }
.tone-blue { color: #3a66ef; background: #edf2ff; }
.tone-violet { color: #755ce8; background: #f2efff; }
.tone-pink { color: #dc5a95; background: #fdf0f6; }
.tone-ink { color: #334155; background: #f1f4f8; }
.tone-slate { color: #60708a; background: #f2f5f9; }
.tone-amber { color: #cf8a15; background: #fff7e7; }
.tone-green { color: #17926b; background: #ecf9f4; }
.element-name { font-size: var(--text-meta); font-weight: 560; line-height: 1; color: #4c596e; white-space: nowrap; }
.element-hint {
  position: absolute;
  top: 5px;
  right: 6px;
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  color: #b3bccb;
  opacity: .8;
}
.smart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.smart-card {
  min-width: 0;
  height: 48px;
  border: 1px solid #e9edf4;
  background: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 7px;
  text-align: left;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.smart-card:hover { border-color: #c6d2ff; background: #fbfcff; box-shadow: 0 3px 10px rgba(51, 92, 255, .06); }
.smart-card-icon {
  width: 25px;
  height: 25px;
  border-radius: 6px;
  background: #f3f6fb;
  color: #5a6a82;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.smart-card:hover .smart-card-icon { background: var(--accent-soft); color: var(--accent); }
.smart-card > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.smart-card strong { font-size: var(--text-meta); font-weight: 600; line-height: 1.1; color: #40506a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smart-card small { font-size: var(--text-micro); color: #9ba6b7; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-setup-section { margin-top: 11px; }
.page-setup {
  position: relative;
  width: 100%;
  min-height: 58px;
  padding: 8px 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #e7ebf2;
  border-radius: 9px;
  background: linear-gradient(135deg, #fbfcff, #f7f9fd);
  text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.page-setup:hover { border-color: #c3cfff; box-shadow: 0 4px 12px rgba(51, 92, 255, .06); }
.page-thumb {
  width: 28px;
  height: 37px;
  flex: 0 0 auto;
  border: 1px solid #dfe6f1;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(30, 41, 59, .06);
  position: relative;
}
.page-thumb::before { content: ""; position: absolute; left: 5px; top: 6px; width: 16px; height: 2px; background: #bfc9da; border-radius: 2px; }
.page-thumb i { position: absolute; left: 5px; top: 12px; width: 16px; height: 16px; border-radius: 2px; background: repeating-linear-gradient(to bottom, #dbe4f1 0 1px, transparent 1px 4px); }
.page-setup-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.page-setup-title { display: flex; align-items: center; gap: 3px; font-size: var(--text-label); font-weight: 620; color: #37445b; white-space: nowrap; }
.page-setup-title .icon { color: #a2acbc; }
.page-setup-copy small { font-size: var(--text-caption); color: #99a4b5; white-space: nowrap; }
.page-setup-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  color: #8996aa;
  background: #edf2fa;
  padding: 2px 4px;
  border-radius: 3px;
}
.theme-section { margin-top: 7px; }
.theme-card {
  width: 100%;
  height: 40px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e8ecf3;
  border-radius: 8px;
  background: #fff;
  text-align: left;
  transition: border-color .15s ease, background .15s ease;
}
.theme-card:hover { border-color: #c8d3f5; background: #fbfcff; }
.theme-swatches { display: flex; align-items: center; flex: 0 0 auto; }
.theme-swatches i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #e4e9f2; margin-left: -4px; }
.theme-swatches i:first-child { margin-left: 0; }
.theme-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.theme-copy strong { font-size: var(--text-meta); font-weight: 600; color: #46546a; line-height: 1.1; }
.theme-copy small { font-size: var(--text-caption); color: #9ba5b5; line-height: 1.1; }
.theme-link { font-size: var(--text-caption); color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 3px 5px; }
.structure-section { margin-top: 12px; }
.structure-list { display: flex; flex-direction: column; gap: 1px; margin: 0 -4px; }
.structure-row {
  height: 31px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 5px 0 3px;
  text-align: left;
  color: #5f6c81;
  transition: background .12s ease, border-color .12s ease;
}
.structure-row:hover { background: #f7f9fc; }
.structure-row.is-current { background: #f2f6ff; border-color: #e0e8ff; color: #3155c8; }
.drag-dots { width: 14px; display: grid; place-items: center; color: #c0c8d5; opacity: 0; transition: opacity .12s ease; }
.structure-row:hover .drag-dots, .structure-row.is-current .drag-dots { opacity: 1; }
.band-color { width: 5px; height: 5px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 0 3px rgba(120, 130, 150, .07); }
.band-color.violet { background: var(--violet); }
.band-color.cyan { background: var(--cyan); }
.band-color.blue { background: var(--accent); }
.band-color.amber { background: var(--amber); }
.band-color.purple { background: #9868e0; }
.band-color.green { background: var(--green); }
.structure-name { font-size: var(--text-meta); font-weight: 520; white-space: nowrap; }
.structure-row.is-current .structure-name { font-weight: 620; }
.structure-row.is-overflow { background: #fff7f5; border-color: #ffd7d1; }
.structure-row.is-overflow .structure-name { color: #b42318; }
.structure-row.is-overflow .structure-meta { color: #d92d20; }
.structure-row.is-overflow .structure-meta::after {
  content: "超页";
  margin-left: 4px;
  padding: 1px 3px;
  border-radius: 3px;
  background: #fee4e2;
  color: #b42318;
  font-family: var(--font-sans);
  font-weight: 650;
}
.structure-meta { margin-left: auto; font-size: var(--text-micro); color: #a2acbc; font-variant-numeric: tabular-nums; white-space: nowrap; }
.repeat-badge { font-size: var(--text-micro); color: #3860d8; background: #e7eeff; border-radius: 3px; padding: 2px 4px; line-height: 1; font-weight: 600; }
.structure-chevron { color: #bcc5d2; width: 11px; height: 11px; margin-left: 1px; }
.mini-icon-btn {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #8b97a9;
}
.mini-icon-btn:hover { background: #f1f4f9; color: #40506a; }
.mini-icon-btn.danger:hover { background: #fff1f1; color: var(--danger); }
.side-footer {
  height: 38px;
  flex: 0 0 38px;
  border-top: 1px solid var(--line-soft);
  padding: 0 10px 0 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
}
.side-footer-tip { display: flex; align-items: center; gap: 4px; font-size: var(--text-caption); color: #9ba5b5; }
.side-footer-tip .icon { color: #a18cf3; }

/* Data fields side panel */
.data-source-card { margin-top: 12px; border: 1px solid #e8ecf4; border-radius: 9px; background: linear-gradient(150deg, #fbfcff, #f7f9fe); overflow: hidden; }
.data-source-head { display: flex; align-items: center; gap: 8px; padding: 10px; }
.data-source-icon { width: 29px; height: 29px; border-radius: 7px; background: #edf2ff; color: var(--accent); display: grid; place-items: center; flex: 0 0 auto; }
.data-source-head > span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.data-source-head strong { font-size: var(--text-label); color: #344054; font-weight: 640; }
.data-source-head small { font-size: var(--text-caption); color: #99a4b5; }
.live-dot { margin-left: auto; display: flex; align-items: center; gap: 3px; font-size: var(--text-micro); color: #178c64; white-space: nowrap; }
.live-dot i { width: 4px; height: 4px; border-radius: 50%; background: #20b47d; box-shadow: 0 0 0 2px rgba(32, 180, 125, .13); }
.data-source-foot { border-top: 1px solid #edf1f7; display: flex; align-items: center; justify-content: space-between; padding: 6px 9px; font-size: var(--text-micro); color: #98a4b5; background: rgba(255, 255, 255, .6); }
.data-source-foot > span { display: flex; align-items: center; gap: 3px; }
.text-btn { border: 0; background: transparent; color: var(--accent); font-size: var(--text-caption); padding: 1px 2px; border-radius: 3px; }
.text-btn:hover { background: var(--accent-soft); }
.field-group { margin-top: 13px; }
.field-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.field-group-head strong { font-size: var(--text-meta); color: #66748b; font-weight: 640; letter-spacing: .02em; }
.field-group-head span { font-size: var(--text-micro); color: #acb5c3; }
.field-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 33px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  color: #4e5b70;
  transition: background .12s ease, color .12s ease;
}
.field-item:hover { background: #f4f7fc; color: #2f4cb4; }
.field-item .field-type-icon { width: 21px; height: 21px; border-radius: 5px; background: #f4f6fa; color: #8b97a9; display: grid; place-items: center; flex: 0 0 auto; }
.field-item:hover .field-type-icon { background: #e9efff; color: var(--accent); }
.field-item .field-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.field-item strong { font-size: var(--text-meta); font-weight: 560; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field-item small { font-family: var(--font-mono); font-size: var(--text-micro); color: #a7b0bf; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field-item .field-add { color: #b4bdca; opacity: 0; transition: opacity .12s ease; }
.field-item:hover .field-add { opacity: 1; color: var(--accent); }
.field-search-empty { padding: 22px 10px; text-align: center; font-size: var(--text-meta); color: #a4adbb; }

/* Layers */
.layer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 2px 7px;
  font-size: var(--text-meta);
  color: #8e99a9;
}
.layer-toolbar > div { display: flex; gap: 2px; }
.layer-tree { padding-bottom: 10px; }
.layer-group { margin-top: 7px; }
.layer-group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 6px;
  border-radius: 5px;
  color: #66748b;
  font-size: var(--text-meta);
  font-weight: 600;
}
.layer-group-head .band-color { width: 4px; height: 4px; }
.layer-group-head .layer-count { margin-left: auto; font-size: var(--text-micro); color: #a5aebc; font-weight: 400; }
.layer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 10px);
  margin-left: 10px;
  height: 29px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #5c6a80;
  font-size: var(--text-caption);
  text-align: left;
}
.layer-item:hover { background: #f6f8fc; }
.layer-item.is-selected { background: #eef3ff; border-color: #dfe7ff; color: #3155c8; }
.layer-item .layer-icon { color: #95a1b3; display: grid; place-items: center; flex: 0 0 auto; }
.layer-item.is-selected .layer-icon { color: var(--accent); }
.layer-item-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.layer-item .layer-binding { margin-left: auto; font-family: var(--font-mono); font-size: var(--text-micro); color: #a9b3c1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 75px; }
.layer-item .layer-eye { margin-left: auto; color: #b2bbc8; opacity: 0; }
.layer-item:hover .layer-eye { opacity: 1; }

/* ---------------------------------------------------------
   Workspace toolbar
   --------------------------------------------------------- */
.workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  position: relative;
}
.design-toolbar {
  height: 48px;
  flex: 0 0 48px;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 11px;
  position: relative;
  z-index: 10;
}
.tool-group { display: flex; align-items: center; gap: 1px; }
.tool-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #7a879b;
  display: grid;
  place-items: center;
  transition: background .12s ease, color .12s ease;
}
.tool-btn:hover { background: #f3f6fa; color: #35435a; }
.tool-btn.is-active { background: var(--accent-soft); color: var(--accent); }
.toolbar-divider { width: 1px; height: 17px; background: #e8ecf2; margin: 0 3px; flex: 0 0 1px; }
.toolbar-spacer { flex: 1; }
.canvas-preset { font-size: var(--text-meta); color: #8b97a9; white-space: nowrap; }
.zoom-control {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 0;
  background: #f8fafc;
  border: 1px solid #e9edf4;
  border-radius: 7px;
  padding: 1px;
}
.zoom-btn { width: 27px; height: 26px; border: 0; background: transparent; color: #7b8799; display: grid; place-items: center; border-radius: 5px; }
.zoom-btn:hover { background: #fff; color: #2c3a50; box-shadow: 0 1px 3px rgba(16, 24, 40, .08); }
.zoom-value { min-width: 42px; height: 26px; border: 0; background: transparent; color: #536176; font-size: var(--text-meta); font-family: var(--font-mono); font-variant-numeric: tabular-nums; border-radius: 5px; padding: 0 2px; }
.zoom-value:hover { background: #fff; color: var(--accent); }

/* Canvas */
.canvas-stage {
  --canvas-ruler-size: 24px;
  --canvas-band-tags-width: 68px;
  --canvas-side-gutter: 46px;
  --canvas-vertical-gutter: 22px;
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background-color: #eef1f5;
  background-image: radial-gradient(circle, rgba(120, 137, 163, .22) .65px, transparent .65px);
  background-size: 16px 16px;
  background-position: 8px 8px;
}
.canvas-stage::before {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: 0;
  background: radial-gradient(ellipse at 50% 35%, rgba(255, 255, 255, .6), transparent 62%);
  z-index: 0;
}
.canvas-shell {
  position: absolute;
  inset: var(--canvas-ruler-size) 0 0 var(--canvas-ruler-size);
  overflow: auto;
  background: transparent;
  z-index: 1;
}
.canvas-board {
  position: relative;
  width: max-content;
  margin: 14px auto 8px;
  display: grid;
  grid-template-columns: var(--canvas-band-tags-width) auto;
  grid-template-rows: auto;
  align-items: start;
  z-index: 1;
}
.band-tags { grid-column: 1; grid-row: 1; position: relative; height: 100%; }
.ruler-corner {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--canvas-ruler-size);
  height: var(--canvas-ruler-size);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5eaf2;
  border-right: 0;
  border-bottom: 0;
  border-radius: 3px 0 0 0;
  background: #fbfcfe;
  color: #b0bac8;
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  letter-spacing: -.02em;
  z-index: 6;
}
.ruler {
  position: absolute;
  background: #fbfcfe;
  border: 1px solid #e5eaf2;
  color: #9aa5b6;
  overflow: hidden;
  z-index: 5;
}
.ruler-x { left: var(--canvas-ruler-size); right: 0; top: 0; height: var(--canvas-ruler-size); border-radius: 0 3px 0 0; }
.ruler-y { left: 0; top: var(--canvas-ruler-size); bottom: 0; width: var(--canvas-ruler-size); border-radius: 0 0 0 3px; }
.ruler-track { position: absolute; left: 0; top: 0; width: 100%; height: 100%; will-change: transform; }
.ruler-tick { position: absolute; background: #cfd7e3; }
.ruler-x .ruler-tick { bottom: 0; width: 1px; }
.ruler-x .ruler-tick.minor { height: 4px; opacity: .75; }
.ruler-x .ruler-tick.mid { height: 6px; }
.ruler-x .ruler-tick.major { height: 9px; background: #b6c0cf; }
.ruler-y .ruler-tick { right: 0; height: 1px; }
.ruler-y .ruler-tick.minor { width: 4px; opacity: .75; }
.ruler-y .ruler-tick.mid { width: 6px; }
.ruler-y .ruler-tick.major { width: 9px; background: #b6c0cf; }
.ruler-label { position: absolute; font-family: var(--font-mono); font-size: var(--text-micro); line-height: 1; color: #9aa5b6; letter-spacing: -.03em; white-space: nowrap; }
.ruler-x .ruler-label { top: 3px; transform: translateX(2px); }
.ruler-y .ruler-label { left: 3px; transform: translateY(-4px); }
.ruler-selection { position: absolute; background: rgba(51, 92, 255, .55); border-radius: 1px; pointer-events: none; }
.ruler-x .ruler-selection { bottom: 0; height: 4px; }
.ruler-y .ruler-selection { right: 0; width: 4px; }
.ruler-corner::after { content: ""; width: 5px; height: 5px; border-left: 1px solid #b5bfce; border-top: 1px solid #b5bfce; position: absolute; left: 4px; top: 4px; }
.band-tag {
  position: absolute;
  left: 0;
  height: 18px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid #e3e8f0;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  font-size: var(--text-caption);
  color: #7c8798;
  white-space: nowrap;
  transform: translateY(-9px);
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.band-tag::after { content: ""; position: absolute; left: 100%; width: 7px; height: 1px; background: #d6dee9; }
.band-tag .band-dot { width: 5px; height: 5px; border-radius: 50%; flex: 0 0 auto; }
.band-tag.is-detail { color: #3155c8; border-color: #d7e0ff; background: #f7f9ff; }
.band-tag.is-detail .loop-mini { font-size: var(--text-caption); color: #4b6de0; margin-left: -1px; }
.band-tag.is-selected { color: #2447d8; border-color: #bfcdff; background: #fff; box-shadow: 0 2px 6px rgba(51, 92, 255, .1); }
.page-outer { grid-column: 2; grid-row: 1; position: relative; }
.page-scale {
  position: relative;
  background: #fff;
  box-shadow: var(--shadow-paper);
  isolation: isolate;
}
.page {
  position: absolute;
  left: 0;
  top: 0;
  width: 210mm;
  height: 297mm;
  background: #fff;
  transform-origin: top left;
  overflow: hidden;
  color: #172033;
  font-family: var(--font-sans);
}
.page.has-overflow { outline: 2px solid rgba(217, 45, 32, .35); outline-offset: 2px; }
.page-grid {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(51, 92, 255, .055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(51, 92, 255, .055) 1px, transparent 1px),
    linear-gradient(to right, rgba(51, 92, 255, .028) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(51, 92, 255, .028) 1px, transparent 1px);
  background-size: 18.897637795px 18.897637795px, 18.897637795px 18.897637795px, 3.779527559px 3.779527559px, 3.779527559px 3.779527559px;
  transition: opacity .15s ease;
  z-index: 0;
}
.page.show-grid .page-grid { opacity: 1; }
.band-zone {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 1;
}
.band-zone.detail { background: rgba(51, 92, 255, .024); }
.band-zone.detail::before, .band-zone.detail::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed rgba(51, 92, 255, .26);
}
.band-zone.detail::before { top: 0; }
.band-zone.detail::after { bottom: 0; }
.band-zone.summary { background: rgba(232, 154, 23, .025); }
.band-zone.tableHead::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  border-top: 1px dashed rgba(51, 92, 255, .18);
}
.page-band-label {
  position: absolute;
  right: 0;
  top: 0;
  font-size: var(--text-micro);
  color: rgba(51, 92, 255, .5);
  background: rgba(238, 242, 255, .7);
  padding: 1px 3px;
  border-radius: 0 0 0 3px;
  z-index: 1;
}
.table-strip {
  position: absolute;
  left: 12mm;
  width: 186mm;
  z-index: 1;
  border-bottom: .2mm solid #e8edf4;
}
.table-strip.alt { background: #f8fafd; }
.static-row {
  position: absolute;
  left: 12mm;
  width: 186mm;
  display: flex;
  align-items: center;
  z-index: 4;
  font-size: 7.15pt;
  color: #3e4d63;
  font-variant-numeric: tabular-nums;
}
.static-cell {
  height: 100%;
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.static-cell.c-index { width: 10mm; justify-content: center; }
.static-cell.c-sku { width: 28mm; padding: 0 2mm; font-family: var(--font-mono); font-size: 6.7pt; color: #546277; }
.static-cell.c-name { width: 58mm; padding: 0 2mm; font-weight: 520; color: #2d3d52; }
.static-cell.c-spec { width: 30mm; padding: 0 2mm; color: #6b788c; font-size: 6.65pt; }
.static-cell.c-qty { width: 15mm; padding: 0 2mm; justify-content: flex-end; font-family: var(--font-mono); }
.static-cell.c-price { width: 22mm; padding: 0 2mm; justify-content: flex-end; font-family: var(--font-mono); font-size: 6.8pt; color: #47566c; }
.static-cell.c-amount { width: 23mm; padding: 0 2mm; justify-content: flex-end; font-family: var(--font-mono); font-size: 7.05pt; font-weight: 590; color: #202f45; }
.image-el { width: 100%; height: 100%; display: block; }
.image-placeholder {
  width: 100%;
  height: 100%;
  border: .25mm dashed #cbd5e1;
  border-radius: .8mm;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .8mm;
  color: #9aa6b6;
  font-size: 5.5pt;
}
.table-widget {
  width: 100%;
  height: 100%;
  border: .2mm solid #dfe6ef;
  border-radius: .8mm;
  overflow: hidden;
  background: #fff;
  font-size: 6.3pt;
}
.table-widget-row { display: grid; grid-template-columns: 1fr 13mm 22mm; border-bottom: .2mm solid #e9eef5; }
.table-widget-row:last-child { border-bottom: 0; }
.table-widget-row span { padding: 1.3mm 1.5mm; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.table-widget-row span:nth-child(2), .table-widget-row span:nth-child(3) { text-align: right; font-family: var(--font-mono); }
.table-widget-row.is-head { background: #172033; color: #fff; font-weight: 600; }

/* Canvas tip */
.canvas-tip {
  position: fixed;
  left: calc(276px + (100vw - 276px - 328px) / 2);
  bottom: 44px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(226, 232, 240, .9);
  box-shadow: 0 6px 20px rgba(16, 24, 40, .08);
  color: #8d99aa;
  font-size: var(--text-caption);
  white-space: nowrap;
  backdrop-filter: blur(8px);
  z-index: 4;
  pointer-events: none;
}
.tip-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(51, 92, 255, .11); }

/* Workspace footer */
.workspace-footer {
  height: 30px;
  flex: 0 0 30px;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 13px;
  color: #8d98a9;
  font-size: var(--text-caption);
  z-index: 6;
}
.status-left, .status-center, .status-right { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.status-left .mono { color: #778397; font-size: var(--text-caption); }
.overflow-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border: 1px solid #fecaca;
  border-radius: 4px;
  background: #fff1f2;
  color: #b42318;
  font-size: var(--text-caption);
  font-weight: 650;
  white-space: nowrap;
}
.overflow-badge[hidden] { display: none; }
.ready-dot { display: flex; align-items: center; gap: 4px; color: #637085; }
.ready-dot i { width: 5px; height: 5px; border-radius: 50%; background: #22b57d; box-shadow: 0 0 0 2px rgba(34, 181, 125, .12); }
.status-divider { width: 1px; height: 11px; background: #e8ecf2; }
.status-center { color: #98a3b3; }
.status-center b { color: #66748a; font-weight: 600; }
.snap-indicator { display: flex; align-items: center; gap: 3px; color: #97a2b2; }
.snap-indicator.is-on { color: #3460d9; background: #eef3ff; border-radius: 4px; padding: 2px 5px; }
.autosave { display: flex; align-items: center; gap: 4px; color: #929daf; }
.autosave .icon { color: #a4afbe; }
.prototype-badge { font-size: var(--text-micro); color: #7a63dc; background: #f3f0ff; border: 1px solid #ece6ff; padding: 2px 5px; border-radius: 4px; }

/* ---------------------------------------------------------
   Page template content — real print visual
   --------------------------------------------------------- */
.page-content { position: relative; z-index: 5; }
.obj {
  position: absolute;
  z-index: 5;
  box-sizing: border-box;
  cursor: move;
  user-select: none;
  transition: background-color .12s ease;
}
.obj:hover { outline: 1px dashed rgba(51, 92, 255, .42); outline-offset: 2px; }
.obj.is-selected { outline: 0; }
.obj.is-locked { cursor: default; }
.obj-inner { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; white-space: pre-wrap; }
.obj-cell .obj-inner { justify-content: center; }
.obj-text .obj-inner { line-height: 1.28; }
.field-value { display: inline; border-bottom: 1px dashed transparent; padding-bottom: 1px; transition: border-color .12s ease, background-color .12s ease; }
.obj-field:hover .field-value, .obj-field.is-selected .field-value { border-bottom-color: rgba(51, 92, 255, .42); background: rgba(51, 92, 255, .035); }
.obj-field::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(51, 92, 255, .36);
  opacity: 0;
  transition: opacity .12s ease;
}
.obj-field:hover::after, .obj-field.is-selected::after { opacity: 1; }
.obj-locked::after { content: ""; }

.company-logo {
  width: 100%;
  height: 100%;
  border-radius: 1.6mm;
  background:
    radial-gradient(circle at 78% 20%, rgba(255, 255, 255, .23), transparent 28%),
    linear-gradient(145deg, #416cff 0%, #2c50e2 55%, #1c37a8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 .2mm rgba(255, 255, 255, .12);
}
.company-logo::before {
  content: "";
  position: absolute;
  width: 70%;
  height: 150%;
  left: 42%;
  top: -24%;
  border-left: .26mm solid rgba(255, 255, 255, .28);
  transform: rotate(23deg);
}
.company-logo::after {
  content: "";
  position: absolute;
  width: 32%;
  height: 125%;
  left: 61%;
  top: -12%;
  background: rgba(255, 255, 255, .1);
  transform: rotate(23deg);
}
.company-logo span { position: relative; z-index: 1; color: #fff; font-size: 3.4mm; font-weight: 760; letter-spacing: -.04em; }
.qr-block {
  width: 100%;
  height: 100%;
  background: #fff;
  border: .2mm solid #e7ebf2;
  border-radius: .5mm;
  padding: 1mm;
  box-shadow: 0 .3mm 1mm rgba(16, 24, 40, .05);
}
.qr-block svg { width: 100%; height: 100%; }
.barcode-block { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: .5mm; }
.barcode-bars {
  flex: 1;
  background: repeating-linear-gradient(90deg, #111827 0 .26mm, transparent .26mm .43mm, #111827 .43mm .52mm, transparent .52mm .8mm, #111827 .8mm 1.24mm, transparent 1.24mm 1.5mm, #111827 1.5mm 1.62mm, transparent 1.62mm 2.1mm);
  min-height: 3mm;
}
.barcode-caption { font-family: var(--font-mono); font-size: 5.5pt; letter-spacing: .1em; color: #334155; text-align: center; }
.stamp-mark {
  width: 100%;
  height: 100%;
  border: .45mm solid rgba(201, 59, 52, .68);
  border-radius: 50%;
  color: rgba(193, 53, 47, .8);
  display: grid;
  place-items: center;
  transform: rotate(-11deg);
  font-size: 7.5pt;
  font-weight: 700;
  letter-spacing: .06em;
  background: rgba(255, 255, 255, .2);
}
.table-head-fill { position: absolute; left: 12mm; top: 77.5mm; width: 186mm; height: 8mm; background: #172033; border-radius: 1mm 1mm 0 0; z-index: 2; }
.table-row-fill { position: absolute; left: 12mm; width: 186mm; z-index: 1; }
.table-row-fill.alt { background: #f8fafd; }
.table-rule { position: absolute; left: 12mm; width: 186mm; height: .2mm; background: #e8edf4; z-index: 2; }
.table-vrule { position: absolute; top: 77.5mm; height: 67.5mm; width: .2mm; background: #e8edf4; z-index: 2; }
.summary-panel { position: absolute; left: 121mm; top: 157mm; width: 77mm; height: 24mm; background: #f7f9fd; border: .2mm solid #e9edf4; border-radius: 1mm; z-index: 2; }
.summary-accent { position: absolute; left: 121mm; top: 157mm; width: .9mm; height: 24mm; background: #335cff; border-radius: 1mm 0 0 1mm; z-index: 3; }
.amount-uppercase { position: absolute; left: 12mm; top: 157mm; width: 104mm; height: 24mm; border: .2mm solid #e9edf4; border-radius: 1mm; background: #fbfcfe; z-index: 2; }
.notes-headline { position: absolute; left: 12mm; top: 187.5mm; font-size: 8pt; font-weight: 700; color: #263448; z-index: 3; }
.notes-rule { position: absolute; left: 33mm; top: 191mm; width: 165mm; height: .2mm; background: #e8edf4; z-index: 2; }
.signature-rule { position: absolute; top: 246.5mm; height: .25mm; background: #cbd5e1; z-index: 2; }
.footer-rule { position: absolute; left: 12mm; top: 276mm; width: 186mm; height: .25mm; background: #dbe2ec; z-index: 2; }
.page-break-note {
  position: absolute;
  right: 12mm;
  top: 273mm;
  z-index: 4;
  font-size: 5.5pt;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 1mm;
}
.page-break-note::before { content: ""; width: 4mm; border-top: .2mm dashed #cbd5e1; }

/* Selection */
.selection-box {
  position: absolute;
  z-index: 30;
  pointer-events: none;
  border: calc(1.5px * var(--ui-scale)) solid var(--accent);
  border-radius: calc(1px * var(--ui-scale));
  box-shadow: 0 0 0 calc(1px * var(--ui-scale)) rgba(255, 255, 255, .8);
  display: none;
}
.selection-label {
  position: absolute;
  left: calc(-1.5px * var(--ui-scale));
  bottom: 100%;
  margin-bottom: calc(4px * var(--ui-scale));
  height: calc(18px * var(--ui-scale));
  padding: 0 calc(6px * var(--ui-scale));
  border-radius: calc(4px * var(--ui-scale));
  background: var(--accent);
  color: #fff;
  font-size: calc(var(--text-meta) * var(--ui-scale));
  font-weight: 560;
  display: flex;
  align-items: center;
  gap: calc(3px * var(--ui-scale));
  white-space: nowrap;
  box-shadow: 0 calc(2px * var(--ui-scale)) calc(6px * var(--ui-scale)) rgba(51, 92, 255, .3);
  font-family: var(--font-sans);
}
.selection-label .icon { width: calc(10px * var(--ui-scale)); height: calc(10px * var(--ui-scale)); }
.selection-label.is-right { left: auto; right: calc(-1.5px * var(--ui-scale)); }
.selection-size {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: calc(4px * var(--ui-scale));
  padding: calc(1px * var(--ui-scale)) calc(4px * var(--ui-scale));
  border-radius: calc(3px * var(--ui-scale));
  background: rgba(15, 23, 42, .8);
  color: #fff;
  font-family: var(--font-mono);
  font-size: calc(var(--text-micro) * var(--ui-scale));
  white-space: nowrap;
}
  &.is-dragging .selection-size,
  &.is-resizing .selection-size { display: block; }
.sel-handle {
  position: absolute;
  width: calc(8px * var(--ui-scale));
  height: calc(8px * var(--ui-scale));
  background: #fff;
  border: calc(1.5px * var(--ui-scale)) solid var(--accent);
  border-radius: calc(1.5px * var(--ui-scale));
  pointer-events: auto;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .16);
}
.sel-handle[data-dir="nw"] { cursor: nwse-resize; }
.sel-handle[data-dir="n"] { cursor: ns-resize; }
.sel-handle[data-dir="ne"] { cursor: nesw-resize; }
.sel-handle[data-dir="e"] { cursor: ew-resize; }
.sel-handle[data-dir="se"] { cursor: nwse-resize; }
.sel-handle[data-dir="s"] { cursor: ns-resize; }
.sel-handle[data-dir="sw"] { cursor: nesw-resize; }
.sel-handle[data-dir="w"] { cursor: ew-resize; }
.snap-guide-x, .snap-guide-y { position: absolute; z-index: 25; background: #e24ea1; pointer-events: none; display: none; }
.snap-guide-x { top: 0; bottom: 0; width: calc(1px * var(--ui-scale)); }
.snap-guide-y { left: 0; right: 0; height: calc(1px * var(--ui-scale)); }
.snap-guide-x::after, .snap-guide-y::after { content: ""; position: absolute; background: #e24ea1; border-radius: 50%; width: calc(4px * var(--ui-scale)); height: calc(4px * var(--ui-scale)); }

/* ---------------------------------------------------------
   Inspector
   --------------------------------------------------------- */
.inspector-head {
  height: 60px;
  flex: 0 0 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px 0 16px;
  border-bottom: 1px solid var(--line-soft);
}
.inspector-head > div { display: flex; flex-direction: column; gap: 3px; }
.inspector-head h2 { font-size: var(--text-control); font-weight: 680; color: #283449; letter-spacing: -.01em; }
.inspector-sub { font-size: var(--text-caption); color: #9aa4b4; }
.inspector-tabs {
  height: 38px;
  flex: 0 0 38px;
  display: flex;
  align-items: flex-end;
  gap: 17px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
}
.inspector-tab {
  height: 36px;
  padding: 0 1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #8c98a9;
  font-size: var(--text-meta);
  font-weight: 550;
  transition: color .12s ease, border-color .12s ease;
}
.inspector-tab:hover { color: #48566b; }
.inspector-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
.inspector-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 16px 18px; }
.prop-selection {
  margin-top: 13px;
  padding: 9px;
  border: 1px solid #e4ebff;
  border-radius: 9px;
  background: linear-gradient(145deg, #f8faff, #f2f6ff);
  display: flex;
  align-items: center;
  gap: 9px;
}
.prop-element-icon { width: 31px; height: 31px; border-radius: 7px; background: #fff; color: var(--accent); border: 1px solid #e1e9ff; display: grid; place-items: center; flex: 0 0 auto; box-shadow: 0 1px 3px rgba(51, 92, 255, .07); }
.prop-element-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.prop-element-copy strong { font-size: var(--text-label); font-weight: 650; color: #2d3a52; line-height: 1.15; }
.prop-element-copy span { font-family: var(--font-mono); font-size: var(--text-micro); color: #7b89a2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prop-type-tag { font-size: var(--text-micro); color: #5b6f95; background: #fff; border: 1px solid #e0e8f8; border-radius: 4px; padding: 2px 4px; white-space: nowrap; }
.prop-section { padding: 14px 0 15px; border-bottom: 1px solid var(--line-soft); }
.prop-section:last-child { border-bottom: 0; }
.prop-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.prop-section-head h3 { font-size: var(--text-meta); font-weight: 650; color: #46546a; letter-spacing: .01em; }
.prop-section-head .prop-link { border: 0; background: transparent; color: var(--accent); font-size: var(--text-caption); padding: 2px 3px; border-radius: 3px; }
.prop-section-head .prop-link:hover { background: var(--accent-soft); }
.binding-box {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 7px;
  border: 1px solid #e5eaf3;
  border-radius: 7px;
  background: #f8fafd;
  color: #4e5f7a;
}
.binding-box .binding-icon { color: #7387ad; }
.binding-path { flex: 1; border: 0; background: transparent; outline: 0; font-family: var(--font-mono); font-size: var(--text-caption); color: #445a7e; min-width: 0; }
.binding-copy { border: 0; background: transparent; color: #a0aabb; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 4px; }
.binding-copy:hover { background: #eef3fb; color: var(--accent); }
.binding-meta { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: var(--text-micro); color: #98a3b3; }
.binding-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: #c6cedb; }
.binding-meta .sample { margin-left: auto; color: #6f7c90; font-family: var(--font-mono); font-size: var(--text-micro); }
.control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.control-row { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.control-row.full { grid-column: 1 / -1; }
.control-label { font-size: var(--text-caption); color: #8d98a9; display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.control-label span { color: #afb8c5; font-family: var(--font-mono); font-size: var(--text-micro); }
.control {
  width: 100%;
  height: 31px;
  border: 1px solid #e4e9f2;
  border-radius: 7px;
  background: #fff;
  color: #3a485e;
  font-size: var(--text-control);
  padding: 0 8px;
  outline: 0;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.control:hover { border-color: #d5deea; }
.control:focus { border-color: #aabfff; box-shadow: 0 0 0 3px rgba(51, 92, 255, .08); }
.control::placeholder { color: #b0b9c6; }
.input-suffix { position: relative; }
.input-suffix .control { padding-right: 26px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--text-control); }
.input-suffix em { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: var(--text-micro); color: #a5afbd; pointer-events: none; }
.select-wrap { position: relative; }
.select-wrap::after { content: ""; position: absolute; right: 9px; top: 50%; width: 5px; height: 5px; border-right: 1.2px solid #9aa5b5; border-bottom: 1.2px solid #9aa5b5; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.select-wrap .control { appearance: none; padding-right: 22px; cursor: pointer; }
.control-split { display: flex; gap: 0; }
.control-split .control:first-child { border-radius: 7px 0 0 7px; border-right: 0; }
.control-split .control:last-child { border-radius: 0 7px 7px 0; width: 48px; flex: 0 0 48px; padding: 0 4px; text-align: center; font-family: var(--font-mono); font-size: var(--text-control); color: #77849a; }
.color-control { height: 31px; display: flex; align-items: center; gap: 6px; border: 1px solid #e4e9f2; border-radius: 7px; padding: 0 6px; background: #fff; }
.color-control input[type="color"] { appearance: none; width: 19px; height: 19px; border: 0; border-radius: 4px; background: transparent; padding: 0; cursor: pointer; overflow: hidden; }
.color-control input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-control input[type="color"]::-webkit-color-swatch { border: 1px solid #dfe6ef; border-radius: 4px; }
.color-control .hex-input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-family: var(--font-mono); font-size: var(--text-control); color: #5a687e; text-transform: uppercase; }
.segmented { display: flex; background: #f5f7fa; border: 1px solid #e9edf4; border-radius: 7px; padding: 2px; gap: 1px; }
.segmented button { flex: 1; height: 26px; border: 0; border-radius: 5px; background: transparent; color: #8490a3; display: grid; place-items: center; transition: background .12s ease, color .12s ease, box-shadow .12s ease; }
.segmented button:hover { color: #435168; }
.segmented button.is-active { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }
.segmented .icon { width: 15px; height: 15px; }
.size-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair-control { display: flex; align-items: center; gap: 0; border: 1px solid #e4e9f2; border-radius: 7px; overflow: hidden; background: #fff; }
.pair-control label { font-family: var(--font-mono); font-size: var(--text-micro); color: #a4aebc; padding-left: 7px; width: 18px; flex: 0 0 auto; }
.pair-control input { min-width: 0; width: 100%; height: 29px; border: 0; outline: 0; background: transparent; font-family: var(--font-mono); font-size: var(--text-control); color: #46546a; padding: 0 4px; }
.pair-control em { font-style: normal; font-size: var(--text-micro); color: #a5afbd; padding-right: 7px; }
.option-line { display: flex; align-items: center; justify-content: space-between; min-height: 30px; }
.option-line > span { font-size: var(--text-caption); color: #77849a; }
.switch { position: relative; width: 28px; height: 16px; border-radius: 20px; background: #dbe2ec; border: 0; padding: 0; transition: background .15s ease; flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%; top: 2px; left: 2px; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .18); transition: left .15s ease; }
.switch.is-on { background: var(--accent); }
.switch.is-on::after { left: 14px; }
.selection-hint {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 8px 9px;
  background: #f8fafc;
  border: 1px solid #edf1f6;
  border-radius: 7px;
  color: #8b97a8;
  font-size: var(--text-caption);
  line-height: 1.55;
}
.selection-hint .icon { color: #98a6bb; margin-top: 1px; }
.inspector-footer {
  height: 46px;
  flex: 0 0 46px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  background: #fff;
}
.inspector-foot-btn { flex: 1; height: 30px; border: 0; background: transparent; border-radius: 6px; display: flex; align-items: center; justify-content: center; gap: 4px; color: #7d899a; font-size: var(--text-caption); }
.inspector-foot-btn:hover { background: #f4f7fb; color: #40506a; }
.inspector-foot-btn.danger:hover { background: #fff2f2; color: var(--danger); }

/* Data inspector */
.datasource-card { margin-top: 13px; border: 1px solid #e7ecf4; border-radius: 9px; padding: 10px; background: #fbfcfe; }
.datasource-card-head { display: flex; align-items: center; gap: 7px; }
.datasource-card-head .icon { color: var(--accent); }
.datasource-card-head strong { font-size: var(--text-meta); color: #3e4c63; font-weight: 640; }
.datasource-status { margin-left: auto; font-size: var(--text-micro); color: #168a63; background: #eaf9f2; border-radius: 4px; padding: 2px 4px; }
.datasource-path { margin-top: 8px; padding: 6px 7px; border: 1px solid #e9eef6; border-radius: 5px; background: #fff; font-family: var(--font-mono); font-size: var(--text-micro); color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sample-preview { margin-top: 9px; border: 1px solid #e8edf5; border-radius: 7px; overflow: hidden; }
.sample-preview-head { display: flex; align-items: center; justify-content: space-between; background: #f6f9fd; padding: 5px 7px; font-size: var(--text-micro); color: #8b97a8; }
.sample-preview-body { padding: 9px 8px; background: #fff; font-size: var(--text-label); color: #27364b; }
.sample-preview-body .money { font-size: var(--text-page-title); font-weight: 700; letter-spacing: -.02em; color: #1d3d9e; }
.format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
.event-card { margin-top: 13px; border: 1px solid #e8edf4; border-radius: 8px; overflow: hidden; }
.event-card + .event-card { margin-top: 8px; }
.event-card-head { display: flex; align-items: center; gap: 7px; padding: 8px 9px; background: #f9fbfd; border-bottom: 1px solid #edf1f6; }
.event-card-head .event-num { width: 17px; height: 17px; border-radius: 5px; background: #edf2ff; color: #4765ce; display: grid; place-items: center; font-family: var(--font-mono); font-size: var(--text-micro); }
.event-card-head strong { font-size: var(--text-caption); color: #536176; font-weight: 620; }
.event-card-head span { margin-left: auto; font-size: var(--text-micro); color: #a3adbc; }
.event-card-body { padding: 9px; display: flex; flex-direction: column; gap: 7px; }
.event-script { font-family: var(--font-mono); font-size: var(--text-micro); color: #62718a; background: #f7f9fc; border: 1px solid #edf1f6; border-radius: 5px; padding: 6px; line-height: 1.6; }
.event-script .key { color: #7b61e8; }
.event-script .str { color: #218a65; }
.add-event-btn { width: 100%; height: 31px; margin-top: 9px; border: 1px dashed #ccd7e5; border-radius: 7px; background: transparent; color: #8090a5; font-size: var(--text-caption); display: flex; align-items: center; justify-content: center; gap: 4px; }
.add-event-btn:hover { border-color: #a9bdf6; color: var(--accent); background: #fafbff; }

/* ---------------------------------------------------------
   Preview
   --------------------------------------------------------- */
.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #0b1220;
  color: #e7ecf5;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: scale(.995);
  transition: opacity .22s ease, visibility .22s ease, transform .22s ease;
}
.preview-overlay.is-open { opacity: 1; visibility: visible; transform: scale(1); }
.preview-header {
  height: 64px;
  flex: 0 0 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: rgba(12, 19, 33, .82);
  backdrop-filter: blur(14px);
}
.preview-title { display: flex; align-items: center; gap: 10px; }
.preview-back { width: 30px; height: 30px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 7px; background: rgba(255, 255, 255, .03); color: #b8c4d7; display: grid; place-items: center; }
.preview-back:hover { background: rgba(255, 255, 255, .08); }
.preview-mark { width: 32px; height: 32px; border-radius: 9px; background: rgba(51, 92, 255, .18); border: 1px solid rgba(120, 150, 255, .28); color: #8da7ff; display: grid; place-items: center; }
.preview-title > div { display: flex; flex-direction: column; gap: 2px; }
.preview-title h2 { font-size: var(--text-section-title); font-weight: 650; letter-spacing: -.01em; color: #f1f5fb; }
.preview-title p { font-size: var(--text-caption); color: #8b9ab1; }
.preview-actions { display: flex; align-items: center; gap: 8px; }
.preview-data-badge { display: flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: var(--text-caption); color: #96a5bc; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); padding: 5px 8px; border-radius: 5px; white-space: nowrap; }
.preview-data-badge i { width: 5px; height: 5px; border-radius: 50%; background: #35d49b; box-shadow: 0 0 0 3px rgba(53, 212, 155, .12); }
.btn.on-dark.btn-ghost { color: #b8c4d6; }
.btn.on-dark.btn-ghost:hover { background: rgba(255, 255, 255, .07); }
.btn.on-dark.btn-secondary { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); color: #e0e7f1; box-shadow: none; }
.btn.on-dark.btn-secondary:hover { background: rgba(255, 255, 255, .12); }
.icon-btn.on-dark { color: #9caabd; }
.icon-btn.on-dark:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.preview-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 248px 1fr; }
.preview-sidebar {
  background: #0e1726;
  border-right: 1px solid rgba(255, 255, 255, .07);
  padding: 20px 17px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.preview-side-section { display: flex; flex-direction: column; gap: 8px; }
.preview-label { font-size: var(--text-micro); letter-spacing: .12em; text-transform: uppercase; color: #65758c; font-weight: 650; }
.preview-side-section > strong { font-size: var(--text-body); color: #dce5f2; font-weight: 600; line-height: 1.4; }
.preview-muted { font-size: var(--text-caption); color: #7889a0; }
.preview-data-row { display: flex; justify-content: space-between; gap: 10px; font-size: var(--text-caption); color: #7c8ca2; }
.preview-data-row b { color: #c2ccda; font-weight: 500; text-align: right; max-width: 145px; line-height: 1.5; }
.preview-data-row b.money { color: #8fa9ff; font-family: var(--font-mono); font-size: var(--text-meta); }
.preview-mini-pages { gap: 6px; }
.preview-page-thumb {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 7px;
  color: #8292a8;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.preview-page-thumb:hover { background: rgba(255, 255, 255, .035); }
.preview-page-thumb.is-active { border-color: rgba(92, 126, 255, .55); background: rgba(51, 92, 255, .11); color: #cbd7eb; }
.preview-page-thumb > span { width: 22px; height: 27px; border-radius: 2px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); display: grid; place-items: center; font-family: var(--font-mono); font-size: var(--text-micro); flex: 0 0 auto; }
.preview-page-thumb.is-active > span { background: #f6f8ff; color: #263659; border-color: #fff; }
.preview-page-thumb small { font-size: var(--text-caption); }
.preview-note { margin-top: auto; display: flex; gap: 6px; align-items: flex-start; font-size: var(--text-caption); line-height: 1.6; color: #74859c; border-top: 1px solid rgba(255, 255, 255, .07); padding-top: 15px; }
.preview-note .icon { color: #8a9fff; margin-top: 1px; }
.preview-stage {
  min-width: 0;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 34px 30px 60px;
  background-color: #111b2c;
  background-image: radial-gradient(circle, rgba(166, 183, 211, .13) .7px, transparent .7px);
  background-size: 18px 18px;
}
.preview-page-wrap { display: flex; flex-direction: column; align-items: center; gap: 11px; }
.preview-page-scale { position: relative; background: #fff; box-shadow: 0 30px 80px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .08); transform-origin: top center; }
.preview-page-scale .page { position: relative; transform-origin: top left; }
.preview-page-label { font-family: var(--font-mono); font-size: var(--text-caption); color: #7c8da4; letter-spacing: .04em; }
.preview-footer {
  height: 42px;
  flex: 0 0 42px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: #0b1220;
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  color: #6c7c93;
}
.preview-pager { display: flex; align-items: center; gap: 8px; font-size: var(--text-caption); color: #8495ad; }
.preview-pager b { color: #e5ebf5; font-weight: 600; }
.preview-page-btn { width: 25px; height: 25px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 5px; background: transparent; color: #8c9cb2; display: grid; place-items: center; }
.preview-page-btn:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.preview-page-scale .selection-box,
.preview-page-scale .snap-guide-x,
.preview-page-scale .snap-guide-y,
.preview-page-scale .page-grid,
.preview-page-scale .page-band-label { display: none !important; }
.preview-page-scale .band-zone { display: none !important; }
.preview-page-scale .obj { cursor: default; }
.preview-page-scale .obj:hover { outline: 0; }
.preview-page-scale .obj-field:hover .field-value { border-bottom-color: transparent; background: transparent; }
.preview-page-scale .obj-field:hover::after { opacity: 0; }

/* Toasts & tooltips */
.toast-stack { position: fixed; left: calc(50% - 25px); bottom: 48px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 7px; z-index: 400; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(17, 24, 39, .93);
  color: #f4f7fb;
  border: 1px solid rgba(255, 255, 255, .09);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
  border-radius: 8px;
  height: 34px;
  padding: 0 12px;
  font-size: var(--text-meta);
  white-space: nowrap;
  backdrop-filter: blur(10px);
  animation: forma-toast-in .22s ease both;
}
.toast.is-leaving { animation: forma-toast-out .2s ease both; }
.toast .toast-icon { width: 16px; height: 16px; border-radius: 50%; background: rgba(48, 201, 146, .2); color: #62e0b5; display: grid; place-items: center; }
.toast .toast-icon .icon { width: 10px; height: 10px; stroke-width: 2.4; }
.toast .toast-dot { width: 4px; height: 4px; border-radius: 50%; background: #67748b; }

/* Utility & interaction states */
.is-filtered { display: none !important; }
.empty-inspector {
  padding: 54px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 7px;
  color: #909cad;
}
.empty-icon { width: 44px; height: 44px; border-radius: 12px; background: #f3f6fb; color: #9dacbf; display: grid; place-items: center; margin-bottom: 4px; }
.empty-inspector strong { font-size: var(--text-label); color: #5d6b80; font-weight: 600; }
.empty-inspector p { margin: 0; font-size: var(--text-caption); line-height: 1.7; color: #9ba6b6; }
.range { width: 100%; height: 20px; appearance: none; background: transparent; padding: 0; margin: 0; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 3px; border-radius: 20px; background: linear-gradient(to right, #7e95f8, #dbe2ec); }
.range::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); margin-top: -4.5px; box-shadow: 0 1px 3px rgba(16, 24, 40, .18); }
.selection-box.is-locked .sel-handle { display: none !important; }
.selection-box.is-locked .selection-label { background: #64748b; }
  &.is-dragging, &.is-resizing { cursor: grabbing; }
  &.is-dragging .obj, &.is-resizing .obj { transition: none; }
  &.is-dragging .canvas-tip, &.is-resizing .canvas-tip { opacity: 0; }
.workspace.tool-pan .canvas-shell { cursor: grab; }
.workspace.tool-pan .page .obj { cursor: default; }
.canvas-shell.is-panning { cursor: grabbing !important; }
.canvas-stage.hide-rulers .ruler,
.canvas-stage.hide-rulers .ruler-corner { display: none; }
.canvas-stage.hide-rulers .canvas-shell { inset: 0; }
.obj-line { min-height: 1px; }
.obj-shape { border-style: solid; }
.select-wrap select { color: #3a485e; }

/* Empty SVG icon default fallback for inline text */
.icon-22 { width: 22px; height: 22px; }

[data-tip] { position: relative; }
[data-tip]::before {
  content: attr(data-tip);
  position: absolute;
  z-index: 100;
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translateX(-50%) translateY(2px);
  background: #111827;
  color: #f5f8fd;
  border-radius: 5px;
  padding: 5px 7px;
  font-size: var(--text-caption);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease .25s, transform .12s ease .25s;
}
[data-tip]:hover::before { opacity: 1; transform: translateX(-50%) translateY(0); }
.icon-btn[data-tip]::before, .tool-btn[data-tip]::before, .mini-icon-btn[data-tip]::before { z-index: 300; }

@media (max-width: 1360px) {
  .left-panel { width: 258px; flex-basis: 258px; }
  .inspector { width: 306px; flex-basis: 306px; }
  .brand { width: 230px; flex-basis: 230px; }
  .doc-context { min-width: 300px; }
  .header-actions { gap: 6px; }
  .btn-key { display: none; }
  .element-card { height: 61px; }
  .canvas-tip { left: calc(258px + (100vw - 258px - 306px) / 2); }
}
@media (max-width: 1240px) {
  .left-panel { width: 244px; flex-basis: 244px; }
  .inspector { width: 292px; flex-basis: 292px; }
  .brand { width: 218px; flex-basis: 218px; }
  .brand-env { display: none; }
  .save-state { display: none; }
  .doc-context { min-width: 260px; }
  .canvas-tip { left: calc(244px + (100vw - 244px - 292px) / 2); }
  .element-grid { gap: 5px; }
  .toolbar-divider:nth-of-type(2) { display: none; }
}

/* Print output is rendered by PrintEngine inside a temporary iframe. */

/* =========================================================
   Readability pass — UI chrome only (print paper untouched)
   ========================================================= */
.brand-copy span { font-size: var(--text-label); }
.breadcrumb { font-size: var(--text-label); }
.doc-title-line h1 { font-size: var(--text-page-title); }
.version-chip { font-size: var(--text-meta); }
.draft-indicator { font-size: var(--text-meta); }
.save-state { font-size: var(--text-label); }
.btn { font-size: var(--text-control); }
.btn-key { font-size: var(--text-meta); }
.avatar { font-size: var(--text-label); }
.side-tab { font-size: var(--text-body); }
.search-box input { font-size: var(--text-body); }
.search-box kbd { font-size: var(--text-meta); }
.section-heading h2 { font-size: var(--text-body); }
.section-heading > span { font-size: var(--text-meta); }
.element-name { font-size: var(--text-label); }
.element-hint { font-size: var(--text-caption); }
.smart-card strong { font-size: var(--text-label); }
.smart-card small { font-size: var(--text-caption); }
.page-setup-title { font-size: var(--text-body); }
.page-setup-copy small { font-size: var(--text-meta); }
.page-setup-badge { font-size: var(--text-caption); }
.structure-name { font-size: var(--text-label); }
.structure-meta { font-size: var(--text-caption); }
.repeat-badge { font-size: var(--text-caption); }
.side-footer-tip { font-size: var(--text-meta); }
.data-source-head strong { font-size: var(--text-body); }
.data-source-head small { font-size: var(--text-meta); }
.data-source-foot { font-size: var(--text-caption); }
.field-group-head strong { font-size: var(--text-label); }
.field-item strong { font-size: var(--text-label); }
.field-item small { font-size: var(--text-caption); }
.field-item .field-add { font-size: var(--text-label); }
.layer-toolbar { font-size: var(--text-label); }
.layer-group-head { font-size: var(--text-label); }
.layer-item { font-size: var(--text-meta); }
.canvas-preset { font-size: var(--text-label); }
.zoom-value { font-size: var(--text-label); }
.canvas-tip { font-size: var(--text-meta); }
.band-tag { font-size: var(--text-meta); }
.ruler-label { font-size: var(--text-micro); }
.ruler-corner { font-size: var(--text-micro); }
.workspace-footer { font-size: var(--text-meta); }
.status-left .mono { font-size: var(--text-meta); }
.prototype-badge { font-size: var(--text-caption); }
.inspector-head h2 { font-size: var(--text-section-title); }
.inspector-sub { font-size: var(--text-meta); }
.inspector-tab { font-size: var(--text-control); }
.prop-element-copy strong { font-size: var(--text-body); }
.prop-element-copy span { font-size: var(--text-caption); }
.prop-type-tag { font-size: var(--text-caption); }
.prop-section-head h3 { font-size: var(--text-label); }
.prop-section-head .prop-link { font-size: var(--text-meta); }
.binding-path { font-size: var(--text-meta); }
.binding-meta { font-size: var(--text-caption); }
.binding-meta .sample { font-size: var(--text-caption); }
.control-label { font-size: var(--text-meta); }
.control { font-size: var(--text-control); }
.input-suffix .control { font-size: var(--text-control); }
.color-control .hex-input { font-size: var(--text-control); }
.selection-hint { font-size: var(--text-meta); }
.inspector-foot-btn { font-size: var(--text-meta); }
.datasource-card-head strong { font-size: var(--text-label); }
.datasource-path { font-size: var(--text-caption); }
.sample-preview-head { font-size: var(--text-caption); }
.sample-preview-body { font-size: var(--text-label); }
.event-card-head strong { font-size: var(--text-meta); }
.event-script { font-size: var(--text-caption); }
.add-event-btn { font-size: var(--text-meta); }
.preview-title h2 { font-size: var(--text-panel-title); }
.preview-title p { font-size: var(--text-meta); }
.preview-data-badge { font-size: var(--text-meta); }
.preview-side-section > strong { font-size: var(--text-body); }
.preview-data-row { font-size: var(--text-meta); }
.preview-data-row b.money { font-size: var(--text-label); }
.preview-page-thumb small { font-size: var(--text-meta); }
.preview-note { font-size: var(--text-meta); }
.preview-page-label { font-size: var(--text-meta); }
.preview-footer { font-size: var(--text-caption); }
.preview-pager { font-size: var(--text-meta); }
.toast { font-size: var(--text-label); }
[data-tip]::before { font-size: var(--text-meta); }

@media (max-width: 1360px) {
  .element-card { height: 63px; }
}

/* =========================================================
   Functional UI additions
   ========================================================= */
[hidden] { display: none !important; }

.qr-live {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.qr-live canvas,
.qr-live img {
  width: 100% !important;
  height: 100% !important;
  display: block;
  object-fit: contain;
}
.barcode-live {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.control-textarea {
  width: 100%;
  min-height: 78px;
  height: auto;
  padding: 8px 9px;
  resize: vertical;
  line-height: 1.6;
  font-size: var(--text-meta);
  border: 1px solid #e4e9f2;
  border-radius: 7px;
  background: #fff;
  outline: 0;
}
.control-textarea:focus { border-color: #aabfff; box-shadow: 0 0 0 3px rgba(51, 92, 255, .08); }

/* Template file menu */
.template-menu {
  position: fixed;
  z-index: 280;
  width: 250px;
  border: 1px solid #e6ebf3;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 20px 55px rgba(16, 24, 40, .18), 0 3px 8px rgba(16, 24, 40, .06);
  padding: 7px;
  animation: forma-menu-in .14s ease both;
}
.template-menu-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 10px;
  border-bottom: 1px solid #eef2f7;
}
.template-menu-icon { width: 30px; height: 30px; border-radius: 8px; background: #eef2ff; color: var(--accent); display: grid; place-items: center; flex: 0 0 auto; }
.template-menu-head > div { display: flex; flex-direction: column; gap: 2px; }
.template-menu-head strong { font-size: var(--text-label); color: #344054; font-weight: 650; }
.template-menu-head small { font-size: var(--text-caption); color: #9aa5b5; }
.template-menu-section { padding: 6px 0; border-bottom: 1px solid #f1f4f8; }
.template-menu-section:last-of-type { border-bottom: 0; }
.template-menu-section button {
  width: 100%;
  height: 33px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  color: #55647a;
  font-size: var(--text-meta);
  text-align: left;
}
.template-menu-section button:hover { background: #f5f8fd; color: #2e4cb4; }
.template-menu-section button .icon { color: #8a98ac; }
.template-menu-section button:hover .icon { color: var(--accent); }
.template-menu-section button kbd { margin-left: auto; font-size: var(--text-micro); color: #a4aebc; background: #f5f7fa; border: 1px solid #e9edf4; border-radius: 3px; padding: 2px 4px; }
.template-menu-foot { display: flex; align-items: center; justify-content: space-between; padding: 9px 8px 4px; font-size: var(--text-micro); color: #a0aab8; }
.template-menu-foot > span { display: flex; align-items: center; gap: 3px; }
.template-menu-foot kbd { font-size: var(--text-micro); color: #98a3b3; background: #f6f8fb; border-radius: 3px; padding: 2px 4px; }

/* Modal */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease;
}
.modal-layer.is-open { opacity: 1; visibility: visible; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(12, 20, 34, .46); backdrop-filter: blur(3px); }
.modal-card {
  position: relative;
  width: 460px;
  max-width: calc(100% - 40px);
  max-height: calc(100% - 40px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 13px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .28), 0 0 0 1px rgba(15, 23, 42, .06);
  overflow: hidden;
  transform: translateY(6px) scale(.995);
  transition: transform .18s ease;
}
.modal-layer.is-open .modal-card { transform: translateY(0) scale(1); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 20px 14px; border-bottom: 1px solid #edf1f6; flex: 0 0 auto; }
.modal-head h2 { font-size: var(--text-page-title); color: #283449; font-weight: 680; letter-spacing: -.015em; }
.modal-head p { margin-top: 4px; font-size: var(--text-meta); color: #93a0b1; }
.modal-body { flex: 1; min-height: 0; padding: 18px 20px 6px; overflow-y: auto; }
.setup-preview { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; background: linear-gradient(145deg, #f8faff, #f2f6ff); border: 1px solid #e5ebff; }
.setup-paper { width: 50px; height: 68px; background: #fff; border: 1px solid #dbe3f0; border-radius: 3px; box-shadow: 0 3px 8px rgba(30, 41, 59, .08); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; flex: 0 0 auto; position: relative; }
.setup-paper::before { content: ""; position: absolute; left: 7px; top: 7px; width: 34px; height: 2px; background: #c7d3e4; border-radius: 2px; }
.setup-paper::after { content: ""; position: absolute; left: 7px; top: 12px; width: 34px; height: 35px; border-radius: 2px; background: repeating-linear-gradient(to bottom, #e1e9f4 0 1px, transparent 1px 5px); }
.setup-paper b { position: relative; z-index: 1; font-family: var(--font-mono); font-size: var(--text-meta); color: #51627c; margin-top: 10px; }
.setup-paper small { position: relative; z-index: 1; font-size: var(--text-micro); color: #9da8b8; }
.setup-paper i { display: none; }
.setup-paper-meta { display: flex; flex-direction: column; gap: 5px; }
.setup-paper-meta strong { color: #334155; font-size: var(--text-body); font-weight: 650; }
.setup-paper-meta small { color: #8f9bac; font-size: var(--text-caption); }
.setup-group { padding: 16px 0 13px; border-bottom: 1px solid #eef2f7; }
.setup-group:last-child { border-bottom: 0; }
.setup-group h3 { font-size: var(--text-section-title); font-weight: 650; color: #45546a; margin-bottom: 11px; }
.setup-field { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; font-size: var(--text-meta); color: #637086; }
.setup-field .control { width: 140px; }
.setup-hint { margin: 7px 0 0; padding: 8px 9px; background: #f8fafc; border: 1px solid #eef2f7; border-radius: 6px; font-size: var(--text-caption); line-height: 1.55; color: #98a4b5; }
.setup-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.setup-info-grid span { padding: 8px 9px; border: 1px solid #edf1f6; border-radius: 7px; background: #fbfcfe; font-size: var(--text-caption); color: #95a0b1; }
.setup-info-grid b { color: #536176; font-weight: 600; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 7px; padding: 13px 20px 18px; flex: 0 0 auto; }
.modal-foot-note { margin-right: auto; font-size: var(--text-caption); color: #a5afbd; }
.modal-foot .btn:disabled { opacity: .45; cursor: not-allowed; }

/* Preview additions */
#previewPageList { display: flex; flex-direction: column; gap: 6px; }
.preview-page-thumb {
  width: 100%;
  font-family: var(--font-sans);
  text-align: left;
  appearance: none;
}
.preview-page-btn:disabled { opacity: .32; pointer-events: none; }
.preview-page-scale { background: transparent; }
.preview-page-scale .pd-page { background: #fff; }

@media (max-width: 1360px) {
  .template-menu { width: 236px; }
}

/* =========================================================
   Detail table component
   ========================================================= */
.obj-detail-table { z-index: 7; cursor: default; }
.obj-detail-table:hover { outline: 1px dashed rgba(51, 92, 255, .35); outline-offset: 2px; }
.detail-table-clip {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: .2mm solid var(--dt-border, #e8edf4);
  border-radius: 1mm;
  background: var(--dt-row-bg, #fff);
}
.design-detail-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}
.design-detail-table th,
.design-detail-table td {
  box-sizing: border-box;
  height: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  line-height: 1.2;
}
.design-detail-table th {
  position: relative;
  font-weight: 590;
  border-bottom: .2mm solid rgba(255, 255, 255, .08);
}
.design-detail-table td {
  background: var(--dt-row-bg, #fff);
  border-bottom: .2mm solid var(--dt-border, #e8edf4);
}
.design-detail-table tbody tr:nth-child(even) td { background: var(--dt-stripe, #f8fafd); }
.design-detail-table tbody tr:last-child td { border-bottom: 0; }
.design-detail-table tbody tr.is-continuation td { background: #f7f9ff; }
.design-detail-table tbody tr.is-capped td { border-bottom-style: dashed; }
.design-cell-content { display: block; min-width: 0; overflow: hidden; }
.table-continue-mark {
  display: inline-flex;
  align-items: center;
  height: 3.2mm;
  margin-right: 1mm;
  padding: 0 1mm;
  border-radius: .8mm;
  background: #e7eeff;
  color: #3155c8;
  font-family: var(--font-sans);
  font-size: 5.8pt;
  font-weight: 650;
  vertical-align: middle;
}
.design-detail-table th.is-active-column { box-shadow: inset 0 0 0 .22mm rgba(255, 255, 255, .5); }
.design-detail-table td.is-active-column { box-shadow: inset 0 0 0 .22mm rgba(51, 92, 255, .48); }

/* Table inspector */
.table-meta-row {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  font-size: var(--text-caption);
  color: #96a1b1;
}
.table-meta-row b { color: #5e6d83; font-weight: 600; }
.table-column-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 190px;
  overflow-y: auto;
  padding-right: 2px;
}
.table-column-item {
  width: 100%;
  min-height: 35px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border: 1px solid #e9edf4;
  border-radius: 7px;
  background: #fff;
  text-align: left;
  color: #5d6b80;
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.table-column-item:hover { border-color: #c6d2ff; background: #fbfcff; }
.table-column-item.is-active { border-color: #bfcdff; background: #f3f7ff; box-shadow: inset 0 0 0 1px rgba(51, 92, 255, .06); }
.table-column-no {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 5px;
  background: #f1f4f9;
  color: #8c98a9;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: var(--text-micro);
}
.table-column-item.is-active .table-column-no { background: #e4ecff; color: #3b5bd6; }
.table-column-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.table-column-copy strong { font-size: var(--text-meta); font-weight: 600; color: #4b5a70; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-column-copy small { font-family: var(--font-mono); font-size: var(--text-micro); color: #9da8b7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-column-width { font-family: var(--font-mono); font-size: var(--text-micro); color: #98a3b2; white-space: nowrap; }
.column-binding-row { display: flex; gap: 5px; align-items: center; }
.column-binding-row .control { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: var(--text-caption); }
.mini-action-btn {
  height: 31px;
  flex: 0 0 auto;
  padding: 0 7px;
  border: 1px solid #e4e9f2;
  border-radius: 7px;
  background: #fff;
  color: #718096;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-caption);
  white-space: nowrap;
}
.mini-action-btn:hover { border-color: #b9c8ff; color: var(--accent); background: #fafbff; }
.table-column-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px dashed #edf1f6;
}
.table-column-actions button {
  height: 26px;
  flex: 1;
  border: 1px solid #e8edf5;
  border-radius: 6px;
  background: #fff;
  color: #7b8799;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: var(--text-caption);
}
.table-column-actions button:hover { border-color: #c4d1f7; color: var(--accent); background: #fbfcff; }
.table-column-actions button.danger { color: #c15b63; }
.table-column-actions button.danger:hover { border-color: #f1c4c7; background: #fff7f7; color: var(--danger); }
.table-field-list { display: flex; flex-direction: column; gap: 3px; }
.table-field-row {
  width: 100%;
  height: 30px;
  padding: 0 7px;
  border: 1px solid #edf1f6;
  border-radius: 6px;
  background: #fbfcfe;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #66748b;
  text-align: left;
}
.table-field-row:hover { border-color: #cbd6ff; background: #f7f9ff; }
.table-field-row span { font-size: var(--text-caption); white-space: nowrap; }
.table-field-row code { margin-left: auto; font-family: var(--font-mono); font-size: var(--text-micro); color: #8d99aa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-align-segmented button { height: 25px; }
.prop-link .icon { display: inline-block; vertical-align: -2px; }

/* Band selection from structure tree / gutter tags */
.band-tag {
  cursor: pointer;
  font-family: var(--font-sans);
  text-align: left;
  appearance: none;
}
.band-tag:hover { border-color: #bfcdf7; color: #465777; background: #fff; }
.band-tag.is-selected { border-color: #aebfff; box-shadow: 0 0 0 3px rgba(51, 92, 255, .08); }
.band-selection {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 24;
  display: none;
  pointer-events: none;
  border: calc(1.5px * var(--ui-scale)) dashed #3f65ff;
  background: rgba(51, 92, 255, .035);
  box-shadow: inset 0 0 0 calc(1px * var(--ui-scale)) rgba(255, 255, 255, .55);
}
.band-selection::before {
  content: "";
  position: absolute;
  left: calc(-1px * var(--ui-scale));
  top: calc(-1px * var(--ui-scale));
  bottom: calc(-1px * var(--ui-scale));
  width: calc(3px * var(--ui-scale));
  background: #335cff;
  border-radius: calc(2px * var(--ui-scale));
}
.band-selection > span {
  position: absolute;
  left: calc(-1px * var(--ui-scale));
  bottom: 100%;
  margin-bottom: calc(4px * var(--ui-scale));
  height: calc(18px * var(--ui-scale));
  padding: 0 calc(7px * var(--ui-scale));
  border-radius: calc(4px * var(--ui-scale)) calc(4px * var(--ui-scale)) calc(4px * var(--ui-scale)) 0;
  background: #335cff;
  color: #fff;
  display: flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: calc(var(--text-caption) * var(--ui-scale));
  font-weight: 560;
  letter-spacing: .01em;
  white-space: nowrap;
  box-shadow: 0 calc(2px * var(--ui-scale)) calc(6px * var(--ui-scale)) rgba(51, 92, 255, .25);
}
.band-element-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 235px;
  overflow-y: auto;
  padding-right: 2px;
}
.band-element-item {
  width: 100%;
  min-height: 31px;
  padding: 4px 6px;
  border: 1px solid #edf1f6;
  border-radius: 6px;
  background: #fbfcfe;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #5e6c81;
  text-align: left;
}
.band-element-item:hover { border-color: #c4d2ff; background: #f7f9ff; color: #3454c7; }
.band-element-icon { width: 20px; height: 20px; flex: 0 0 auto; border-radius: 5px; background: #f1f4f9; color: #8b97a8; display: grid; place-items: center; }
.band-element-item:hover .band-element-icon { background: #eaf0ff; color: var(--accent); }
.band-element-name { font-size: var(--text-caption); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.band-element-item code { margin-left: auto; max-width: 92px; font-family: var(--font-mono); font-size: var(--text-micro); color: #9ba6b5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.band-empty { padding: 18px 8px; text-align: center; font-size: var(--text-caption); color: #a1acba; }
.band-prop-selection .prop-element-icon { color: #4e65c9; }

/* Dynamic template decorations */
.deco-line {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  border-radius: .2mm;
}

/* Dynamic page size controls */
#pageSetupName,
#canvasPreset {
  display: inline-block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
#canvasPreset { max-width: 120px; }
.modal-body { max-height: none; }
.setup-paper {
  width: 50px;
  height: 68px;
  min-width: 22px;
  min-height: 22px;
  padding: 0;
}
.setup-paper::before {
  left: 12%;
  top: 8%;
  width: 76%;
  height: 2px;
}
.setup-paper::after {
  left: 12%;
  top: 16%;
  width: 76%;
  height: 52%;
}
.setup-paper b { font-size: var(--text-caption); margin-top: 12%; }
.setup-paper.is-short b { display: none; }
.setup-paper.is-narrow b { font-size: var(--text-micro); }
.setup-size-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 8px; }
.setup-size-field { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-caption); color: #8b97a8; }
.setup-size-field .control { width: 100%; }
.setup-field .control { min-width: 150px; }

/* Focus canvas mode: fills the designer container */
.zoom-btn.canvas-focus-btn.is-active { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.app.canvas-focus .app-header,
.app.canvas-focus .left-panel,
.app.canvas-focus .inspector,
.app.canvas-focus .workspace-footer { display: none !important; }
.app.canvas-focus .app-main { height: 100%; }
.app.canvas-focus .workspace { width: 100%; flex: 1 1 auto; }
.app.canvas-focus .design-toolbar { border-bottom-color: #dfe5ef; }

/* Band visibility */
.structure-visibility {
  width: 20px;
  height: 20px;
  margin-left: 1px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: #b0bac7;
  flex: 0 0 auto;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.structure-visibility:hover { background: #eef3fb; color: #4969c9; }
.structure-row.is-hidden .structure-name,
.structure-row.is-hidden .structure-meta { opacity: .5; }
.structure-row.is-hidden .band-color { opacity: .35; }
.structure-row.is-hidden .structure-visibility { color: #9aa6b7; }
.band-tag.is-hidden {
  opacity: .66;
  border-style: dashed;
  color: #98a3b4;
}
.hidden-mini {
  margin-left: 2px;
  padding: 1px 3px;
  border-radius: 3px;
  background: #eef1f6;
  color: #9aa5b5;
  font-size: var(--text-micro);
  line-height: 1.1;
}
.band-zone.is-hidden {
  background-image: repeating-linear-gradient(135deg, rgba(143, 158, 181, .075) 0 2px, transparent 2px 9px) !important;
  border-top: 1px dashed rgba(148, 163, 184, .42);
  border-bottom: 1px dashed rgba(148, 163, 184, .42);
}
.hidden-band-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-sans);
  font-size: 6.5pt;
  letter-spacing: .08em;
  color: #a5afbd;
  background: rgba(255, 255, 255, .76);
  border: .2mm dashed #d8e0ea;
  border-radius: .8mm;
  padding: .6mm 1.8mm;
  white-space: nowrap;
}
.band-selection.is-hidden { border-style: dashed; opacity: .82; }

/* Custom regions */
.section-heading-actions { display: flex; align-items: center; gap: 2px; }
.repeat-badge.custom { color: #5c6f96; background: #eef2f8; }
.region-modal-card { width: min(560px, calc(100vw - 32px)); }
.region-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.region-type-card {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e4eaf4;
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.region-type-card:hover { border-color: #c9d7f4; background: #f9fbff; }
.region-type-card.is-active { border-color: #9ab3f4; background: #f2f6ff; box-shadow: 0 0 0 2px rgba(51, 92, 255, .07); }
.region-type-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #5874c8;
  background: #edf2ff;
}
.region-type-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.region-type-copy strong { font-size: var(--text-meta); font-weight: 620; color: #3d4d64; }
.region-type-copy small { font-size: var(--text-micro); color: #98a4b4; line-height: 1.35; }
.region-type-badge {
  margin-left: auto;
  flex: 0 0 auto;
  padding: 2px 4px;
  border-radius: 3px;
  color: #8b99ad;
  background: #f1f4f9;
  font-size: var(--text-micro);
  line-height: 1;
}
.region-order-actions { display: flex; align-items: center; gap: 6px; }
.region-order-actions .btn { height: 27px; padding: 0 9px; font-size: var(--text-caption); }
.region-order-actions .btn:disabled { opacity: .42; cursor: not-allowed; }
.region-delete-btn {
  margin-left: auto;
  height: 27px;
  padding: 0 9px;
  border: 1px solid #f0d3d5;
  border-radius: 6px;
  background: #fff;
  color: #c15b63;
  font-size: var(--text-caption);
  cursor: pointer;
}
.region-delete-btn:hover { background: #fff6f6; border-color: #e8b7bb; color: var(--danger); }
.setup-hint.is-warning { color: #b7791f; background: #fffaf0; border-color: #f3dfb4; }
@media (max-width: 700px) {
  .region-type-grid { grid-template-columns: 1fr; }
}

/* LODOP print bridge */
.lodop-print-btn { border-color: rgba(104, 139, 255, .34); }
.lodop-print-btn:hover { background: rgba(76, 111, 226, .18); }
.lodop-print-btn.is-loading { opacity: .62; cursor: wait; }
.lodop-help-card { width: min(520px, calc(100vw - 32px)); }
.lodop-status-card {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid #f1d9c2;
  border-radius: 8px;
  background: #fffaf4;
}
.lodop-status-dot {
  width: 8px;
  height: 8px;
  margin-top: 4px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #df8b38;
  box-shadow: 0 0 0 3px rgba(223, 139, 56, .12);
}
.lodop-status-card strong { display: block; font-size: var(--text-meta); color: #6b4b28; }
.lodop-status-card p { margin: 3px 0 0; font-size: var(--text-caption); line-height: 1.45; color: #9a7b58; }
.lodop-steps { margin: 0; padding-left: 17px; display: flex; flex-direction: column; gap: 5px; font-size: var(--text-caption); line-height: 1.5; color: #69778a; }
.lodop-steps code { font-family: var(--font-mono); font-size: var(--text-micro); color: #536177; background: #f3f6fa; border: 1px solid #e6ebf3; border-radius: 3px; padding: 1px 4px; }
.lodop-download-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
  font-size: var(--text-caption);
  color: #8b97a8;
}
.lodop-download-row a { color: #4969c9; text-decoration: none; font-weight: 620; }
.lodop-download-row a:hover { text-decoration: underline; }

/* =========================================================
   Panel readability — larger left library and inspector text
   ========================================================= */
.left-panel .side-tab { font-size: var(--text-control); }
.left-panel .search-box input { font-size: var(--text-control); }
.left-panel .search-box kbd { font-size: var(--text-meta); }
.left-panel .section-heading h2 { font-size: var(--text-section-title); }
.left-panel .section-heading > span { font-size: var(--text-label); }
.left-panel .section-badge { font-size: var(--text-meta); }
.left-panel .element-name { font-size: var(--text-body); }
.left-panel .element-hint { font-size: var(--text-meta); line-height: 1.15; }
.left-panel .smart-card strong { font-size: var(--text-body); }
.left-panel .smart-card small { font-size: var(--text-meta); }
.left-panel .page-setup-title { font-size: var(--text-section-title); }
.left-panel .page-setup-copy small { font-size: var(--text-meta); }
.left-panel .page-setup-badge { font-size: var(--text-meta); }
.left-panel .theme-copy strong { font-size: var(--text-body); }
.left-panel .theme-copy small { font-size: var(--text-meta); }
.left-panel .theme-link { font-size: var(--text-meta); }
.left-panel .side-footer-tip { font-size: var(--text-label); }
.left-panel .data-source-head strong { font-size: var(--text-control); }
.left-panel .data-source-head small { font-size: var(--text-meta); }
.left-panel .data-source-foot { font-size: var(--text-meta); }
.left-panel .field-group-head strong { font-size: var(--text-body); }
.left-panel .field-group-head span { font-size: var(--text-meta); }
.left-panel .field-item { height: 36px; }
.left-panel .field-item strong { font-size: var(--text-body); }
.left-panel .field-item small { font-size: var(--text-meta); }
.left-panel .field-search-empty { font-size: var(--text-label); }
.left-panel .layer-toolbar { font-size: var(--text-body); }
.left-panel .layer-group-head { font-size: var(--text-label); }
.left-panel .layer-group-head .layer-count { font-size: var(--text-caption); }
.left-panel .layer-item { font-size: var(--text-label); }
.left-panel .layer-item .layer-binding { font-size: var(--text-caption); }
.left-panel .structure-row { height: 34px; }
.left-panel .structure-name { font-size: var(--text-body); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.left-panel .structure-meta { font-size: var(--text-meta); }
.left-panel .repeat-badge { font-size: var(--text-caption); }

.inspector .inspector-head h2 { font-size: var(--text-panel-title); }
.inspector .inspector-sub { font-size: var(--text-label); }
.inspector .inspector-tab { font-size: var(--text-control); }
.inspector .prop-element-copy strong { font-size: var(--text-section-title); }
.inspector .prop-element-copy span { font-size: var(--text-meta); }
.inspector .prop-type-tag { font-size: var(--text-meta); }
.inspector .prop-section-head h3 { font-size: var(--text-section-title); }
.inspector .prop-section-head .prop-link { font-size: var(--text-label); }
.inspector .binding-path { font-size: var(--text-label); }
.inspector .binding-meta { font-size: var(--text-meta); }
.inspector .binding-meta .sample { font-size: var(--text-meta); }
.inspector .control-label { font-size: var(--text-label); }
.inspector .control-label span { font-size: var(--text-caption); }
.inspector .control { font-size: var(--text-control); }
.inspector .input-suffix .control { font-size: var(--text-control); }
.inspector .input-suffix em { font-size: var(--text-caption); }
.inspector .control-split .control:last-child { font-size: var(--text-control); }
.inspector .color-control .hex-input { font-size: var(--text-control); }
.inspector .pair-control label,
.inspector .pair-control em { font-size: var(--text-caption); }
.inspector .pair-control input { font-size: var(--text-control); }
.inspector .option-line > span { font-size: var(--text-label); }
.inspector .selection-hint { font-size: var(--text-label); line-height: 1.6; }
.inspector .inspector-foot-btn { font-size: var(--text-label); }
.inspector .datasource-card-head strong { font-size: var(--text-body); }
.inspector .datasource-status { font-size: var(--text-caption); }
.inspector .datasource-path { font-size: var(--text-meta); }
.inspector .sample-preview-head { font-size: var(--text-meta); }
.inspector .sample-preview-body { font-size: var(--text-body); }
.inspector .event-card-head strong { font-size: var(--text-label); }
.inspector .event-card-head span { font-size: var(--text-caption); }
.inspector .event-script { font-size: var(--text-meta); }
.inspector .add-event-btn { font-size: var(--text-label); }
.inspector .table-meta-row { font-size: var(--text-meta); }
.inspector .table-column-item { min-height: 38px; }
.inspector .table-column-no { font-size: var(--text-caption); }
.inspector .table-column-copy strong { font-size: var(--text-label); }
.inspector .table-column-copy small { font-size: var(--text-caption); }
.inspector .table-column-width { font-size: var(--text-meta); }
.inspector .column-binding-row .control { font-size: var(--text-control); }
.inspector .mini-action-btn { font-size: var(--text-meta); }
.inspector .table-column-actions button { font-size: var(--text-meta); }
.inspector .table-field-row span { font-size: var(--text-label); }
.inspector .table-field-row code { font-size: var(--text-caption); }
.inspector .setup-info-grid span { font-size: var(--text-label); }
.inspector .setup-hint { font-size: var(--text-meta); }
.inspector .table-align-segmented button { font-size: var(--text-meta); }

/* Riding seal designer and inspector */
.obj-ridge-seal { overflow: visible; z-index: 20 !important; }
.ridge-seal-master {
  position: relative;
  width: 100%;
  height: 100%;
  border: .2mm dashed rgba(196, 58, 58, .42);
  background: rgba(255, 255, 255, .01);
}
.ridge-seal-master > img { display: block; width: 100%; height: 100%; object-fit: fill; }
.ridge-seal-guides { position: absolute; inset: 0; pointer-events: none; }
.ridge-seal-guides i {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: .2mm dashed rgba(196, 58, 58, .48);
}
.ridge-seal-badge {
  position: absolute;
  left: 50%;
  bottom: -15px;
  transform: translateX(-50%);
  padding: 2px 5px;
  border: 1px solid #f0d6d6;
  border-radius: 4px;
  background: rgba(255, 251, 251, .96);
  color: #b65a5a;
  font-family: var(--font-sans);
  font-size: var(--text-micro);
  line-height: 1.1;
  white-space: nowrap;
  pointer-events: none;
}
.ridge-seal-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #c15b5b;
  background: #fffafa;
  font-size: var(--text-caption);
}
.ridge-seal-inspector-preview {
  position: relative;
  height: 132px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #f0e1e1;
  border-radius: 8px;
  background:
    linear-gradient(45deg, #fbf6f6 25%, transparent 25%) 0 0 / 12px 12px,
    linear-gradient(-45deg, #fbf6f6 25%, transparent 25%) 0 6px / 12px 12px,
    #fff;
}
.ridge-seal-inspector-preview img { max-width: 78%; max-height: 112px; object-fit: contain; }
.ridge-seal-inspector-preview > span { color: #b58a8a; font-size: var(--text-meta); }
.ridge-seal-preview-note {
  position: absolute;
  right: 7px;
  bottom: 6px;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .9);
  color: #a78080;
  font-size: var(--text-micro);
}
.seal-upload-row { display: flex; align-items: center; gap: 8px; margin: 9px 0 10px; }
.seal-upload-row .btn { height: 28px; padding: 0 9px; font-size: var(--text-meta); }
.seal-upload-row > span { color: #a1a9b7; font-size: var(--text-caption); }

.prop-upload-btn {
  cursor: pointer;
  color: #4d61a8;
  background: #fff;
  border-color: #cbd8f4;
  font-weight: 600;
}
.prop-upload-btn:hover { background: #f2f6ff; border-color: #9fb6ef; color: var(--accent); }
.ridge-seal-change-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  height: 25px;
  padding: 0 7px;
  border: 1px solid #d8dff0;
  border-radius: 5px;
  background: rgba(255, 255, 255, .95);
  color: #52678f;
  font-size: var(--text-caption);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(22, 34, 51, .06);
}
.ridge-seal-change-btn:hover { border-color: #a9bdf6; background: #f4f7ff; color: var(--accent); }

/* Riding seal inspector: one step larger typography */
.ridge-seal-inspector .prop-element-copy strong { font-size: var(--text-panel-title); }
.ridge-seal-inspector .prop-element-copy span { font-size: var(--text-label); }
.ridge-seal-inspector .prop-type-tag,
.ridge-seal-inspector .prop-upload-btn { font-size: var(--text-label); padding: 4px 6px; }
.ridge-seal-inspector .prop-section-head h3 { font-size: var(--text-section-title); }
.ridge-seal-inspector .prop-section-head .prop-link { font-size: var(--text-body); }
.ridge-seal-inspector .setup-info-grid span { font-size: var(--text-body); }
.ridge-seal-inspector .setup-info-grid b { font-size: var(--text-body); }
.ridge-seal-inspector .control-label { font-size: var(--text-body); }
.ridge-seal-inspector .control { font-size: var(--text-control); height: 33px; }
.ridge-seal-inspector .input-suffix .control { font-size: var(--text-control); }
.ridge-seal-inspector .input-suffix em { font-size: var(--text-meta); }
.ridge-seal-inspector .setup-hint { font-size: var(--text-label); line-height: 1.6; }
.ridge-seal-inspector .seal-upload-row .btn { height: 31px; font-size: var(--text-label); }
.ridge-seal-inspector .seal-upload-row > span { font-size: var(--text-meta); }
.ridge-seal-inspector .ridge-seal-preview-note { font-size: var(--text-meta); }
.ridge-seal-inspector .ridge-seal-change-btn { height: 27px; font-size: var(--text-meta); }
}

@keyframes forma-toast-in {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes forma-toast-out {
  to { opacity: 0; transform: translateY(5px) scale(.98); }
}
@keyframes forma-menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* =========================================================
   Container sizing contract
   ========================================================= */
#formaPrintDesigner[data-forma-size="normal"] .left-panel { width: 276px; flex-basis: 276px; }
#formaPrintDesigner[data-forma-size="normal"] .inspector { width: 328px; flex-basis: 328px; }
#formaPrintDesigner[data-forma-size="normal"] .brand { width: 248px; flex-basis: 248px; }

#formaPrintDesigner[data-forma-size="compact"] .left-panel { width: 244px; flex-basis: 244px; }
#formaPrintDesigner[data-forma-size="compact"] .inspector { width: 292px; flex-basis: 292px; }
#formaPrintDesigner[data-forma-size="compact"] .brand { width: 218px; flex-basis: 218px; }
#formaPrintDesigner[data-forma-size="compact"] .brand-env,
#formaPrintDesigner[data-forma-size="compact"] .save-state { display: none; }
#formaPrintDesigner[data-forma-size="compact"] .doc-context { min-width: 260px; }

#formaPrintDesigner[data-forma-size="narrow"] .left-panel { width: 216px; flex-basis: 216px; }
#formaPrintDesigner[data-forma-size="narrow"] .inspector { width: 252px; flex-basis: 252px; }
#formaPrintDesigner[data-forma-size="narrow"] .brand { width: 190px; flex-basis: 190px; }
#formaPrintDesigner[data-forma-size="narrow"] .brand-env,
#formaPrintDesigner[data-forma-size="narrow"] .save-state,
#formaPrintDesigner[data-forma-size="narrow"] .breadcrumb { display: none; }
#formaPrintDesigner[data-forma-size="narrow"] .doc-context { min-width: 0; flex: 1; }

#formaPrintDesigner[data-forma-size="small"] .left-panel { width: 190px; flex-basis: 190px; }
#formaPrintDesigner[data-forma-size="small"] .inspector { width: 224px; flex-basis: 224px; }
#formaPrintDesigner[data-forma-size="small"] .brand { width: 170px; flex-basis: 170px; }
#formaPrintDesigner[data-forma-size="small"] .brand-env,
#formaPrintDesigner[data-forma-size="small"] .save-state,
#formaPrintDesigner[data-forma-size="small"] .breadcrumb,
#formaPrintDesigner[data-forma-size="small"] .doc-context { display: none; }
#formaPrintDesigner[data-forma-size="small"] .header-actions { gap: 5px; }
#formaPrintDesigner[data-forma-size="small"] .btn-key { display: none; }

.designer-size-warning {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 700;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #f6f7fa;
}
.designer-size-warning > div {
  max-width: 360px;
  padding: 20px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-md);
}
.designer-size-warning strong { display: block; font-size: var(--text-section-title); color: #283449; }
.designer-size-warning span { display: block; margin-top: 7px; font-size: var(--text-body); line-height: 1.6; color: #68768b; }
#formaPrintDesigner[data-forma-size="tiny"] .designer-size-warning { display: flex; }
#formaPrintDesigner[data-forma-size="tiny"] .app { visibility: hidden; }

/* Overlay scope */
#formaPrintDesigner:not([data-forma-overlays="viewport"]) .preview-overlay,
#formaPrintDesigner:not([data-forma-overlays="viewport"]) .modal-layer,
#formaPrintDesigner:not([data-forma-overlays="viewport"]) .toast-stack { position: absolute; }

/* Accessibility: contrast, focus, reduced motion */
#formaPrintDesigner .ruler-label,
#formaPrintDesigner .ruler-corner { color: #5f6b7c; }
#formaPrintDesigner .structure-meta,
#formaPrintDesigner .control-label,
#formaPrintDesigner .inspector-sub,
#formaPrintDesigner .prop-element-copy span,
#formaPrintDesigner .field-item small,
#formaPrintDesigner .element-hint,
#formaPrintDesigner .theme-copy small,
#formaPrintDesigner .page-setup-copy small,
#formaPrintDesigner .data-source-head small,
#formaPrintDesigner .data-source-foot { color: #667085; }

#formaPrintDesigner :focus-visible {
  outline: 2px solid #335cff;
  outline-offset: 2px;
}
#formaPrintDesigner .structure-row:focus-visible,
#formaPrintDesigner .band-tag:focus-visible,
#formaPrintDesigner .field-item:focus-visible,
#formaPrintDesigner .table-column-item:focus-visible,
#formaPrintDesigner .table-field-row:focus-visible {
  outline-offset: -1px;
  outline-color: rgba(51, 92, 255, .75);
}

@media (prefers-reduced-motion: reduce) {
  #formaPrintDesigner *,
  #formaPrintDesigner *::before,
  #formaPrintDesigner *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}