@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibm-plex-sans-latin.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "IBM Plex Sans", -apple-system, "system-ui", Arial, sans-serif;
  --text: #444444;
  --blue: #2872fa;
  --yellow: #ffbe36;
  --white: #ffffff;
  --line: #eeeeee;
  --border: #e3e3e3;
  --panel: #fbfbfc;
  --page: #f5f6f7;
  --button-grey: #dddddd;
  --glass: #ffffff99;
  --radius-card: 12px;
  --radius-btn: 6px;
  --shadow-card: rgba(0, 0, 0, 0.18) 0px 3px 6px 0px;
  --sp-2: 2px;
  --sp-3: 3px;
  --sp-4: 4px;
  --sp-6: 6px;
  --sp-10: 10px;
  --sp-12: 12px;
  --sp-16: 16px;
  --sp-20: 20px;
  --sp-30: 30px;
  --sp-40: 40px;
  --sp-60: 60px;
  --sp-80: 80px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { margin: 0; }
svg.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Dashboard shell ---------- */
.shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100%;
}
.sidebar {
  width: 241px;
  flex: none;
  border-right: 1px solid var(--border);
  background: var(--white);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}
.logo {
  display: block;
  margin: 20px 0 0 32px;
  width: 168px;
  height: 31px;
}
.logo svg, .logo img { display: block; width: 168px; height: 31px; }
.side-nav {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  width: 220px;
  row-gap: 4px;
  column-gap: 12px;
  margin: 60px 0 20px 20px;
  min-height: 0;
}
.nav-sections { width: 165px; }
.nav-list li { margin-bottom: 7.6px; }
.nav-link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 0 10px;
  font-size: 16px;
  line-height: normal;
  color: var(--text);
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
}
.nav-link .icon { margin-top: 2px; }
.nav-link .label { border-bottom: 3px solid transparent; padding-bottom: 2px; margin-bottom: -5px; }
.nav-link:hover .label { color: #222; }
.nav-link.active .label { font-weight: 700; border-bottom-color: var(--yellow); }
.nav-divider { height: 1px; background: var(--line); margin: 9.4px 10px 0; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  min-width: 101px;
  padding: 0 12px;
  border-radius: var(--radius-btn);
  font-size: 16px;
  line-height: 1;
  border: 1px solid transparent;
  background: var(--white);
}
.btn .icon { width: 20px; height: 20px; }
.btn-yellow { background: var(--yellow); border-color: var(--yellow); color: var(--text); }
.btn-yellow:hover { filter: brightness(0.97); }
.btn-outline { border-color: var(--blue); color: var(--blue); background: var(--white); }
.btn-outline:hover { background: #f1f6ff; }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-plain { border-color: var(--border); }
.buy-wrap { margin: 28px 0 0 12px; }
.buy-wrap .btn { justify-content: flex-start; padding: 0 0 0 24px; }
.side-bottom li { margin-bottom: 7.6px; position: relative; }
.side-bottom .chev { margin-left: auto; }
.side-bottom .nav-link { width: 200px; }
.side-bottom .nav-link.options { width: 200px; padding-right: 0; }
.side-bottom li:first-child { margin-bottom: 5.6px; }
.side-bottom .login-wrap { margin: 18.8px 0 11.6px 12px; }
.login-wrap .btn { justify-content: flex-start; padding: 0 4px 0 16px; width: 101px; }

.categories {
  width: 240px;
  flex: none;
  background: var(--panel);
  padding: 90px 0 30px 30px;
  overflow-y: auto;
  height: 100%;
}
.search {
  position: relative;
  width: 180px;
  height: 30px;
}
.search input {
  width: 180px;
  height: 30px;
  border: 1px solid #f5f7f9;
  border-radius: 2px;
  background: var(--white);
  padding: 3px 34px 3px 6px;
  font-size: 11.9px;
  outline: none;
}
.search input:focus { border-color: var(--blue); }
.search input::placeholder { color: #757575; }
.search button {
  position: absolute;
  right: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 0 2px 2px 0;
  background: var(--button-grey);
  opacity: 0.7;
  color: #101010;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.search button .icon { width: 18px; height: 18px; stroke: #6b6b6b; }
.cat-list { margin-top: 16px; padding-bottom: 4px; }
.cat-list li { line-height: 26px; }
.cat-list button {
  background: none;
  border: 0;
  padding: 0;
  font-size: 14px;
  line-height: 26px;
  color: var(--text);
  text-align: left;
}
.cat-list button:hover { color: var(--blue); }
.cat-list button.active { color: var(--blue); font-weight: 700; }

.main {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  background: var(--page);
  padding: 55px 80px 60px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 29px;
  margin: 0 0 36px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.page-title .crumb { font-weight: 400; font-size: 14px; color: var(--blue); background: none; border: 0; padding: 0; }
.section-title { font-size: 16px; font-weight: 700; margin: 0 0 20px; }
.section-gap { height: 40px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 40px;
}
.card {
  position: relative;
  width: 100%;
  max-width: 250px;
  justify-self: center;
  aspect-ratio: 1 / 1;
  background: var(--white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  border: 0;
  padding: 0;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: rgba(0, 0, 0, 0.22) 0px 6px 14px 0px; }
.card:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.card .art {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6.8% 10% 0;
  min-height: 0;
}
.card .art svg { width: 100%; height: 100%; }
.card .card-label {
  border-radius: 0 0 12px 12px;
  background: var(--glass);
  padding: 7px 10px 11px;
  font-size: 14px;
  line-height: 18.2px;
}
.card .card-label span {
  display: block;
  max-width: 150px;
  margin: 0 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card .card-sub { display: block; font-size: 12px; color: #888; margin-top: 2px; }
.card .star {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 0;
  background: var(--glass);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
}
.card .star.on { color: var(--yellow); }
.card .star.on svg { fill: var(--yellow); }
.card .more {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 0;
  background: var(--glass);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #777;
}
.card .thumb { width: 100%; height: 100%; border-radius: 12px 12px 0 0; }
.doc-card .art { padding: 12px 12px 0; align-items: center; }

.empty {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 30px;
  max-width: 560px;
  line-height: 1.6;
}
.empty p { margin: 0 0 16px; }
.prose { max-width: 640px; line-height: 1.6; font-size: 14px; }
.prose h2 { font-size: 16px; margin: 24px 0 8px; }
.prose p { margin: 0 0 12px; }
.prose kbd { font-family: inherit; background: #fff; border: 1px solid #ddd; border-bottom-width: 2px; border-radius: 4px; padding: 0 6px; font-size: 12px; }
.prose table { border-collapse: collapse; }
.prose td { padding: 4px 16px 4px 0; vertical-align: top; }
.panel {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 20px;
}
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* menus & dialogs */
.popover {
  position: fixed;
  z-index: 50;
  background: #fff;
  border-radius: 6px;
  box-shadow: rgba(0, 0, 0, 0.18) 0px 3px 12px 0px;
  padding: 6px 0;
  min-width: 190px;
}
.popover button, .popover label {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}
.popover button:hover, .popover label:hover { background: var(--page); }
.popover .danger { color: #c62828; }
.popover hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(30, 34, 40, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.dialog {
  background: #fff;
  border-radius: 12px;
  box-shadow: rgba(0, 0, 0, 0.25) 0 10px 30px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  line-height: 1.6;
}
.dialog h2 { font-size: 18px; margin-bottom: 10px; }
.dialog p { margin: 0 0 12px; }
.dialog input[type=text] {
  width: 100%;
  height: 34px;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 14px;
  margin-bottom: 16px;
}
.dialog .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 18px;
  border-radius: 6px;
  z-index: 80;
  font-size: 14px;
  pointer-events: none;
}

/* ---------- Narrow screens: top "Menu" bar ---------- */
.topbar { display: none; }
.drawer-scrim { display: none; }
@media (max-width: 1023px) {
  .shell { flex-direction: column; }
  .topbar {
    display: flex;
    align-items: center;
    height: 41px;
    flex: none;
    background: var(--glass);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
  }
  .menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 0;
    background: none;
    padding: 0;
    font-size: 14px;
    font-weight: 700;
    height: 40px;
  }
  .menu-btn .icon { width: 18px; height: 18px; }
  .body-row { flex: 1; min-height: 0; display: flex; }
  .sidebar, .categories {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 40;
    transform: translateX(-110%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
    box-shadow: rgba(0, 0, 0, 0.18) 3px 0 12px;
  }
  .sidebar { left: 0; }
  .categories { left: 241px; transform: translateX(calc(-110% - 241px)); }
  .shell.drawer-open .sidebar, .shell.drawer-open .categories { transform: none; visibility: visible; transition: transform 0.2s ease; }
  .shell.drawer-open .drawer-scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(30, 34, 40, 0.35); }
  .main {
    border-left: 1px solid var(--border);
    padding: 14px 20px 40px 19px;
  }
}
@media (max-width: 520px) {
  .categories { left: 0; top: auto; height: auto; max-height: 45vh; width: 100%; padding: 16px 20px; transform: translateY(110%); }
  .sidebar { width: 100%; max-width: 280px; bottom: 45vh; }
  .shell.drawer-open .categories { transform: none; }
}
@media (min-width: 1024px) {
  .body-row { display: contents; }
}

/* ---------- Editor ---------- */
.editor {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--page);
}
.ed-top {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex: none;
  min-width: 0;
}
.ed-top .back { border: 0; background: none; display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 6px; font-size: 14px; }
.ed-top .back:hover { background: var(--page); }
.ed-logo { width: 26px; height: 26px; flex: none; }
.ed-title {
  font-size: 16px;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  min-width: 60px;
  width: 260px;
  max-width: 34vw;
  background: transparent;
}
.ed-title:hover { border-color: var(--border); }
.ed-title:focus { border-color: var(--blue); outline: none; background: #fff; }
.ed-saved { font-size: 12px; color: #888; white-space: nowrap; }
.ed-spacer { flex: 1; }
.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  min-width: 34px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: none;
  font-size: 14px;
  white-space: nowrap;
}
.tb-btn:hover { background: var(--page); }
.tb-btn:disabled { opacity: 0.35; cursor: default; background: none; }
.tb-btn.on { background: #e8f0ff; color: var(--blue); border-color: #c9dbff; }
.ed-body { flex: 1; display: flex; min-height: 0; position: relative; }
.palette {
  width: 72px;
  flex: none;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0;
  overflow-y: auto;
}
.palette .tool {
  width: 56px;
  min-height: 52px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10.5px;
  padding: 4px 0;
  flex: none;
}
.palette .tool svg { width: 26px; height: 22px; }
.palette .tool:hover { background: var(--page); }
.palette .tool.on { background: #e8f0ff; border-color: #c9dbff; color: var(--blue); }
.palette hr { width: 40px; border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.stage { flex: 1; position: relative; overflow: hidden; touch-action: none; min-width: 0; }
.stage svg.canvas { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }
.stage.panning { cursor: grabbing; }
.stage.connecting, .stage.placing { cursor: crosshair; }
.shape { cursor: move; }
.shape-text { pointer-events: none; font-family: var(--font); }
.link-hit { stroke: transparent; stroke-width: 14; fill: none; cursor: pointer; }
.handle { fill: #fff; stroke: var(--blue); stroke-width: 1.5; }
.handle.resize { cursor: nwse-resize; }
.port { fill: var(--blue); stroke: #fff; stroke-width: 2; cursor: crosshair; }
.zoom-box {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 6px;
  box-shadow: var(--shadow-card);
  padding: 2px;
}
.zoom-box span { font-size: 12px; width: 46px; text-align: center; }
.hint {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.props {
  width: 230px;
  flex: none;
  background: #fff;
  border-left: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  font-size: 13px;
}
.props h3 { font-size: 13px; font-weight: 700; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.04em; color: #777; }
.props .group { margin-bottom: 18px; }
.swatches { display: grid; grid-template-columns: repeat(6, 26px); gap: 6px; }
.swatch { width: 26px; height: 26px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, 0.15); padding: 0; }
.swatch.on { outline: 2px solid var(--blue); outline-offset: 1px; }
.props select, .props input[type=number] { width: 100%; height: 30px; border: 1px solid #ddd; border-radius: 6px; padding: 0 6px; font-size: 13px; background: #fff; }
.props .row2 { display: flex; gap: 6px; flex-wrap: wrap; }
.props .row2 .tb-btn { border-color: var(--border); }
.props .muted { color: #888; line-height: 1.5; }
.text-editor {
  position: absolute;
  z-index: 10;
  border: 2px solid var(--blue);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.96);
  resize: none;
  text-align: center;
  font-family: var(--font);
  padding: 4px;
  outline: none;
  line-height: 1.25;
}
@media (max-width: 760px) {
  .ed-body { flex-direction: column-reverse; }
  .palette { width: 100%; flex-direction: row; height: 64px; border-right: 0; border-top: 1px solid var(--border); padding: 4px 8px; overflow-x: auto; overflow-y: hidden; }
  .palette hr { width: 1px; height: 40px; border-top: 0; border-left: 1px solid var(--line); margin: 0 4px; }
  .props { position: absolute; left: 8px; right: 8px; bottom: 72px; width: auto; max-height: 45%; border: 0; border-radius: 12px; box-shadow: var(--shadow-card); z-index: 5; }
  .props.collapsed { display: none; }
  .ed-saved, .tb-label { display: none; }
  .ed-title { max-width: 40vw; }
  .ed-top { gap: 2px; padding: 0 6px; }
}

/* sync / retry notices */
.notice[hidden] { display: none; }
.notice { position: fixed; inset: 0; z-index: 90; background: rgba(30, 34, 40, 0.35); display: flex; align-items: center; justify-content: center; padding: 20px; }
#retry-notice { inset: auto 0 24px 0; background: none; pointer-events: none; }
.notice-box { background: #fff; border-radius: 12px; box-shadow: var(--shadow-card); padding: 24px; max-width: 380px; text-align: center; line-height: 1.5; }
.notice-box h3 { font-size: 16px; }
.notice-box h1 { font-size: 16px; }
.notice-box p { margin: 10px 0 14px; color: #666; }

.props input[type=text] { width: 100%; height: 30px; border: 1px solid #ddd; border-radius: 6px; padding: 0 6px; font-size: 13px; background: #fff; }
.props input:focus, .props select:focus { border-color: var(--blue); outline: none; }
.props label.muted { display: block; margin-bottom: 4px; }
.check-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; cursor: pointer; }
.palette .pal-title { font-size: 10px; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: .04em; flex: none; }
@media (max-width: 760px) { .palette .pal-title { writing-mode: vertical-rl; transform: rotate(180deg); } }

/* rulers */
.ruler { position: absolute; z-index: 3; background: #fff; overflow: hidden; pointer-events: none; font-size: 9.5px; color: #777; }
.ruler-x { top: 0; left: 20px; right: 0; height: 20px; border-bottom: 1px solid #dde1e7; }
.ruler-y { top: 20px; left: 0; bottom: 0; width: 20px; border-right: 1px solid #dde1e7; }
.ruler-corner { position: absolute; z-index: 4; top: 0; left: 0; width: 20px; height: 20px; background: #fff; border-right: 1px solid #dde1e7; border-bottom: 1px solid #dde1e7; }
.ruler[hidden], .ruler-corner[hidden] { display: none; }
.ruler-x span, .ruler-x i { position: absolute; left: calc(var(--p) - 20px); bottom: 0; border-left: 1px solid #b9c0ca; }
.ruler-x span { height: 20px; padding-left: 3px; line-height: 12px; white-space: nowrap; }
.ruler-x i { height: 5px; }
.ruler-y span, .ruler-y i { position: absolute; top: calc(var(--p) - 20px); right: 0; border-top: 1px solid #b9c0ca; }
.ruler-y span { width: 20px; height: 0; }
.ruler-y span { writing-mode: vertical-rl; transform: rotate(180deg); height: auto; padding: 3px 0 0; border-top: 0; border-bottom: 1px solid #b9c0ca; line-height: 12px; white-space: nowrap; transform-origin: center; }
.ruler-y i { width: 5px; }
.stage.with-rulers .hint { top: 30px; }
/* palette search */
.palette { width: 84px; }
.palette .tool { width: 66px; }
.pal-search { width: 74px; height: 26px; border: 1px solid #ddd; border-radius: 6px; padding: 0 6px; font-size: 11px; flex: none; margin-bottom: 4px; }
.pal-search:focus { border-color: var(--blue); outline: none; }
.palette [hidden] { display: none !important; }
.pal-none { font-size: 11px; color: #888; text-align: center; margin: 8px 4px; }
.palette .tool span { text-align: center; line-height: 1.1; }
@media (max-width: 760px) { .palette { width: 100%; } .pal-search { width: 90px; margin: 0 4px 0 0; align-self: center; } }
/* settings and dialogs */
.dialog.dialog-wide { max-width: 560px; max-height: 88vh; overflow-y: auto; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; font-size: 13px; }
.settings section { margin-bottom: 10px; }
.settings h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #777; margin: 6px 0 6px; }
.settings label { display: block; margin: 6px 0; }
.settings label.check-row { display: flex; }
.settings select, .settings input[type=number], .settings input[type=text] { width: 100%; height: 30px; border: 1px solid #ccc; border-radius: 6px; padding: 0 6px; font-size: 13px; background: #fff; margin: 3px 0 0; }
.settings .row2 input { margin: 0; }
@media (max-width: 560px) { .settings { grid-template-columns: 1fr; } }
.list-input { width: 100%; font-family: inherit; font-size: 13px; border: 1px solid #ccc; border-radius: 6px; padding: 8px; line-height: 1.5; resize: vertical; }

/* ---------- Editor workspace: tabs, ribbon, side panel ---------- */
.editor .ed-top { display: block; height: auto; padding: 0; border-bottom: 1px solid var(--border); }
.ed-bar { display: flex; align-items: center; gap: 6px; height: 46px; padding: 0 12px; min-width: 0; }
.ed-tabs { display: flex; align-items: stretch; height: 46px; overflow-x: auto; scrollbar-width: none; flex: none; }
.ed-tab { border: 0; background: none; padding: 0 12px; font-size: 14px; color: var(--text); display: flex; align-items: center; white-space: nowrap; }
.ed-tab:hover { background: var(--page); }
.ed-tab.on { background: #e9ecf0; font-weight: 600; }
.share-btn { min-width: 0; height: 32px; font-size: 14px; padding: 0 12px; }
.side-toggle { display: none; }
.ribbon { display: flex; align-items: stretch; gap: 2px; padding: 6px 10px; min-height: 64px; border-top: 1px solid #eef0f3; overflow-x: auto; background: #fff; scrollbar-width: thin; }
.ribbon[hidden] { display: none; }
.rb { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 52px; padding: 4px 6px; border: 1px solid transparent; border-radius: 6px; background: none; font-size: 11.5px; color: #555; white-space: nowrap; flex: none; }
.rb .icon { width: 20px; height: 20px; }
.rb:hover:not(:disabled) { background: var(--page); color: #222; }
.rb:disabled, .rb-mini:disabled, .ribbon select:disabled { opacity: .38; cursor: default; }
.rb small { font-size: 9px; }
.rb-sep { width: 1px; background: #e6e8ec; margin: 4px 6px; flex: none; }
.rb-font { display: flex; flex-direction: column; justify-content: center; gap: 4px; flex: none; }
.rb-row { display: flex; gap: 3px; align-items: center; }
.ribbon select { height: 26px; border: 1px solid #dcdfe4; border-radius: 4px; font-size: 12px; background: #fff; padding: 0 4px; }
.ribbon select[data-font="font"] { width: 130px; }
.rb-mini { min-width: 26px; height: 24px; border: 1px solid transparent; border-radius: 4px; background: none; font-size: 13px; padding: 0 4px; }
.rb-mini:hover:not(:disabled) { background: var(--page); }
.rb-mini.on { background: #e8f0ff; border-color: #c9dbff; color: var(--blue); }
.rb-checks { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 0 8px; flex: none; font-size: 12.5px; }
.rb-check { display: flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.rb-check input { accent-color: var(--blue); width: 15px; height: 15px; }
.rb-nums { display: flex; flex-direction: column; justify-content: center; gap: 4px; font-size: 12px; flex: none; padding-right: 6px; }
.rb-nums label { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.rb-nums input { width: 56px; height: 24px; border: 1px solid #dcdfe4; border-radius: 4px; padding: 0 6px; font-size: 12px; }
.ed-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.page-bar { display: flex; align-items: center; height: 34px; background: #fff; border-bottom: 1px solid var(--border); padding: 0 6px; gap: 2px; flex: none; }
.page-tabs { display: flex; overflow-x: auto; height: 100%; scrollbar-width: none; }
.page-tab { border: 0; border-right: 1px solid #eef0f3; background: #f3f4f6; padding: 0 22px; font-size: 13px; white-space: nowrap; }
.page-tab.on { background: #e4e7eb; font-weight: 600; }
.layer-btn { position: absolute; left: 30px; bottom: 16px; z-index: 5; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid #dfe3e8; border-radius: 6px; background: #fff; box-shadow: var(--shadow-card); font-size: 13px; }
.zoom-range { width: 110px; accent-color: var(--blue); }
.palette.side { width: 260px; flex: none; display: block; padding: 10px 12px 30px; overflow-y: auto; background: #fff; border-right: 1px solid var(--border); gap: 0; }
.palette.side .side-head h2 { font-size: 18px; font-weight: 600; margin: 4px 2px 10px; }
.tool-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 8px; }
.palette.side .tool.big { width: 100%; min-height: 50px; border-radius: 6px; font-size: 12px; }
.palette.side .tool.big .icon { width: 20px; height: 20px; }
.palette.side .tool.on { background: #ffd66b; border-color: #f2c14e; color: #333; }
.split { position: relative; }
.split .caret, .side-split .caret { position: absolute; top: 2px; right: 0; border: 0; background: none; font-size: 10px; color: #777; padding: 2px 3px; border-radius: 4px; }
.split .caret:hover, .side-split .caret:hover { background: var(--page); }
.side-split { position: relative; }
.side-split .caret { top: 6px; right: 4px; font-size: 12px; }
.side-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 7px 8px; border-radius: 6px; font-size: 13px; text-align: left; color: var(--text); }
.side-item .icon { width: 16px; height: 16px; color: #555; }
.side-item:hover:not(:disabled) { background: var(--page); }
.side-item:disabled { opacity: .4; cursor: default; }
.side-item.on { background: #fff4d6; }
.side-check { cursor: pointer; }
.side-check span { flex: 1; }
.side-check input { accent-color: var(--blue); width: 16px; height: 16px; }
.side-sec { margin: 6px 0; }
.side-sec > summary, .lib > summary { list-style: none; cursor: pointer; background: #f3f4f6; border-radius: 6px; padding: 7px 10px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.side-sec > summary::before, .lib > summary::before { content: '›'; display: inline-block; width: 10px; transition: transform .15s; }
.side-sec[open] > summary::before, .lib[open] > summary::before { transform: rotate(90deg); }
.side-sec > summary::-webkit-details-marker, .lib > summary::-webkit-details-marker { display: none; }
.side-sec-body { padding: 4px 0 0 8px; }
.side-sec .muted { font-size: 12px; color: #888; margin: 4px 8px; }
.sym-search { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; }
.sym-search input { flex: 1; min-width: 0; height: 32px; border: 1px solid #e2e5ea; background: #f5f6f7; border-radius: 6px; padding: 0 10px; font-size: 13px; }
.sym-search input:focus { outline: none; border-color: var(--blue); background: #fff; }
.sym-find { height: 32px; width: 34px; border: 0; border-radius: 6px; background: #e3e5e8; display: flex; align-items: center; justify-content: center; }
.sym-find .icon { width: 16px; height: 16px; }
.sym-more { border: 0; background: none; color: var(--blue); font-size: 13px; white-space: nowrap; padding: 0 2px; }
.lib-list { border: 1px solid #eef0f3; border-radius: 8px; padding: 6px; }
.lib { margin: 0 0 6px; }
.lib > summary span { flex: 1; }
.lib-x { border: 0; background: none; color: #777; font-size: 16px; line-height: 1; padding: 0 2px; }
.sym-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px 0 2px; }
.sym { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1px solid transparent; border-radius: 6px; background: none; padding: 6px 2px; font-size: 10.5px; line-height: 1.15; color: #444; text-align: center; min-height: 58px; }
.sym svg { width: 30px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.sym:hover { background: #f1f6ff; border-color: #d6e4ff; }
.palette.side hr { display: none; }
.stage.painting { cursor: copy; }
/* floating panels */
.panel-pop { padding: 10px; min-width: 210px; max-width: 280px; }
.panel-pop h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #888; margin: 6px 2px 6px; }
.pop-swatches { display: grid; grid-template-columns: repeat(7, 26px); gap: 5px; }
.panel-pop .swatch { width: 26px; height: 26px; padding: 0; border-radius: 6px; border: 1px solid rgba(0,0,0,.15); }
.pop-custom { display: flex !important; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; padding: 0 !important; }
.pop-custom input { width: 34px; height: 24px; border: 0; padding: 0; background: none; }
.pop-row { display: flex; gap: 4px; flex-wrap: wrap; }
.panel-pop .pop-row button { width: auto; border: 1px solid #e2e5ea; border-radius: 5px; padding: 4px 8px; font-size: 12px; }
.pop-styles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.panel-pop .pop-styles button { border: 1.5px solid; border-radius: 6px; padding: 10px 6px; font-size: 12.5px; justify-content: center; }
.pop-list button { justify-content: flex-start; }
.theme-dots { display: inline-flex; gap: 2px; margin-right: 8px; }
.theme-dots i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.1); }
.layers-pop h3 { font-size: 13px; margin: 0 0 6px; }
.layer-row { display: flex; align-items: center; gap: 2px; border-radius: 6px; padding: 2px; }
.layer-row.on { background: #fff4d6; }
.panel-pop .layer-row button { width: auto; padding: 5px 7px; font-size: 13px; border-radius: 5px; }
.panel-pop .layer-row .ly-name { flex: 1; text-align: left; }
.panel-pop .layer-row button.on { color: #c62828; }
.panel-pop .layer-row button.off { opacity: .5; }
.layers-pop .tb-btn { border: 1px solid #e2e5ea; width: auto !important; }
.fr { display: block; margin-bottom: 10px; font-size: 13px; }
.fr input { display: block; width: 100%; height: 34px; border: 1px solid #ccc; border-radius: 6px; padding: 0 10px; margin-top: 4px; font-size: 14px; }
.fr-msg { min-height: 18px; font-size: 12.5px; color: #777; }
@media (max-width: 900px) {
  .palette.side { position: absolute; z-index: 20; top: 0; bottom: 0; left: 0; transform: translateX(-105%); transition: transform .2s; box-shadow: rgba(0,0,0,.18) 3px 0 12px; }
  .editor.side-open .palette.side { transform: none; }
  .side-toggle { display: inline-flex; }
  .ed-title { width: 140px; }
  .ed-body { position: relative; }
}
@media (max-width: 760px) {
  .ed-bar { flex-wrap: wrap; height: auto; padding: 4px 6px; }
  .ed-tabs { order: 3; width: 100%; height: 38px; }
  .share-btn span { display: none; }
  .zoom-range { display: none; }
  .layer-btn { left: 10px; bottom: 76px; }
  .palette.side { width: 86vw; max-width: 300px; flex-direction: column; height: auto; overflow-y: auto; border-top: 0; }
}
