.pf-node.is-multiselected {
  outline: 2px solid #2563eb !important;
  outline-offset: 0px;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.18);
  z-index: 12;
}
:root{
  --pf-font: "Manrope","Inter",system-ui,-apple-system,"Segoe UI",sans-serif;
  --pf-bg: #f6f7f9;
  --pf-bg-grad: radial-gradient(circle at 20% 20%, rgba(37,99,235,0.18), transparent 55%),
                 radial-gradient(circle at 80% 0%, rgba(14,165,233,0.18), transparent 40%),
                 linear-gradient(135deg, #f9fbff, #edf1ff);
  --pf-panel: #ffffff;
  --pf-panel-muted: rgba(255,255,255,0.75);
  --pf-border: rgba(15,23,42,0.08);
  --pf-border-strong: rgba(15,23,42,0.18);
  --pf-text: #0f172a;
  --pf-muted: rgba(15,23,42,0.62);
  --pf-primary: #2563eb;
  --pf-primary-2: #1d4ed8;
  --pf-danger: #dc2626;
  --pf-shadow: 0 35px 90px rgba(15,23,42,0.18);
  --pf-radius: 16px;
  --pf-hit: 38px;

  --pf-zoom: 1;
  --pf-grid-step: 90px;
  --pf-grid-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cpath d='M90 0H0V90' fill='none' stroke='%234b5563' stroke-width='1' stroke-dasharray='2 4'/%3E%3C/svg%3E");

  --pf-left-w: 340px;
  --pf-right-panel-w: 320px;
  --pf-right-w: calc(var(--pf-rail-w) + var(--pf-right-panel-w));
  --pf-rail-w: 64px;
  --pf-topbar-h: 52px;
}

body.editor-page.pf-theme-dark{
  --pf-bg: #0b1220;
  --pf-bg-grad: radial-gradient(circle at 20% 20%, rgba(37,99,235,0.16), transparent 55%),
                 radial-gradient(circle at 80% 0%, rgba(14,165,233,0.16), transparent 40%),
                 linear-gradient(135deg, #0f172a, #0b1220);
  --pf-panel: #111827;
  --pf-panel-muted: rgba(17,24,39,0.85);
  --pf-border: rgba(148,163,184,0.18);
  --pf-border-strong: rgba(148,163,184,0.35);
  --pf-text: #e2e8f0;
  --pf-muted: rgba(226,232,240,0.6);
}

*,*::before,*::after{ box-sizing: border-box; }
html, body{ width:100%; height:100%; }
body.editor-page{
  overflow:hidden;
  background: var(--pf-bg);
}
.pf-topbar{
  position: relative;
  height: 52px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 50;
  background: linear-gradient(90deg, #2563eb 0%, #1d4ed8 45%, #0ea5e9 100%);
  border-bottom: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 14px 32px rgba(15,23,42,0.18);
}
.pf-topbar__group{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pf-topbar__group--right{ gap: 10px; }
.pf-topbar__logo{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 44px;
  height: 44px;
  margin-right: 4px;
}
.pf-topbar__logo img{
  width: 38px;
  height: 38px;
  object-fit: contain;
}
.pf-topbar__group--center{
  flex: 1 1 auto;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pf-topbar__cluster{
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pf-topbar__group--center .pf-topbar__cluster{
  padding: 2px;
  border-radius: 14px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.14);
}
.pf-topbar__sep{
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,0.25);
}
.pf-topbar__title{
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffffff;
  font-weight: 600;
}
.pf-topbar-btn{
  border: 1px solid transparent;
  background: transparent;
  color: #ffffff;
  height: 34px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background 140ms ease, border-color 140ms ease, transform 80ms ease, box-shadow 160ms ease;
}
.pf-topbar-btn--icon{ width: 32px; padding: 0; justify-content: center; }
.pf-topbar-btn--label{ padding: 0 10px; }
.pf-topbar-btn svg{
  width: 16px;
  height: 16px;
  stroke: #ffffff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.pf-topbar-btn:hover{
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.18);
}
.pf-topbar-btn.is-active{
  background: rgba(255,255,255,0.18);
}
.pf-topbar-btn:active{ transform: translateY(1px); }
.pf-topbar-btn:focus-visible{
  outline: 3px solid rgba(255,255,255,0.35);
  outline-offset: 2px;
}
.pf-topbar-btn--ghost{
  border: none;
  opacity: 0.9;
}
.pf-topbar-btn--outline{
  border: 1px solid rgba(255,255,255,0.45);
}

/* Header CTAs (Download/Upgrade) */
.pf-topbar-btn--cta{
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.24);
  box-shadow: none;
  padding: 0 12px;
  height: 36px;
  gap: 8px;
}
.pf-topbar-btn--cta:hover{
  background: rgba(255,255,255,0.20);
  border-color: rgba(255,255,255,0.30);
  box-shadow: none;
}
.pf-topbar-btn__label{ letter-spacing: 0.01em; }
.pf-topbar-btn--upgrade svg{ fill: #facc15; stroke: none; }

/* Lock button: yellow when locked */
.pf-topbar-btn--lock[aria-pressed="true"]{
  background: rgba(168,85,247,0.18);
  border-color: rgba(168,85,247,0.34);
}
.pf-topbar-btn--lock[aria-pressed="true"] svg{
  stroke: #e9d5ff;
}

/* Account avatar */
.pf-topbar-avatar{
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.12);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 160ms ease, transform 80ms ease;
  box-shadow: 0 10px 22px rgba(15,23,42,0.16);
}
.pf-topbar-avatar svg{ width: 18px; height: 18px; stroke: #fff; }
.pf-topbar-avatar:hover{
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.30);
  box-shadow: 0 14px 28px rgba(15,23,42,0.20);
}
.pf-topbar-avatar:active{ transform: translateY(1px); }
.pf-topbar-avatar:focus-visible{
  outline: 3px solid rgba(255,255,255,0.35);
  outline-offset: 2px;
}
.pf-topbar-seg{
  display: inline-flex;
  border-radius: 999px;
  border: none;
  overflow: hidden;
}
.pf-topbar-seg__btn{
  background: transparent;
  color: #fff;
  border: none;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.pf-topbar-seg__btn.is-active{
  background: rgba(255,255,255,0.2);
}

/* Upgrade modal (isolated overlay; no layout impact) */
.pf-upgrade-modal[hidden]{ display:none; }
.pf-upgrade-modal{
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(15,23,42,0.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}
.pf-upgrade-modal[data-open="true"]{
  opacity: 1;
  pointer-events: auto;
}
.pf-upgrade-modal__dialog{
  width: min(920px, calc(100vw - 44px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  background: var(--pf-panel);
  color: var(--pf-text);
  border: 1px solid var(--pf-border);
  border-radius: 18px;
  box-shadow: 0 40px 100px rgba(15,23,42,0.28);
  padding: 18px;
  transform: translateY(10px) scale(0.985);
  transition: transform 160ms ease;
}
.pf-upgrade-modal[data-open="true"] .pf-upgrade-modal__dialog{
  transform: translateY(0) scale(1);
}
.pf-upgrade-modal__close{
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--pf-border);
  background: rgba(15,23,42,0.04);
  color: var(--pf-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 80ms ease;
}
.pf-upgrade-modal__dialog{ position: relative; }
.pf-upgrade-modal__close svg{
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
}
.pf-upgrade-modal__close:hover{
  background: rgba(15,23,42,0.06);
  border-color: var(--pf-border-strong);
}
.pf-upgrade-modal__close:active{ transform: translateY(1px); }
.pf-upgrade-modal__close:focus-visible{
  outline: 3px solid rgba(37,99,235,0.25);
  outline-offset: 2px;
}

.pf-upgrade-modal__header{
  padding: 4px 44px 10px 6px;
}
.pf-upgrade-modal__title{
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.pf-upgrade-modal__subtitle{
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--pf-muted);
}

.pf-upgrade-plans{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 10px 6px 6px;
}
.pf-upgrade-plan{
  border: 1px solid var(--pf-border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(15,23,42,0.02), transparent);
  padding: 14px;
  display: grid;
  gap: 12px;
}
.pf-upgrade-plan__top{ display:flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pf-upgrade-plan__name{ margin: 0; font-size: 14px; font-weight: 800; }
.pf-upgrade-plan__price{
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.pf-upgrade-plan__price span{ font-size: 12px; color: var(--pf-muted); font-weight: 700; margin-left: 3px; }
.pf-upgrade-plan__list{
  margin: 0;
  padding: 0 0 0 16px;
  color: rgba(15,23,42,0.78);
  font-size: 12.5px;
  line-height: 1.45;
}
body.editor-page.pf-theme-dark .pf-upgrade-plan__list{ color: rgba(226,232,240,0.72); }
.pf-upgrade-plan__list li{ margin: 6px 0; }

.pf-upgrade-plan--featured{
  border-color: rgba(37,99,235,0.28);
  background: radial-gradient(circle at 20% 10%, rgba(37,99,235,0.14), transparent 55%),
              radial-gradient(circle at 90% 0%, rgba(14,165,233,0.14), transparent 50%),
              linear-gradient(180deg, rgba(15,23,42,0.02), transparent);
  position: relative;
}
.pf-upgrade-plan__badge{
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
  background: rgba(250,204,21,0.95);
  border: 1px solid rgba(250,204,21,0.55);
}
body.editor-page.pf-theme-dark .pf-upgrade-plan__badge{ color: #111827; }

/* Export Modal */
.pf-export-modal[hidden]{ display:none; }
.pf-export-modal{
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.pf-export-modal__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
}

.pf-export-modal__dialog{
  position: relative;
  background: var(--pf-panel);
  border-radius: var(--pf-radius);
  box-shadow: var(--pf-shadow);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.pf-export-modal:not([hidden]) .pf-export-modal__dialog{
  transform: scale(1);
  opacity: 1;
}

.pf-export-modal__close{
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--pf-muted);
  transition: all 0.15s ease;
  z-index: 1;
}

.pf-export-modal__close:hover{
  background: var(--pf-border);
  color: var(--pf-text);
}

.pf-export-modal__close:active{ transform: translateY(1px); }
.pf-export-modal__close:focus-visible{
  outline: 2px solid var(--pf-primary);
  outline-offset: 2px;
}

.pf-export-modal__header{
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--pf-border);
}

.pf-export-modal__title{
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--pf-text);
}

.pf-export-modal__subtitle{
  font-size: 14px;
  color: var(--pf-muted);
  margin: 0;
}

.pf-export-modal__body{
  padding: 24px;
  flex: 1;
}

.pf-export-format{
  margin-bottom: 24px;
}

.pf-export-label{
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--pf-text);
  margin-bottom: 12px;
}

.pf-export-format-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pf-export-format-btn{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border: 2px solid var(--pf-border);
  background: var(--pf-panel);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--pf-muted);
  font-size: 13px;
  font-weight: 500;
}

.pf-export-format-btn:hover{
  border-color: var(--pf-primary);
  color: var(--pf-primary);
  background: rgba(37, 99, 235, 0.05);
}

.pf-export-format-btn.is-active,
.pf-export-format-btn[aria-pressed="true"]{
  border-color: var(--pf-primary);
  background: var(--pf-primary);
  color: #ffffff;
}

.pf-export-format-btn svg{
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

.pf-export-params{
  margin-top: 24px;
}

.pf-export-param-group{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pf-export-label{
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pf-export-value{
  font-size: 13px;
  font-weight: 600;
  color: var(--pf-primary);
}

.pf-export-slider{
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--pf-border);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.pf-export-slider::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--pf-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pf-export-slider::-webkit-slider-thumb:hover{
  transform: scale(1.1);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.pf-export-slider::-moz-range-thumb{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--pf-primary);
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.pf-export-slider::-moz-range-thumb:hover{
  transform: scale(1.1);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.pf-export-hint{
  font-size: 12px;
  color: var(--pf-muted);
  margin: 0;
  line-height: 1.4;
}

.pf-export-modal__footer{
  padding: 16px 24px 24px;
  border-top: 1px solid var(--pf-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.pf-upgrade-modal__footer{
  padding: 8px 6px 2px;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 880px){
  .pf-upgrade-plans{ grid-template-columns: 1fr; }
}
.pf-editor{
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  overflow:hidden;
  display: flex;
  flex-direction: column;
}
.pf-layout{
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  position: relative;
  overflow: hidden;
}

.pf-left{
  display: grid;
  grid-template-columns: var(--pf-rail-w) minmax(0,1fr);
  border-right: 1px solid var(--pf-border);
  background: var(--pf-panel);
  position: relative;
  min-width: var(--pf-rail-w);
  width: var(--pf-left-w);
  transition: grid-template-columns 220ms ease, width 220ms ease;
  height: calc(100vh - var(--pf-topbar-h));
}
.pf-panel-toggle{
  position: absolute;
  top: 18px;
  transform: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--pf-border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  pointer-events: auto !important;
  transition: border-color 140ms ease;
}
.pf-panel-toggle svg{
  width: 22px;
  height: 22px;
  display: block;
  margin: auto;
  stroke: #0f172a;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 160ms ease;
}
.pf-panel-toggle:hover{ border-color: var(--pf-border-strong); }
.pf-panel-toggle--left{ right: -1px; }
.pf-left:not(.is-collapsed) .pf-panel-toggle--left svg{ transform: rotate(180deg); }
.pf-left.is-collapsed .pf-panel-toggle--left svg{ transform: rotate(0deg); }
.pf-left.is-collapsed{
  width: var(--pf-rail-w);
  grid-template-columns: var(--pf-rail-w) 0px;
}
.pf-left__panel{
  transition: opacity 200ms ease, transform 220ms ease;
}
.pf-left.is-collapsed .pf-left__panel{
  opacity: 0;
  transform: translateX(-16px);
  pointer-events: none;
}

.pf-left__rail{
  background: #ffffff;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 14px 10px;
}
.pf-rail-group{
  display:flex;
  flex-direction:column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--pf-border);
}
.pf-rail-group--top{ padding-bottom: 12px; }
.pf-rail-group--bottom{
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--pf-border);
  border-bottom: none;
  padding-bottom: 0;
}
.pf-rail-btn{
  border: 1px solid transparent;
  background: #ffffff;
  color: #0f172a;
  height: 42px;
  border-radius: 10px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.pf-rail-btn svg{
  width: 18px;
  height: 18px;
  stroke: currentColor;
}
.pf-rail-btn:hover{
  background: rgba(15,23,42,0.035);
  border-color: rgba(15,23,42,0.12);
}
.pf-rail-btn.is-active{
  background: rgba(37,99,235,0.10);
  border-color: rgba(37,99,235,0.3);
  color: #1d4ed8;
}
.pf-rail-label{
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pf-rail-btn--add{
  border: 1px solid var(--pf-border);
}
.pf-rail-btn--bottom{
  margin-top: auto;
}
.pf-rail-add{ position: relative; display:flex; flex-direction:column; gap:8px; }
.pf-rail-menu{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding: 8px;
  border: 1px solid var(--pf-border);
  border-radius: 12px;
  background: #ffffff;
  transform-origin: top;
  transition: opacity 160ms ease, transform 160ms ease;
}
.pf-rail-menu[hidden]{
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}
.pf-rail-menu__item{
  border: 1px solid var(--pf-border);
  background: #ffffff;
  border-radius: 10px;
  height: 34px;
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
}
.pf-rail-menu__item:hover{ background: rgba(15,23,42,0.04); }


.pf-left__logo{
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.pf-left__logo img{ width: 26px; height: 26px; object-fit: contain; }
.pf-avatar:focus-visible{ outline:3px solid rgba(37,99,235,0.35); outline-offset:2px; }

.pf-topbar__main{
  justify-content: space-between;
  gap: 22px;
}

.pf-topbar__group{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pf-home{
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pf-panel);
  box-shadow: 0 10px 25px rgba(15,23,42,0.10);
}
.pf-home__logo{ width: 30px; height: 30px; object-fit: contain; }
.pf-home:focus-visible{ outline: 3px solid rgba(37,99,235,0.35); outline-offset: 3px; }

.pf-doc-meta{ display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pf-title__input{
  border: 1px solid transparent;
  background: rgba(255,255,255,0.7);
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 16px;
  min-width: 120px;
  width: min(360px, 40vw);
  transition: border 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.pf-title__input:focus{
  border-color: rgba(37,99,235,0.4);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
  outline: none;
}
.pf-doc-status{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--pf-muted);
}
.pf-dot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 12px rgba(34,197,94,0.6);
}
.pf-title__status[data-status="unsaved"]{ color: #f97316; }
.pf-doc-status[data-state="unsaved"] .pf-dot{ background:#f97316; box-shadow:0 0 8px rgba(249,115,22,0.6); }

/* Buttons */
.pf-btn,
.pf-icon,
.pf-chip{
  border-radius: 999px;
  border: 1px solid var(--pf-border);
  background: var(--pf-panel);
  height: var(--pf-hit);
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 80ms ease;
}
.pf-btn:hover,
.pf-icon:hover,
.pf-chip:hover{ border-color: var(--pf-border-strong); background: rgba(15,23,42,0.03); }
.pf-btn:active,
.pf-icon:active{ transform: translateY(1px); }
.pf-btn:focus-visible,
.pf-icon:focus-visible,
.pf-chip:focus-visible{ outline: 3px solid rgba(37,99,235,0.35); outline-offset: 2px; }

.pf-btn--primary{
  background: var(--pf-primary);
  border-color: var(--pf-primary);
  color: #fff;
  box-shadow: 0 15px 25px rgba(37,99,235,0.32);
}
.pf-btn--primary:hover{ background: var(--pf-primary-2); border-color: var(--pf-primary-2); }

.pf-btn--ghost{
  background: transparent;
  border-color: transparent;
}

.pf-btn--danger{
  background: rgba(220,38,38,0.08);
  border-color: rgba(220,38,38,0.2);
  color: var(--pf-danger);
}

.pf-icon{ width: var(--pf-hit); padding:0; }
.pf-icon--sm{ width: 32px; height: 32px; }
.pf-icon--ghost{ background: transparent; border-color: transparent; box-shadow: none; color: var(--pf-muted); }
.pf-icon.is-active{ background: rgba(37,99,235,0.15); border-color: rgba(37,99,235,0.4); color: var(--pf-primary); }
.pf-icon svg,
.pf-icon .lucide-icon,
.pf-rail-btn svg,
.pf-rail-btn .lucide-icon{
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pf-rail-btn svg,
.pf-rail-btn .lucide-icon{ width: 22px; height: 22px; }
.pf-rail-btn svg path{ fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.pf-chip{ background: var(--pf-panel-muted); font-weight: 500; height: 32px; }
.pf-chip--subtle{ background: transparent; border-style: dashed; }
.pf-chip--ghost{ background: transparent; border-color: transparent; color: var(--pf-muted); }
.pf-chip--label{ text-transform: uppercase; font-size: 11px; letter-spacing: 0.08em; height: 28px; }

.pf-icon-group{
  display: inline-flex;
  gap: 6px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--pf-border);
  background: rgba(255,255,255,0.75);
}

.pf-seg{
  display: inline-flex;
  border-radius: 999px;
  padding: 3px;
  border: 1px solid var(--pf-border);
  background: rgba(255,255,255,0.9);
}
.pf-btn--seg{
  padding: 0 14px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  font-weight: 600;
}
.pf-btn--seg.is-active{
  background: #fff;
  border-color: var(--pf-border);
  box-shadow: 0 8px 20px rgba(15,23,42,0.08);
}

/* Layout */
.pf-layout{
  height: 100vh;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  position: relative;
  overflow: hidden;
}

.pf-left{
  border-right: 1px solid var(--pf-border);
  background: var(--pf-panel);
  display: flex;
  align-items: stretch;
  width: 86px;
  transition: width 200ms ease;
}
.pf-left.is-collapsed{ width: 0; border-right: none; overflow: hidden; }
.pf-left.is-collapsed .pf-left__rail--single{ opacity:0; pointer-events:none; }

.pf-left-launcher{
  position:absolute;
    right: -1px;
    top: 50%;
    transform: translateY(-50%);
  top: 18px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--pf-border);
  background: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
}
.pf-left.is-collapsed ~ .pf-left-launcher{ display:flex; }

.pf-left__rail--single{
  width: 86px;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.pf-left__logo{
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--pf-border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pf-left__logo img{ width: 26px; height: 26px; object-fit: contain; }

.pf-left-tools{
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.pf-left-tool{
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--pf-border);
  background: #fff;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.pf-left-tool[aria-pressed="true"]{
  background: rgba(37,99,235,0.12);
  border-color: rgba(37,99,235,0.4);
  color: var(--pf-primary);
}

.pf-left-unit{
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--pf-muted);
}

.pf-left-collapse{
  margin-top: auto;
  border: 1px solid var(--pf-border);
  background: transparent;
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
}

.pf-left__rail{
  padding-top: 18px;
}

.pf-left__logo{
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.pf-left__logo img{ width: 26px; height: 26px; object-fit: contain; }

.pf-avatar{
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  letter-spacing: 0.08em;
}

.pf-control-row{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pf-left{
  display: grid;
  grid-template-columns: var(--pf-rail-w) minmax(0,1fr);
  border-right: 1px solid var(--pf-border);
  background: var(--pf-panel);
  position: relative;
  min-width: var(--pf-rail-w);
  width: var(--pf-left-w);
  transition: grid-template-columns 220ms ease, width 220ms ease;
}
.pf-left:not(.is-collapsed){ min-width: var(--pf-left-w); }
.pf-left.is-collapsed{ width: var(--pf-rail-w); }
.pf-left.is-collapsed{
  grid-template-columns: var(--pf-rail-w) 0px;
}
.pf-left__panel{
  transition: opacity 200ms ease, transform 220ms ease;
}
.pf-left.is-collapsed .pf-left__panel{
  opacity: 0;
  transform: translateX(-16px);
  pointer-events: none;
}

.pf-left__rail{
  background: #ffffff;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 16px 10px;
}

.pf-rail-btn{
  width: 100%;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  transition: background 120ms ease, border 120ms ease;
}
.pf-rail-btn svg{
  width: 24px;
    height: 22px;
    display: block;
    margin: 0 auto;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pf-rail-label{ font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.8; }
.pf-rail-btn:hover{ background: rgba(15,23,42,0.06); }
.pf-rail-btn.is-active{ background: rgba(15,23,42,0.08); border-color: rgba(15,23,42,0.18); }

.pf-left__panel{ display: flex; flex-direction: column; min-width: 0; }

.pf-left__panel{
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}

.pf-left-body{
  overflow: auto;
  min-height: 0;
  padding: 0 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pf-left-footer{
  padding: 16px 20px 20px;
  border-top: 1px solid var(--pf-border);
  background: rgba(255,255,255,0.95);
}
.pf-left-footer .pf-btn{ width: 100%; justify-content: center; }
.pf-left-footer{ display:none; }

.pf-panel-section{
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pf-panel-section h4{
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.pf-action-list{ display: flex; flex-direction: column; gap: 10px; }
.pf-action-item{
  border-radius: 12px;
  border: 1px solid var(--pf-border);
  background: #fff;
  padding: 10px 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.pf-action-item input{ display:none; }
.pf-action-item:hover{ border-color: var(--pf-border-strong); background: rgba(15,23,42,0.03); }

.pf-toggle-list{ display: flex; flex-direction: column; gap: 10px; }
.pf-toggle-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--pf-text);
}
.pf-toggle-row--full{ width: 100%; }
.pf-toggle{
  border-radius: 999px;
  border: 1px solid var(--pf-border);
  padding: 6px 12px;
  font-weight: 600;
  background: #fff;
  cursor: pointer;
}
.pf-toggle[aria-pressed="true"]{
  background: var(--pf-primary);
  border-color: var(--pf-primary);
  color: #fff;
}

.pf-switch{
  position: relative;
  display: inline-flex;
  width: 46px;
  height: 26px;
}
.pf-switch input{
  opacity: 0;
  width: 0;
  height: 0;
}
.pf-switch span{
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.12);
  border-radius: 999px;
  transition: background 160ms ease;
}
.pf-switch span::after{
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 3px;
  left: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(15,23,42,0.2);
  transition: transform 160ms ease;
}
.pf-switch input:checked + span{
  background: var(--pf-primary);
}
.pf-switch input:checked + span::after{
  transform: translateX(20px);
}

.pf-gallery-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.pf-gallery-card{
  border-radius: 14px;
  border: 1px dashed var(--pf-border);
  background: #fff;
  padding: 12px;
  text-align: left;
  font-size: 12px;
  color: var(--pf-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pf-gallery-card strong{ font-size: 13px; color: var(--pf-text); }
.pf-gallery-card:hover{ border-color: var(--pf-border-strong); background: rgba(15,23,42,0.03); }

.pf-upload-drop{
  border-radius: 16px;
  border: 2px dashed var(--pf-border);
  background: rgba(248,250,255,0.8);
  padding: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}
.pf-upload-drop input{ display: none; }
.pf-upload-actions{ display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pf-upload-actions input{ display: none; }

.pf-upload-progress{
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--pf-muted);
}

.pf-progress{
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(15,23,42,0.08);
  overflow: hidden;
}
.pf-progress span{
  display: block;
  height: 100%;
  background: var(--pf-primary);
}

.pf-progress-card{
  border-radius: 14px;
  border: 1px solid var(--pf-border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #fff;
}

.pf-panel-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--pf-border);
  background: rgba(255,255,255,0.9);
}
.pf-panel-headings{ display:flex; flex-direction:column; gap:4px; }
.pf-panel-kicker{ margin:0; font-size:11px; letter-spacing:0.08em; text-transform:uppercase; color: var(--pf-muted); }
.pf-panel-title{ font-size:18px; font-weight:700; }
.pf-panel-subtitle{ margin:0 0 12px; font-size:13px; color: var(--pf-muted); }
.pf-panel-actions{ display:flex; gap:8px; align-items:center; }

.pf-left-account{
  display:flex;
  align-items:center;
  gap:10px;
  padding:6px 10px;
  border-radius:12px;
  border:1px solid var(--pf-border);
  background:#fff;
  font-size:12px;
  color: var(--pf-muted);
}
.pf-left-account strong{ display:block; font-size:13px; color: var(--pf-text); }
.pf-left-avatar{
  width:32px;
  height:32px;
  border-radius:50%;
  background:#0b1220;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  letter-spacing:0.04em;
}

.pf-left-view{
  padding: 0;
  overflow: auto;
  min-height: 0;
  display: none;
}
.pf-left-view.is-active{ display:block; }
.pf-left-view[hidden]{ display:none !important; }

.pf-search{
  display:block;
  margin-bottom: 12px;
}
.pf-search--icon{
  position:relative;
}
.pf-search--icon svg{
  position:absolute;
  left:16px;
  top:50%;
  width:16px;
  height:16px;
  color: var(--pf-muted);
  transform:translateY(-50%);
  pointer-events:none;
}
.pf-search__input{
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--pf-border);
  padding: 0 16px;
  background: rgba(255,255,255,0.8);
}
.pf-search--icon .pf-search__input{
  padding-left:42px;
}
.pf-search__input:focus{ border-color: rgba(37,99,235,0.4); outline:none; box-shadow:0 0 0 3px rgba(37,99,235,0.1); }

.pf-chiplist{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom: 14px; }
.pf-chiplist .pf-chip{ cursor: default; }
.pf-chiplist .pf-chip.is-active{ border-color: rgba(37,99,235,0.4); background: rgba(37,99,235,0.12); color: var(--pf-primary); }

.pf-filter-pills{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:18px;
}
.pf-pill{
  border:none;
  border-radius:30px;
  padding:8px 16px;
  background: rgba(15,23,42,0.06);
  font-size:13px;
  font-weight:600;
  color: var(--pf-muted);
  cursor:pointer;
  transition: background 120ms ease, color 120ms ease;
}
.pf-pill.is-active{
  background:#0b1220;
  color:#fff;
}

.pf-templates{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}
.pf-template{
  --tpl-bg: #1d4ed8;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:12px;
  border-radius: 0;
  border: 1px solid var(--pf-border);
  background: #fff;
  box-shadow: 0 16px 40px rgba(15,23,42,0.08);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.pf-template:hover{ transform: translateY(-3px); box-shadow:0 20px 50px rgba(15,23,42,0.12); }
.pf-template__preview{
  width:100%;
  aspect-ratio: 297/210;
  border-radius: 0;
  background: var(--tpl-bg);
}
.pf-template__meta{ display:flex; flex-direction:column; gap:2px; font-size:12px; color: var(--pf-muted); }
.pf-template__meta strong{ font-size:13px; color: var(--pf-text); }

.pf-template.t1{ --tpl-bg: #0b1f3a; }
.pf-template.t2{ --tpl-bg: #1d4ed8; }
.pf-template.t3{ --tpl-bg: #0b0f17; }
.pf-template.t4{ --tpl-bg: #1e3a8a; }
.pf-template.t5{ --tpl-bg: #6d28d9; }
.pf-template.t6{ --tpl-bg: #0ea5e9; }

.pf-templates-shell{
  display:flex;
  flex-direction:column;
  gap:28px;
}

.pf-template-section{
  background: rgba(248,250,255,0.9);
  border:1px solid var(--pf-border);
  border-radius:24px;
  padding:18px 16px 20px;
  box-shadow:0 20px 50px rgba(15,23,42,0.08);
}

.pf-section-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}
.pf-section-head p{ margin:0; }
.pf-section-head h3{
  margin:2px 0 0;
  font-size:18px;
}

.pf-link{
  border:none;
  background:none;
  color: var(--pf-primary);
  font-weight:600;
  cursor:pointer;
}

.pf-template-row{
  display:flex;
  gap:12px;
  overflow-x:auto;
  padding-bottom:4px;
}

.pf-template-card{
  --tpl-bg: #1d4ed8;
  min-width:190px;
  flex:0 0 190px;
  border-radius:0;
  border:1px solid var(--pf-border);
  background:#fff;
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  box-shadow:0 15px 35px rgba(15,23,42,0.08);
  cursor:pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.pf-template-card:hover{ transform:translateY(-4px); box-shadow:0 25px 55px rgba(15,23,42,0.12); }
.pf-template-thumb{
  width:100%;
  aspect-ratio:297/210;
  border-radius:0;
  background: var(--tpl-bg);
  position:relative;
}
.pf-template-thumb::after{
  content:"";
  position:absolute;
  width:34px;
  height:34px;
  border-radius:50%;
  background: rgba(255,255,255,0.65);
  top:18px;
  left:18px;
  box-shadow:0 4px 12px rgba(15,23,42,0.18);
}
.pf-template-card__body{ display:flex; flex-direction:column; gap:2px; font-size:12px; color: var(--pf-muted); }
.pf-template-card__body strong{ font-size:14px; color: var(--pf-text); }

.pf-template-card.t1{ --tpl-bg: #0b1f3a; }
.pf-template-card.t2{ --tpl-bg: #1d4ed8; }
.pf-template-card.t3{ --tpl-bg: #0b0f17; }
.pf-template-card.t4{ --tpl-bg: #1e3a8a; }
.pf-template-card.t5{ --tpl-bg: #6d28d9; }
.pf-template-card.t6{ --tpl-bg: #0ea5e9; }

/* Minimal templates grid (editor left panel) */
.pf-templates-min{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-top: 6px;
}
.pf-template-mini{
  aspect-ratio: 297 / 210;
  width: 100%;
  border-radius: 0;
  border: 1px solid rgba(15,23,42,0.10);
  background: rgba(248,250,252,0.92);
  position: relative;
  box-shadow: 0 14px 34px rgba(15,23,42,0.10);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
  overflow: hidden;
}
.pf-template-mini:hover{
  transform: translateY(-2px);
  border-color: rgba(37,99,235,0.22);
  box-shadow: 0 26px 60px rgba(15,23,42,0.16);
}
.pf-template-mini:focus-visible{
  outline: 3px solid rgba(37,99,235,0.35);
  outline-offset: 3px;
}
.pf-template-mini::after{
  content:"";
  position:absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  bottom: 40px;
  border-radius: 0;
  background:
    radial-gradient(circle at 18% 72%, rgba(0,0,0,0) 0 9px, var(--tpl-seal) 9px 10px, rgba(0,0,0,0) 10px 100%),
    radial-gradient(circle at 18% 72%, var(--tpl-seal-soft) 0 9px, rgba(0,0,0,0) 9px 100%),
    /* dividers */
    linear-gradient(to right, rgba(0,0,0,0) 0 18%, var(--tpl-line) 18% 82%, rgba(0,0,0,0) 82% 100%) 0 46% / 100% 1px no-repeat,
    linear-gradient(to right, rgba(0,0,0,0) 0 26%, var(--tpl-line) 26% 74%, rgba(0,0,0,0) 74% 100%) 0 58% / 100% 1px no-repeat,
    /* title block */
    linear-gradient(to right, rgba(0,0,0,0) 0 22%, var(--tpl-title) 22% 78%, rgba(0,0,0,0) 78% 100%) 0 30% / 100% 6px no-repeat,
    linear-gradient(to right, rgba(0,0,0,0) 0 30%, var(--tpl-muted) 30% 70%, rgba(0,0,0,0) 70% 100%) 0 36% / 100% 3px no-repeat,
    /* accents */
    linear-gradient(to bottom, var(--tpl-accent) 0 10px, rgba(0,0,0,0) 10px 100%) 0 0 / 100% 100% no-repeat,
    linear-gradient(to bottom, var(--tpl-accent2) 0 4px, rgba(0,0,0,0) 4px 100%) 0 10px / 100% 100% no-repeat,
    linear-gradient(to top, var(--tpl-accent2-soft) 0 10px, rgba(0,0,0,0) 10px 100%) 0 0 / 100% 100% no-repeat,
    /* paper */
    linear-gradient(var(--tpl-paper), var(--tpl-paper));
  box-shadow:
    0 10px 22px rgba(15,23,42,0.10),
    inset 0 0 0 1px var(--tpl-border),
    inset 0 0 0 10px rgba(0,0,0,0),
    inset 0 0 0 0 rgba(0,0,0,0);
  pointer-events:none;
}
.pf-template-mini[hidden]{ display:none !important; }

/* Template thumbnail tokens: subtle, print-like previews (sharp corners inside). */
.pf-template-mini{ 
  --tpl-paper: #ffffff;
  --tpl-border: rgba(15,23,42,0.12);
  --tpl-line: rgba(15,23,42,0.16);
  --tpl-title: rgba(15,23,42,0.68);
  --tpl-muted: rgba(15,23,42,0.38);
  --tpl-accent: #0b1f3a;
  --tpl-accent2: #7a102b;
  --tpl-accent2-soft: rgba(122,16,43,0.10);
  --tpl-seal: rgba(122,16,43,0.78);
  --tpl-seal-soft: rgba(122,16,43,0.18);
}
.pf-template-mini.t1{
  --tpl-paper: #fbf6ee;
  --tpl-accent: #0b1f3a;
  --tpl-accent2: #7a102b;
  --tpl-accent2-soft: rgba(122,16,43,0.10);
  --tpl-border: rgba(122,16,43,0.22);
  --tpl-seal: rgba(122,16,43,0.82);
  --tpl-seal-soft: rgba(122,16,43,0.18);
}
.pf-template-mini.t2{
  --tpl-paper: #ffffff;
  --tpl-accent: #0f172a;
  --tpl-accent2: #1d4ed8;
  --tpl-accent2-soft: rgba(29,78,216,0.12);
  --tpl-border: rgba(15,23,42,0.18);
  --tpl-seal: rgba(29,78,216,0.80);
  --tpl-seal-soft: rgba(29,78,216,0.18);
}
.pf-template-mini.t3{
  --tpl-paper: #0b0f17;
  --tpl-border: rgba(212,175,55,0.55);
  --tpl-line: rgba(212,175,55,0.35);
  --tpl-title: rgba(248,250,252,0.78);
  --tpl-muted: rgba(248,250,252,0.50);
  --tpl-accent: #d4af37;
  --tpl-accent2: #b8860b;
  --tpl-accent2-soft: rgba(212,175,55,0.12);
  --tpl-seal: rgba(212,175,55,0.85);
  --tpl-seal-soft: rgba(212,175,55,0.18);
}
.pf-template-mini.t4{
  --tpl-paper: #f8fafc;
  --tpl-accent: #1e3a8a;
  --tpl-accent2: #14532d;
  --tpl-accent2-soft: rgba(20,83,45,0.10);
  --tpl-border: rgba(30,58,138,0.20);
  --tpl-seal: rgba(20,83,45,0.78);
  --tpl-seal-soft: rgba(20,83,45,0.18);
}
.pf-template-mini.t5{
  --tpl-paper: #ffffff;
  --tpl-accent: #0f766e;
  --tpl-accent2: #6d28d9;
  --tpl-accent2-soft: rgba(109,40,217,0.12);
  --tpl-border: rgba(15,23,42,0.18);
  --tpl-seal: rgba(109,40,217,0.80);
  --tpl-seal-soft: rgba(109,40,217,0.18);
}
.pf-template-mini.t6{
  --tpl-paper: #ffffff;
  --tpl-accent: #111827;
  --tpl-accent2: #0ea5e9;
  --tpl-accent2-soft: rgba(14,165,233,0.12);
  --tpl-border: rgba(17,24,39,0.18);
  --tpl-seal: rgba(14,165,233,0.80);
  --tpl-seal-soft: rgba(14,165,233,0.18);
}

.pf-library{ display:flex; flex-direction:column; gap:20px; }
.pf-library__group{ border:1px solid var(--pf-border); border-radius:18px; padding:16px; background: rgba(248,250,255,0.75); }
.pf-library__title{ margin:0 0 10px; font-size:12px; letter-spacing:0.08em; text-transform:uppercase; color: var(--pf-muted); }
.pf-library__grid{ display:grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); gap:10px; }

.pf-element-card,
.pf-upload-card{
  border-radius:14px;
  border:1px dashed var(--pf-border);
  background:#fff;
  padding:12px;
  display:flex;
  gap:12px;
  align-items:center;
  cursor:pointer;
  transition: border 120ms ease, box-shadow 120ms ease;
}
.pf-element-card:hover,
.pf-upload-card:hover{ border-color: rgba(37,99,235,0.5); box-shadow:0 12px 30px rgba(15,23,42,0.08); }
.pf-element-card__icon,
.pf-upload-card__icon{
  width:40px;
  height:40px;
  border-radius:12px;
  background: rgba(37,99,235,0.12);
  color: var(--pf-primary);
  font-weight:700;
  display:flex;
  align-items:center;
  justify-content:center;
}
.pf-element-card__icon svg,
.pf-upload-card__icon svg{
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pf-element-card__body,
.pf-upload-card__body{ display:flex; flex-direction:column; font-size:12px; color: var(--pf-muted); }
.pf-element-card__body strong,
.pf-upload-card__body strong{ font-size:14px; color: var(--pf-text); }
.pf-upload-card input{ display:none; }

.pf-hint{ font-size:12px; color: var(--pf-muted); margin-top:12px; line-height: 1.5; }
.pf-hint--inline{ border-top:1px solid var(--pf-border); padding-top:10px; }

/* Shortcut items for help panel */
.pf-shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid var(--pf-border);
}

.pf-shortcut-key {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.08);
  color: var(--pf-text);
  min-width: 60px;
  text-align: center;
}

.pf-shortcut-label {
  font-size: 13px;
  color: var(--pf-muted);
  flex: 1;
  margin-left: 12px;
}

.pf-layers__header{ display:flex; justify-content:space-between; align-items:flex-start; gap:12px; margin-bottom:14px; }
.pf-layers__controls{ display:flex; gap:6px; }

/* Resizers */
.pf-resizer{
  position:absolute;
  top:0;
  right:-4px;
  width:8px;
  height:100%;
  cursor: col-resize;
  z-index: 5;
  touch-action: none;
}
.pf-right .pf-resizer{ left:-4px; right:auto; }

/* Center */
.pf-center{
  position: relative;
  display:block;
  background: transparent;
  min-width: 0;
  overflow: hidden;
  height: calc(100vh - var(--pf-topbar-h));
}
.pf-floating-toolbar{
  position:absolute;
  top: 24px;
  left: 24px;
  display:flex;
  align-items:flex-start;
  gap:12px;
  padding:10px 12px;
  border-radius: 18px;
  border:1px solid var(--pf-border);
  background: rgba(255,255,255,0.92);
  box-shadow: 0 18px 40px rgba(15,23,42,0.12);
  backdrop-filter: blur(12px);
  z-index: 12;
  cursor: default;
  pointer-events: none;
}
.pf-toolbar-row{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap: nowrap;
}
.pf-toolbar-row--single .pf-icon-group{ padding: 2px; }
.pf-toolbar-row--single .pf-seg{ margin-left: 2px; }

.pf-float-handle{
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border:1px solid var(--pf-border);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor: grab;
  pointer-events: auto;
}
.pf-float-handle svg{
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}
.pf-float-handle:active{ cursor: grabbing; }
.pf-floating-toolbar .pf-icon,
.pf-floating-toolbar .pf-btn,
.pf-floating-toolbar .pf-chip,
.pf-floating-toolbar .pf-seg,
.pf-floating-toolbar .pf-input,
.pf-floating-toolbar .pf-select{
  pointer-events: auto;
}
.pf-floating-toolbar:hover{
  box-shadow: 0 22px 55px rgba(15,23,42,0.16);
}
.pf-floating-toolbar:active{
  box-shadow: 0 14px 32px rgba(15,23,42,0.12);
}

.pf-artboard-controls{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid var(--pf-border);
  background: rgba(255,255,255,0.9);
}
.pf-size-inputs{
  display:flex;
  align-items:center;
  gap:6px;
}
.pf-size-sep{
  font-size:12px;
  color: var(--pf-muted);
}
.pf-input--sm{
  height: 32px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 10px;
  width: 90px;
}
.pf-select--sm{
  height: 32px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 10px;
}

.pf-viewport{
  overflow: auto;
  background: #eef0f3;
  padding: 24px;
  position:relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
body.pf-theme-dark .pf-viewport{ background: #0b1220; }

/* Grid (whole canvas) */
.pf-viewport.pf-grid-on::after{
  content:"";
  position:absolute;
  inset:0;
  background-image: var(--pf-grid-pattern);
  background-size: calc(var(--pf-grid-step) * var(--pf-zoom, 1)) calc(var(--pf-grid-step) * var(--pf-zoom, 1));
  background-position: var(--pf-grid-offset-x, 0px) var(--pf-grid-offset-y, 0px);
  opacity: 1;
  pointer-events:none;
  z-index: 0;
  display: block;
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--pf-grid-pattern);
  background-size: calc(var(--pf-grid-step) * var(--pf-zoom, 1)) calc(var(--pf-grid-step) * var(--pf-zoom, 1));
  background-position: var(--pf-grid-offset-x, 0px) var(--pf-grid-offset-y, 0px);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  display: none;
}

.pf-viewport.pf-ruler-on{
  padding-top: 24px;
  padding-left: 24px;
}

.pf-ruler{
  position:absolute;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--pf-border);
  z-index: 6;
  font-size: 10px;
  color: var(--pf-muted);
  display: none;
}
.pf-viewport.pf-ruler-on .pf-ruler{ display:block; }
.pf-ruler--top{
  top: var(--pf-vp-scroll-y, 0px);
  left: calc(var(--pf-vp-scroll-x, 0px) + var(--pf-ruler-left, 0px));
  width: calc(100% - var(--pf-ruler-left, 0px));
  height: 24px;
}
.pf-ruler--left{
  top: var(--pf-vp-scroll-y, 0px);
  left: calc(var(--pf-vp-scroll-x, 0px) + var(--pf-ruler-left, 0px));
  width: 24px;
  height: 100%;
}
.pf-ruler-tick{
  position:absolute;
  background: rgba(15,23,42,0.3);
}
.pf-ruler--top .pf-ruler-tick{ width:1px; height:8px; bottom:0; }
.pf-ruler--left .pf-ruler-tick{ height:1px; width:8px; right:0; }
.pf-ruler-label{
  position:absolute;
  font-size:10px;
  color: var(--pf-muted);
}

.pf-guidelines{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:6;
}
.pf-guideline{
  position:absolute;
  background: rgba(37,99,235,0.75);
  opacity:0.9;
}
.pf-guideline--x{ width:1px; top:0; bottom:0; }
.pf-guideline--y{ height:1px; left:0; right:0; }
body.pf-theme-dark .pf-viewport{ background: #0b1220; }

/* Rulers should adapt when the left overlay panel opens/closes */
body.editor-page .pf-center{
  --pf-ruler-left: 0px;
}
body.editor-page .pf-left:not(.is-collapsed) ~ .pf-center{
  --pf-ruler-left: var(--pf-left-w);
}
body.editor-page .pf-left.is-collapsed ~ .pf-center{
  --pf-ruler-left: var(--pf-rail-w);
}
.pf-viewport.pf-ruler-on::before{
  content:"";
  position:absolute;
  inset:0;
  background-image:
    linear-gradient(to right, rgba(15,23,42,0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15,23,42,0.12) 1px, transparent 1px);
  background-size: 40px 20px, 20px 40px;
  background-position: var(--pf-grid-offset-x, 0px) var(--pf-grid-offset-y, 0px);
  opacity: 0;
  pointer-events:none;
  display: none;
}

.pf-viewport,
.pf-right__scroll{
  scrollbar-width: none;
}
.pf-viewport::-webkit-scrollbar,
.pf-right__scroll::-webkit-scrollbar{
  width: 0;
  height: 0;
}

.pf-stage-wrap{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  margin: 0 auto;
  border-radius: 26px;
  padding: 60px;
  background: transparent;
}

.pf-ai-bar{
  margin: 16px 18px 24px;
  border-radius: 999px;
  border:1px solid var(--pf-border);
  background:#fff;
  box-shadow:0 25px 70px rgba(15,23,42,0.12);
  display:flex;
  align-items:center;
  gap:18px;
  padding:8px 20px;
}
.pf-ai-buttons{ display:flex; gap:8px; }
.pf-ai-buttons .pf-icon{ width:38px; height:38px; }
.pf-ai-input{ flex:1; }
.pf-ai-input input{
  width:100%;
  border:none;
  font-size:15px;
  font-weight:600;
  padding:8px 4px;
}
.pf-ai-input input:focus{ outline:none; }
.pf-ai-status{ display:flex; gap:10px; }



.pf-stage {
  position: relative;
  width: 1122px; /* A4 landscape at 96dpi: 297mm x 210mm */
  height: 793px;
  background: #fff;
  box-shadow: 0 10px 32px rgba(15,23,42,0.18), 0 1.5px 6px rgba(0,0,0,0.08);
  border-radius: 0;
  border: 2px solid #e5e7eb;
  outline: none;
  overflow: visible;
  margin: 0 auto;
  display: block;
}

.pf-stage::before {
  display: none !important;
}

/* Empty-canvas mode: no visible page/artboard until a template is inserted */

.pf-stage.is-empty {
  background: #fff !important;
  box-shadow: 0 10px 32px rgba(15,23,42,0.18), 0 1.5px 6px rgba(0,0,0,0.08) !important;
}
.pf-stage.is-empty::before {
  display: none !important;
}


.pf-artboard-overlay,
.pf-artboard-overlay.is-on,
.pf-artboard-box,
.pf-artboard-handle {
  display: none !important;
}

.pf-guides{ position:absolute; inset:0; pointer-events:none; z-index:5; }
.pf-artboard-grid{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:4;
  opacity: 0;
  background-image: var(--pf-grid-pattern);
  background-size: var(--pf-grid-step) var(--pf-grid-step);
  background-position: 0 0;
  display: none;
}
.pf-stage.pf-grid-off .pf-artboard-grid{
  opacity: 0;
  display: none;
  opacity: 1;
  display: block;
}
.pf-guide{ position:absolute; background: rgba(37,99,235,0.65); opacity:0; }
.pf-guide.is-on{ opacity:1; }
.pf-guide--v{ width:1px; top:0; bottom:0; }
.pf-guide--h{ height:1px; left:0; right:0; }

.pf-node{
  position:absolute;
  border-radius:0;
  padding:0;
  margin:0;
  user-select:none;
  white-space:pre-wrap;
}
.pf-node[data-type="text"]{ padding:2px 4px; }
.pf-node.is-selected{ outline:none; }
.pf-node.is-hover{ outline:1px dashed rgba(37,99,235,0.35); outline-offset:2px; }
.pf-node.is-editing{
  cursor:text;
  user-select:text;
  background: rgba(255,255,255,0.65);
  box-shadow:0 0 0 4px rgba(37,99,235,0.18);
}
.pf-node[data-type="rect"]{ background: rgba(37,99,235,0.08); border:1px solid rgba(37,99,235,0.25); }
.pf-node[data-type="line"]{ background: rgba(15,23,42,0.2); border-radius:999px; }
.pf-node[data-type="image"] img{ width:100%; height:100%; object-fit:cover; border-radius:0; pointer-events:none; }

.pf-selection{
  position:absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events:none;
  z-index:10;
  overflow: visible;
  --pf-inv-object-scale: 1;
}
.pf-selection__box{
  position:absolute;
  inset:0;
  border-style: solid;
  border-color: rgba(37,99,235,0.70);
  border-width: calc(1px * var(--pf-inv-zoom, 1) * var(--pf-inv-object-scale, 1));
  box-shadow:none;
  border-radius:0;
}
.pf-selection__line{
  position:absolute;
  background: rgba(37,99,235,0.55);
  pointer-events:none;
}
.pf-selection__line--v{ width: calc(1px * var(--pf-inv-zoom, 1) * var(--pf-inv-object-scale, 1)); top:0; bottom:0; }
.pf-selection__line--h{ height: calc(1px * var(--pf-inv-zoom, 1) * var(--pf-inv-object-scale, 1)); left:0; right:0; }
.pf-handle{ position:absolute; width:16px; height:16px; border-radius:50%; border:2px solid #fff; background:rgba(37,99,235,0.95); box-shadow:0 2px 10px rgba(15,23,42,0.18); cursor:nwse-resize; }
.pf-handle,
.pf-rotate-handle{
  pointer-events: auto;
  transform: translate(-50%, -50%);
}
.pf-handle{
  width: calc(14px * var(--pf-inv-zoom, 1) * var(--pf-inv-object-scale, 1));
  height: calc(14px * var(--pf-inv-zoom, 1) * var(--pf-inv-object-scale, 1));
  border-width: calc(2px * var(--pf-inv-zoom, 1) * var(--pf-inv-object-scale, 1));
}
.pf-handle[data-handle="n"],
.pf-handle[data-handle="s"]{ cursor:ns-resize; }
.pf-handle[data-handle="e"],
.pf-handle[data-handle="w"]{ cursor:ew-resize; }
.pf-rotate-handle{
  position:absolute;
  width: calc(16px * var(--pf-inv-zoom, 1) * var(--pf-inv-object-scale, 1));
  height: calc(16px * var(--pf-inv-zoom, 1) * var(--pf-inv-object-scale, 1));
  border-radius:50%;
  background:#fff;
  border: calc(2px * var(--pf-inv-zoom, 1) * var(--pf-inv-object-scale, 1)) solid rgba(37,99,235,0.95);
  box-shadow:0 2px 10px rgba(15,23,42,0.18);
  cursor: grab;
}

/* Right panel */
.pf-right{
  position: fixed;
  top: var(--pf-topbar-h);
  right: 0;
  height: calc(100vh - var(--pf-topbar-h));
  width: var(--pf-rail-w);
  z-index: 40;
  pointer-events: none;
}
.pf-right-rail{
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding: 16px 10px;
  background: #ffffff;
  color: #0f172a;
  width: var(--pf-rail-w);
  height: calc(100vh - var(--pf-topbar-h));
  position: relative;
  z-index: 2;
  pointer-events: auto;
}
.pf-panel-toggle--right{ left: -1px; pointer-events: auto; }
.pf-right:not(.is-collapsed) .pf-panel-toggle--right svg{ transform: rotate(180deg); }
.pf-right.is-collapsed .pf-panel-toggle--right svg{ transform: rotate(0deg); }
.pf-right-avatar{
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(15,23,42,0.15);
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.pf-right-shell{
  position: fixed;
  top: var(--pf-topbar-h);
  right: var(--pf-rail-w);
  height: calc(100vh - var(--pf-topbar-h));
  width: var(--pf-right-panel-w);
  display:flex;
  flex-direction:column;
  min-width: 0;
  transition: opacity 180ms ease, transform 260ms cubic-bezier(.2,.85,.2,1);
  background: var(--pf-panel);
  border-left: 1px solid var(--pf-border);
  box-shadow: none;
  z-index: 1;
  pointer-events: auto;
}
.pf-right.is-collapsed .pf-right-shell{
  opacity:0;
  transform: translateX(100%);
  pointer-events:none;
}
.pf-right:not(.is-collapsed) .pf-right-shell{
  opacity:1;
  transform: translateX(0);
}

.pf-context-menu{
  position: fixed;
  min-width: 180px;
  background: #0f172a;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 18px 40px rgba(15,23,42,0.35);
  z-index: 60;
}
.pf-context-item{
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.pf-context-item:hover{ background: rgba(255,255,255,0.08); }
.pf-context-item--danger{ color: #fca5a5; }

.pf-right-launcher{ display:none; }

.pf-right__scroll{
  overflow:auto;
  padding: 14px;
  display:flex;
  flex-direction:column;
  gap: 12px;
}
.pf-empty{ font-size:13px; color: var(--pf-muted); margin-bottom:12px; }
.pf-info-chip{ margin-top:12px; font-size:12px; color: var(--pf-muted); border-top:1px solid var(--pf-border); padding-top:10px; }
.pf-right .pf-panel-section{
  display:flex;
  flex-direction:column;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--pf-border);
}
.pf-right .pf-panel-section > h4{
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pf-right .pf-panel-section--sticky{
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
  padding-top: 8px;
}
.pf-right .pf-btn,
.pf-right .pf-icon,
.pf-right .pf-chip,
.pf-right .pf-accordion,
.pf-right .pf-tool-card,
.pf-right .pf-color-board,
.pf-right .pf-tools-board{
  box-shadow: none !important;
}
.pf-right .pf-accordion[open]{ box-shadow: none; }

.pf-object-info{
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:12px;
  border:1px solid var(--pf-border);
  border-radius: 16px;
  background: rgba(255,255,255,0.92);
  margin-bottom:6px;
}
.pf-object-type{ margin:4px 0 0; font-size:18px; font-weight:700; }
.pf-inline-toggles{ display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px; }
.pf-check{ width:18px; height:18px; }

.pf-inspector-group{
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--pf-border);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(15,23,42,0.55);
}

.pf-button-grid{ display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:8px; }

.pf-account-card{
  border:1px solid var(--pf-border);
  border-radius:14px;
  padding:12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  background:#fff;
  font-size:12px;
  color: var(--pf-muted);
}
.pf-account-card strong{ display:block; font-size:14px; color: var(--pf-text); }
.pf-badge{
  border-radius:999px;
  padding:4px 10px;
  background: rgba(37,99,235,0.1);
  color: var(--pf-primary);
  font-weight:700;
  font-size:12px;
}

.pf-right-summary{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  padding:4px 0 16px;
}
.pf-right-summary__title{ margin:6px 0 4px; font-size:18px; font-weight:700; }
.pf-right-summary__meta{ font-size:12px; color: var(--pf-muted); }

.pf-color-board,
.pf-tools-board{
  border:1px solid var(--pf-border);
  border-radius:24px;
  padding:16px;
  background: rgba(248,250,255,0.92);
  margin-bottom:18px;
  box-shadow:0 18px 40px rgba(15,23,42,0.08);
}
.pf-color-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:12px;
  margin-top:12px;
}
.pf-color-swatch{
  width:100%;
  aspect-ratio:1;
  border-radius:18px;
  border:1px solid var(--pf-border);
  background: var(--pf-swatch, #fff);
  position:relative;
  cursor:pointer;
}
.pf-color-swatch::after{
  content: attr(aria-label);
  position:absolute;
  left:10px;
  bottom:10px;
  font-size:11px;
  font-weight:600;
  color: rgba(15,23,42,0.65);
}
.pf-color-swatch--add{
  font-size:20px;
  color: var(--pf-muted);
  display:flex;
  align-items:center;
  justify-content:center;
  aspect-ratio:auto;
  height:64px;
  background: rgba(15,23,42,0.04);
}

.pf-tool-stack{ display:flex; flex-direction:column; gap:12px; }
.pf-tool-card{
  border-radius:18px;
  border:1px solid var(--pf-border);
  background:#fff;
  padding:14px 16px;
  display:flex;
  position: sticky;
  top: 0;
  background: var(--pf-panel);
  z-index: 2;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  cursor:pointer;
}
.pf-tool-card__body{ display:flex; flex-direction:column; align-items:flex-start; gap:4px; }
.pf-tool-card__body strong{ font-size:14px; }
.pf-tool-card__body span{ font-size:12px; color: var(--pf-muted); }
.pf-tool-card__icon{ font-size:18px; color: var(--pf-muted); }

.pf-props{ display:flex; flex-direction:column; gap:12px; }

.pf-accordion{
  border: 1px solid var(--pf-border);
  border-radius: 16px;
  background: rgba(255,255,255,0.96);
  padding: 0;
  overflow: hidden;
  transition: border-color 140ms ease, box-shadow 160ms ease, background 160ms ease;
}
.pf-accordion[open]{
  border-color: rgba(15,23,42,0.14);
  box-shadow: 0 10px 22px rgba(15,23,42,0.08);
}
.pf-accordion summary{
  cursor:pointer;
  list-style:none;
  position: relative;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 650;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  padding: 12px 12px;
  color: rgba(15,23,42,0.88);
}
.pf-accordion summary::-webkit-details-marker{ display:none; }
.pf-accordion summary::after{
  content:"";
  width: 10px;
  height: 10px;
  margin-left: auto;
  border-right: 2px solid rgba(15,23,42,0.55);
  border-bottom: 2px solid rgba(15,23,42,0.55);
  transform: rotate(45deg);
  transition: transform 180ms ease, border-color 180ms ease;
}
.pf-accordion[open] summary::after{
  transform: rotate(-135deg);
  border-color: rgba(15,23,42,0.65);
}
.pf-accordion summary:hover{ background: rgba(15,23,42,0.03); }
.pf-accordion__body{ padding: 2px 12px 12px; display:flex; flex-direction:column; gap:12px; }

.pf-field{ display:flex; flex-direction:column; gap:6px; font-size:13px; }
.pf-field__label{ font-size:11px; font-weight:650; letter-spacing:0.02em; color: rgba(15,23,42,0.55); }
.pf-input,
.pf-select,
.pf-textarea{
  border-radius:12px;
  border:1px solid rgba(15,23,42,0.10);
  padding:9px 10px;
  background: rgba(248,250,252,0.95);
  color: var(--pf-text);
}
.pf-input:focus,
.pf-select:focus,
.pf-textarea:focus{ border-color: rgba(37,99,235,0.4); outline:none; box-shadow:0 0 0 2px rgba(37,99,235,0.15); }
.pf-input--color{ padding:6px; height:44px; }

.pf-right .pf-icon,
.pf-right .pf-chip{
  background: rgba(248,250,252,0.95);
  border: 1px solid rgba(15,23,42,0.10);
  color: rgba(15,23,42,0.88);
  transition: background 140ms ease, border-color 140ms ease, transform 80ms ease;
}
.pf-right .pf-icon svg,
.pf-right .pf-chip svg{
  stroke: #111827;
}
.pf-right .pf-icon:hover,
.pf-right .pf-chip:hover{
  background: rgba(15,23,42,0.04);
  border-color: rgba(15,23,42,0.14);
}
.pf-right .pf-icon:active,
.pf-right .pf-chip:active{
  transform: translateY(1px);
}
.pf-right .pf-btn{
  border-radius: 12px;
  height: 36px;
  font-weight: 650;
}

.pf-grid2{ display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px; }
.pf-row{ display:flex; gap:8px; flex-wrap:wrap; }

/* Layers */
.pf-layers{ display:flex; flex-direction:column; gap:8px; }
.pf-layer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--pf-border);
  background:#fff;
  cursor:pointer;
  transition:border 120ms ease, box-shadow 120ms ease;
}
.pf-layer:hover{ border-color: rgba(37,99,235,0.4); }
.pf-layer.is-selected{ border-color: rgba(37,99,235,0.5); box-shadow:0 0 0 2px rgba(37,99,235,0.15); }
.pf-layer__name{ font-weight:600; font-size:13px; }
.pf-layer__meta{ font-size:12px; color: var(--pf-muted); }

/* =========================
   Left Panel (Final)
   - Keeps left rail + icons consistent and professional
   - High-specificity to override legacy duplicates above
   ========================= */

body.editor-page .pf-icon-sprite{
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

body.editor-page .pf-sr-only,
body.editor-page .pf-rail-label{
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

body.editor-page{
  --pf-rail-col: var(--pf-rail-w);
  --pf-rail-icon: 24px;
  --pf-rail-btn-h: 52px;
}

/* Lucide Icons Base Styles */
.lucide-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
}

body.editor-page .pf-i,
body.editor-page .lucide-icon{
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

body.editor-page .pf-left{
  position: fixed;
  top: var(--pf-topbar-h);
  left: 0;
  display: grid;
  grid-template-columns: var(--pf-rail-col) minmax(0, 1fr);
  width: var(--pf-left-w);
  min-width: var(--pf-rail-col);
  height: calc(100vh - var(--pf-topbar-h));
  z-index: 45;
  pointer-events: auto;
  background: var(--pf-panel);
  border-right: 1px solid var(--pf-border);
  box-shadow: 6px 0 14px rgba(0,0,0,0.10);
  transition: grid-template-columns 220ms ease, width 220ms ease;
}

body.editor-page .pf-left.is-collapsed{
  width: var(--pf-rail-col);
  min-width: var(--pf-rail-col);
  grid-template-columns: var(--pf-rail-col) 0px;
  background: var(--pf-panel);
  border-right: 1px solid var(--pf-border);
  box-shadow: 6px 0 14px rgba(0,0,0,0.10);
}

/* Left panel must not affect canvas/layout sizing */
body.editor-page .pf-layout{
  grid-template-columns: minmax(0, 1fr) !important;
}

body.editor-page .pf-center{
  width: 100%;
}

body.editor-page .pf-left__rail{
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 14px 10px;
  gap: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,1), rgba(255,255,255,0.96));
}

body.editor-page .pf-rail-group{
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--pf-border);
}
body.editor-page .pf-rail-group--top{ padding-bottom: 14px; }
body.editor-page .pf-rail-group--bottom{
  padding-top: 14px;
  border-top: 1px solid var(--pf-border);
  border-bottom: none;
}

body.editor-page .pf-rail-btn{
  position: relative;
  height: var(--pf-rail-btn-h);
  border-radius: 14px;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(15,23,42,0.74);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 8px 4px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

body.editor-page .pf-rail-btn{
  border-radius: 14px;
  padding: 8px 4px;
}

body.editor-page .pf-rail-btn .pf-i,
body.editor-page .pf-rail-btn .lucide-icon{ width: var(--pf-rail-icon); height: var(--pf-rail-icon); }

body.editor-page .pf-rail-btn:hover{
  background: rgba(15,23,42,0.045);
  border-color: rgba(15,23,42,0.10);
  color: rgba(15,23,42,0.86);
}

body.editor-page .pf-rail-btn:active{
  background: rgba(15,23,42,0.06);
}

body.editor-page .pf-rail-btn:focus-visible{
  outline: 3px solid rgba(37,99,235,0.35);
  outline-offset: 2px;
}

body.editor-page .pf-rail-btn.is-active{
  background: rgba(37,99,235,0.10);
  border-color: rgba(37,99,235,0.28);
  color: #1d4ed8;
  box-shadow: 0 10px 26px rgba(37,99,235,0.14);
}

body.editor-page .pf-rail-btn--add{
  background: rgba(37,99,235,0.06);
  border-color: rgba(37,99,235,0.18);
  color: rgba(15,23,42,0.82);
}
body.editor-page .pf-rail-btn--add:hover{
  background: rgba(37,99,235,0.10);
  border-color: rgba(37,99,235,0.26);
  color: #1d4ed8;
}

body.editor-page .pf-panel-toggle{
  position: fixed;
  top: calc(var(--pf-topbar-h) + ((100vh - var(--pf-topbar-h)) / 2));
  transform: translateY(-50%);
  z-index: 1000;
  width: 26px;
  height: 52px;
  background: var(--pf-panel);
  border: 0;
  box-shadow: none;
  opacity: 1;
  pointer-events: auto !important;
  transition: left 220ms ease, right 220ms ease, transform 220ms ease, background 160ms ease;
}
body.editor-page .pf-panel-toggle svg{
  width: 16px;
  height: 16px;
  stroke: var(--pf-text);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 200ms ease;
}

body.editor-page .pf-panel-toggle:hover{
  box-shadow: none;
}

/* “Ear” attachment: slightly overhang outside, no gap, soft rectangle */
body.editor-page .pf-panel-toggle--left{
  /* sit outside the panel edge so it never overlaps rail buttons */
  left: calc(var(--pf-left-w) - 1px);
  right: auto;
  border-radius: 0 18px 18px 0;
}
body.editor-page .pf-panel-toggle--right{
  right: 0px;
  left: auto;
  border-radius: 18px 0 0 18px;
}

/* When left panel is collapsed, ear sticks to the rail edge */
body.editor-page .pf-left.is-collapsed .pf-panel-toggle--left{
  left: calc(var(--pf-rail-w) - 1px);
}

/* Right panel: when collapsed, hide the rail too (only the ear stays) */
body.editor-page .pf-right.is-collapsed{
  width: 0;
}
body.editor-page .pf-right.is-collapsed .pf-right-rail{
  opacity: 0;
  pointer-events: none;
}
body.editor-page .pf-right.is-collapsed .pf-panel-toggle--right{
  right: 0px;
}

/* When right panel is open, ear moves to the shell edge (panel + rail) */
body.editor-page .pf-right:not(.is-collapsed) .pf-panel-toggle--right{
  /* attach to the panel edge (no overlap with right-side controls) */
  right: calc(var(--pf-right-panel-w) - 1px);
}

/* Right panel shell should not offset for a rail (avatar removed) */
body.editor-page .pf-right-shell{
  right: 0;
  box-shadow: -6px 0 14px rgba(0,0,0,0.10);
}

/* Extra polish: subtle motion when panels change state */
body.editor-page .pf-left.is-collapsed .pf-panel-toggle--left{ --pf-toggle-shift-x: 8px; }
body.editor-page .pf-right.is-collapsed .pf-panel-toggle--right{ --pf-toggle-shift-x: -8px; }

/* Keep chevrons pointing the right way (high specificity so it wins) */
body.editor-page .pf-left:not(.is-collapsed) .pf-panel-toggle--left svg{ transform: rotate(180deg); }
body.editor-page .pf-left.is-collapsed .pf-panel-toggle--left svg{ transform: rotate(0deg); }
body.editor-page .pf-right:not(.is-collapsed) .pf-panel-toggle--right svg{ transform: rotate(180deg); }
body.editor-page .pf-right.is-collapsed .pf-panel-toggle--right svg{ transform: rotate(0deg); }

/* Right toggle is the single control: keep it visible even when collapsed */
body.editor-page .pf-right.is-collapsed .pf-panel-toggle--right{
  opacity: 1;
  pointer-events: auto;
}

body.editor-page .pf-left__panel{
  background: rgba(255,255,255,0.96);
  min-width: 0;
  transition: opacity 200ms ease, transform 220ms ease;
  font-size: 13px;
  line-height: 1.35;
}

body.editor-page .pf-left.is-collapsed .pf-left__panel{
  opacity: 0;
  transform: translateX(-16px);
  pointer-events: none;
}

body.editor-page .pf-panel-header{
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
}

/* Left panel typography & spacing consistency */
body.editor-page .pf-left__panel .pf-left-body{
  padding: 0 16px 14px;
  gap: 16px;
}
body.editor-page .pf-left__panel .pf-panel-title{
  line-height: 1.15;
}
body.editor-page .pf-left__panel p{ margin:0; }
body.editor-page .pf-left__panel .pf-panel-subtitle,
body.editor-page .pf-left__panel .pf-hint{
  margin: 0;
  line-height: 1.35;
}
body.editor-page .pf-left__panel .pf-panel-section{ gap: 10px; }
body.editor-page .pf-left__panel .pf-panel-section h4{
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
  color: rgba(15,23,42,0.72);
}
body.editor-page .pf-left__panel .pf-action-list{ gap: 8px; }
body.editor-page .pf-left__panel .pf-action-item{
  line-height: 1.2;
  padding: 10px 12px;
}
body.editor-page .pf-left__panel .pf-toggle-list{ gap: 8px; }
body.editor-page .pf-left__panel .pf-toggle{ line-height: 1; padding: 7px 12px; }
body.editor-page .pf-left__panel .pf-field{ gap: 6px; }
body.editor-page .pf-left__panel .pf-field__label{
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: none;
  color: rgba(15,23,42,0.55);
}

/* Left panel internal elements (cards, lists, toggles, grids) */
body.editor-page .pf-left__panel .pf-panel-section{
  padding: 12px;
  border: 1px solid rgba(15,23,42,0.10);
  border-radius: 16px;
  background: rgba(255,255,255,0.94);
}
body.editor-page .pf-left__panel .pf-control-row{
  align-items: center;
  gap: 8px;
}

body.editor-page .pf-left__panel .pf-action-item{
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  border-color: rgba(15,23,42,0.10);
  background: rgba(248,250,252,0.96);
}
body.editor-page .pf-left__panel .pf-action-item:hover{
  border-color: rgba(15,23,42,0.14);
  background: rgba(15,23,42,0.035);
}

body.editor-page .pf-left__panel .pf-toggle-list{ gap: 8px; }
body.editor-page .pf-left__panel .pf-toggle{
  width: 100%;
  min-height: 42px;
  border-radius: 14px;
  border-color: rgba(15,23,42,0.10);
  background: rgba(248,250,252,0.96);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-weight: 650;
  color: rgba(15,23,42,0.88);
}
body.editor-page .pf-left__panel .pf-toggle::after{
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,0.18);
  background: rgba(255,255,255,0.85);
}
body.editor-page .pf-left__panel .pf-toggle[aria-pressed="true"]{
  background: rgba(37,99,235,0.10);
  border-color: rgba(37,99,235,0.28);
  color: #1d4ed8;
}
body.editor-page .pf-left__panel .pf-toggle[aria-pressed="true"]::after{
  background: #2563eb;
  border-color: rgba(37,99,235,0.45);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.14);
}

body.editor-page .pf-left__panel .pf-templates-min{
  grid-template-columns: 1fr;
  gap: 14px;
  padding-top: 6px;
}
body.editor-page .pf-left__panel .pf-template-mini{
  border-radius: 16px;
  box-shadow: 0 10px 22px rgba(15,23,42,0.10);
}
body.editor-page .pf-left__panel .pf-template-mini:hover{
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(15,23,42,0.14);
}
body.editor-page .pf-left__panel .pf-template-mini::before{
  content: attr(data-template-name);
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(8px);
  color: rgba(15,23,42,0.82);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

body.editor-page .pf-left__panel .pf-upload-card{
  border-style: solid;
  border-color: rgba(15,23,42,0.10);
  border-radius: 16px;
  background: rgba(248,250,252,0.96);
}

body.editor-page .pf-left__panel .pf-layers__header{ align-items: center; margin-bottom: 10px; }
body.editor-page .pf-left__panel .pf-layers__header h4{ margin: 0; }

body.editor-page .pf-action-item{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
body.editor-page .pf-action-item__icon{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--pf-border);
  background: rgba(255,255,255,0.92);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(15,23,42,0.74);
}
body.editor-page .pf-action-item:hover .pf-action-item__icon{
  border-color: rgba(37,99,235,0.28);
  color: #1d4ed8;
}

/* Templates panel styles */
.pf-templates-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  padding-right: 4px;
}

.pf-template-card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--pf-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.pf-template-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}

.pf-template-thumb {
  position: relative;
  padding: 10px;
  background: #ffffff;
  aspect-ratio: 297/210; /* A4 landscape */
  border-radius: 8px;
  margin: 8px;
  overflow: hidden;
}

.pf-template-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
  z-index: 0;
}

.pf-template-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(400px 200px at 20% 0%, rgba(15, 23, 42, 0.08), rgba(255, 255, 255, 0));
  pointer-events: none;
  z-index: 1;
}

.pf-template-watermark {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
  color: rgba(15, 23, 42, 0.15);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

/* Template color accents */
.pf-template-thumb.tpl-thumb-1::after { background: radial-gradient(400px 200px at 20% 0%, rgba(37,99,235,0.24), rgba(255,255,255,0)); }
.pf-template-thumb.tpl-thumb-2::after { background: radial-gradient(400px 200px at 20% 0%, rgba(249,115,22,0.22), rgba(255,255,255,0)); }
.pf-template-thumb.tpl-thumb-3::after { background: radial-gradient(400px 200px at 20% 0%, rgba(234,179,8,0.24), rgba(255,255,255,0)); }
.pf-template-thumb.tpl-thumb-4::after { background: radial-gradient(400px 200px at 20% 0%, rgba(14,165,233,0.24), rgba(255,255,255,0)); }
.pf-template-thumb.tpl-thumb-5::after { background: radial-gradient(400px 200px at 20% 0%, rgba(236,72,153,0.22), rgba(255,255,255,0)); }
.pf-template-thumb.tpl-thumb-6::after { background: radial-gradient(400px 200px at 20% 0%, rgba(148,163,184,0.26), rgba(255,255,255,0)); }
.pf-template-thumb.tpl-thumb-7::after { background: radial-gradient(400px 200px at 20% 0%, rgba(34,197,94,0.22), rgba(255,255,255,0)); }
.pf-template-thumb.tpl-thumb-8::after { background: radial-gradient(400px 200px at 20% 0%, rgba(139,92,246,0.24), rgba(255,255,255,0)); }
.pf-template-thumb.tpl-thumb-9::after { background: radial-gradient(400px 200px at 20% 0%, rgba(239,68,68,0.22), rgba(255,255,255,0)); }
.pf-template-thumb.tpl-thumb-10::after { background: radial-gradient(400px 200px at 20% 0%, rgba(59,130,246,0.24), rgba(255,255,255,0)); }

.pf-template-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pf-template-title {
  font-size: 13px;
  margin: 0;
  color: var(--pf-text);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.pf-template-actions {
  margin-top: 4px;
}

.pf-template-actions .pf-action-item {
  width: 100%;
  justify-content: center;
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 8px;
}

/* Scrollbar styling for templates list */
.pf-templates-list::-webkit-scrollbar {
  width: 6px;
}

.pf-templates-list::-webkit-scrollbar-track {
  background: transparent;
}

.pf-templates-list::-webkit-scrollbar-thumb {
  background: var(--pf-border);
  border-radius: 3px;
}

.pf-templates-list::-webkit-scrollbar-thumb:hover {
  background: var(--pf-border-strong);
}

/* Accessibility */
.pf-sr{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  border:0;
}

@media (max-width: 1200px){
  :root{ --pf-left-w: 300px; --pf-right-w: 320px; }
  .pf-topbar{ grid-template-columns: minmax(200px,1fr) minmax(220px,2fr) minmax(200px, 1fr); padding:10px 18px; }
}

@media (max-width: 1024px){
  .pf-layout{ grid-template-columns: minmax(0,1fr); }
  .pf-topbar{ grid-template-columns: 1fr; grid-auto-rows: auto; height:auto; }
  .pf-topbar__brand{ order:1; }
  .pf-topbar__main{ order:3; flex-wrap:wrap; }
  .pf-topbar__cta{ order:2; justify-content:flex-end; }
}

@media (max-width: 720px){
  .pf-left{ display:none; }
  .pf-topbar{ padding:12px; }
  .pf-title__input{ width: 100%; }
  .pf-ai-bar{ flex-direction:column; align-items:stretch; }
  .pf-ai-status{ width:100%; justify-content:space-between; }
}

@media (prefers-reduced-motion: reduce){
  *{ transition:none !important; scroll-behavior:auto !important; }
}
