/* Calken v126: Page editor (Owner Mode). Uses the site's own colour tokens. */
html:not(.pe-on) [data-pe-hidden], html.pe-preview [data-pe-hidden] { display: none !important; }
html.pe-on:not(.pe-preview) [data-pe-hidden] { opacity: .32 !important; outline: 2px dashed color-mix(in srgb, var(--ink, #fff) 45%, transparent); outline-offset: 2px; }
.pe-added-img { display: block; width: 100%; height: auto; border-radius: 18px; margin: 18px 0; }
.pe-added-text { margin: 14px 0; }
.pe-added-btn { margin: 14px 0; }

/* page parts while editing */
html.pe-on:not(.pe-preview) body { padding-top: 58px; }
html.pe-on:not(.pe-preview) #app *, html.pe-on:not(.pe-preview) footer.site * { cursor: default; }
html.pe-on:not(.pe-preview) #app :is(h1,h2,h3,h4,h5,h6,p,li,a,button,span,b,strong,em,small,label,figcaption,blockquote,dd,dt,td,th), html.pe-on:not(.pe-preview) footer.site :is(h1,h2,h3,h4,p,li,a,span,b,small) { cursor: text; }
html.pe-on:not(.pe-preview) #app img, html.pe-on:not(.pe-preview) footer.site img { cursor: pointer; }
.pe-editing { outline: 2px solid var(--ink, #fff) !important; outline-offset: 4px; border-radius: 4px; cursor: text !important; caret-color: currentColor; -webkit-user-select: text; user-select: text; }
.pe-editing:focus { outline-style: solid; }
html.pe-on #ck-ownerbar.pe-hide-ob { display: none !important; }
#ck-ownerbar .pe-open { position: relative; }
#ck-ownerbar .pe-dot, .pe-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #f0a04b; margin-left: 6px; vertical-align: middle; }
html.pe-preview .pe-ui:not(#pe-back):not(#pe-toast):not(.pe-modal) { display: none !important; }

/* shared controls */
.pe-ui { font-family: inherit; color: var(--ink, #eef1f5); font-size: 13.5px; line-height: 1.4; box-sizing: border-box; }
.pe-ui *, .pe-ui *::before, .pe-ui *::after { box-sizing: border-box; }
.pe-ui svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.pe-b, .pe-ib { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line, rgba(198,205,214,.16)); background: transparent; color: var(--ink, #eef1f5); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.pe-ib { width: 38px; padding: 0; }
.pe-b:hover:not(:disabled), .pe-ib:hover:not(:disabled) { background: color-mix(in srgb, var(--ink, #fff) 8%, transparent); }
.pe-b:focus-visible, .pe-ib:focus-visible, .pe-seg button:focus-visible { outline: 2px solid var(--ink, #fff); outline-offset: 2px; }
.pe-b:disabled, .pe-ib:disabled { opacity: .4; cursor: default; }
.pe-b.sm { min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.pe-b.wide { width: 100%; }
.pe-b.ghost { border-style: dashed; color: var(--dim, #99a1ab); }
.pe-b.danger { border-color: color-mix(in srgb, #e5484d 60%, transparent); color: #ff8b8e; }
.pe-pri, .pe-b.pe-pri { background: var(--ink, #eef1f5); color: var(--bg, #0b0c0e); border-color: var(--ink, #eef1f5); font-weight: 600; }
.pe-pri:hover:not(:disabled) { background: color-mix(in srgb, var(--ink, #fff) 86%, var(--bg, #000)) !important; }
.pe-ui input[type=text], .pe-ui textarea { width: 100%; min-height: 42px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line, rgba(198,205,214,.16)); background: color-mix(in srgb, var(--ink, #fff) 4%, transparent); color: var(--ink, #eef1f5); font: inherit; font-size: 16px; }
.pe-ui textarea { resize: vertical; min-height: 84px; }
.pe-lab { display: block; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--dim, #99a1ab); margin: 0 0 6px; font-weight: 600; }
.pe-hint { display: block; color: var(--dim, #99a1ab); font-size: 12px; margin: 6px 0 2px; }
.pe-p { margin: 0 0 12px; color: var(--dim, #99a1ab); }
.pe-acts { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.pe-inline { display: flex; gap: 8px; align-items: center; }
.pe-inline input { flex: 1; min-width: 0; }
.pe-grid2, .pe-grid3, .pe-grid4 { display: grid; gap: 8px; margin-top: 8px; }
.pe-grid2 { grid-template-columns: 1fr 1fr; }
.pe-grid3 { grid-template-columns: 1fr 1fr 1fr; }
.pe-grid4 { grid-template-columns: repeat(4, 1fr); }
.pe-grid3 .pe-b, .pe-grid4 .pe-b, .pe-grid2 .pe-b { padding: 0 8px; }
.pe-row { margin-top: 12px; }
.pe-seg { display: flex; border: 1px solid var(--line, rgba(198,205,214,.16)); border-radius: 12px; overflow: hidden; }
.pe-seg.pe-wrap { flex-wrap: wrap; border-radius: 12px; }
.pe-seg button { flex: 1 1 auto; min-height: 36px; padding: 0 8px; border: 0; border-left: 1px solid var(--line, rgba(198,205,214,.16)); background: transparent; color: var(--ink, #eef1f5); font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.pe-seg button:first-child { border-left: 0; }
.pe-seg button.on { background: var(--ink, #eef1f5); color: var(--bg, #0b0c0e); font-weight: 600; }

/* top bar */
#pe-bar { position: fixed; z-index: 9600; top: 0; left: 0; right: 0; min-height: 58px; padding: 9px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: color-mix(in srgb, var(--ck-solid, #131519) 96%, transparent); border-bottom: 1px solid var(--line, rgba(198,205,214,.16)); box-shadow: 0 8px 26px rgba(0,0,0,.28); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.pe-bar-l { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex-wrap: wrap; }
.pe-bar-l b { font-size: 14px; }
.pe-path { max-width: 26vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim, #99a1ab); }
.pe-status { color: var(--dim, #99a1ab); font-size: 12.5px; }
.pe-status::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #46a758; margin-right: 6px; vertical-align: 1px; }
.pe-status.warn { color: #f0a04b; }
.pe-status.warn::before { background: #f0a04b; }
.pe-bar-r { display: flex; align-items: center; gap: 6px; flex: none; }
.pe-menu-w { position: relative; }
.pe-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; padding: 6px; border-radius: 16px; background: var(--ck-solid, #131519); border: 1px solid var(--line, rgba(198,205,214,.16)); box-shadow: 0 16px 40px rgba(0,0,0,.4); display: flex; flex-direction: column; }
.pe-menu[hidden] { display: none; }
.pe-menu button { text-align: left; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink, #eef1f5); font: inherit; cursor: pointer; }
.pe-menu button:hover { background: color-mix(in srgb, var(--ink, #fff) 8%, transparent); }

/* outlines */
#pe-hover, #pe-box { position: fixed; z-index: 9550; left: 0; top: 0; pointer-events: none; display: none; border-radius: 8px; }
#pe-hover { border: 1.5px dashed color-mix(in srgb, var(--ink, #fff) 70%, transparent); }
#pe-box { border: 2px solid var(--ink, #fff); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bg, #000) 55%, transparent); }
#pe-hover span, #pe-box span { position: absolute; left: -2px; top: -24px; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--ink, #fff); color: var(--bg, #000); }
#pe-hover span { background: color-mix(in srgb, var(--ink, #fff) 80%, transparent); }
#pe-hover.pe-low span, #pe-box.pe-low span { top: auto; bottom: -24px; }

/* text toolbar */
#pe-tt { position: fixed; z-index: 9620; left: 0; top: 0; display: none; align-items: center; gap: 4px; padding: 5px; border-radius: 14px; background: var(--ck-solid, #131519); border: 1px solid var(--line, rgba(198,205,214,.16)); box-shadow: 0 12px 30px rgba(0,0,0,.35); }
#pe-tt.on { display: flex; }
#pe-tt button { min-height: 34px; min-width: 34px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--ink, #eef1f5); font: inherit; font-size: 13px; cursor: pointer; }
#pe-tt button:hover { background: color-mix(in srgb, var(--ink, #fff) 9%, transparent); }
#pe-tt .pe-tt-done { background: var(--ink, #eef1f5); color: var(--bg, #0b0c0e); font-weight: 600; }
#pe-tt .pe-tt-sep { width: 1px; align-self: stretch; margin: 4px 2px; background: var(--line, rgba(198,205,214,.16)); }
#pe-tt.pe-tt-fixed { top: 64px; left: 8px; right: 8px; transform: none !important; flex-wrap: wrap; justify-content: center; }

/* inspector */
#pe-panel { position: fixed; z-index: 9580; top: 70px; right: 14px; width: 340px; max-height: calc(100vh - 86px); overflow: auto; display: none; border-radius: 20px; background: color-mix(in srgb, var(--ck-solid, #131519) 97%, transparent); border: 1px solid var(--line, rgba(198,205,214,.16)); box-shadow: 0 18px 44px rgba(0,0,0,.4); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); overscroll-behavior: contain; }
#pe-panel.on { display: block; }
.pe-ph { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 10px 16px; background: inherit; border-bottom: 1px solid var(--line, rgba(198,205,214,.16)); border-radius: 20px 20px 0 0; }
.pe-ph b { font-size: 14.5px; }
.pe-ph small { display: block; color: var(--dim, #99a1ab); font-size: 11.5px; }
.pe-ph-r { display: flex; gap: 6px; align-items: center; }
.pe-pb { padding: 6px 16px 16px; }
.pe-sec { padding: 12px 0; border-bottom: 1px solid var(--line, rgba(198,205,214,.16)); }
.pe-sec:last-child { border-bottom: 0; }
.pe-sec .pe-b.wide + .pe-b.wide { margin-top: 8px; }
.pe-note { color: var(--dim, #99a1ab); font-size: 12.5px; }
.pe-foot:empty { display: none; }
.pe-thumb { position: relative; border-radius: 12px; overflow: hidden; cursor: crosshair; background: rgba(0,0,0,.25); max-height: 200px; display: flex; justify-content: center; }
.pe-thumb img { display: block; max-width: 100%; max-height: 200px; object-fit: contain; pointer-events: none; }
.pe-thumb i { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.5); pointer-events: none; }
.pe-sec .pe-lab + .pe-inline, .pe-sec .pe-inline + .pe-b { margin-top: 0; }
.pe-sec label.pe-lab:not(:first-child) { margin-top: 12px; }

/* modals */
.pe-modal { position: fixed; inset: 0; z-index: 9700; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.55); }
.pe-mc { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; border-radius: 22px; background: var(--ck-solid, #131519); border: 1px solid var(--line, rgba(198,205,214,.16)); box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.pe-mc.wide { width: min(860px, 100%); }
.pe-mh { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 12px 20px; background: inherit; border-bottom: 1px solid var(--line, rgba(198,205,214,.16)); }
.pe-mh b { font-size: 15.5px; }
.pe-mb { padding: 16px 20px 20px; }
.pe-list { margin: 0 0 4px; padding-left: 18px; color: var(--dim, #99a1ab); }
.pe-list li { margin-bottom: 8px; }
.pe-list b { color: var(--ink, #eef1f5); }
.pe-vers { list-style: none; margin: 0; padding: 0; }
.pe-vers li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line, rgba(198,205,214,.16)); }
.pe-vers small { display: block; color: var(--dim, #99a1ab); font-size: 12px; }
.pe-choose { display: grid; gap: 10px; }
.pe-file { cursor: pointer; }
.pe-lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.pe-lib button { padding: 0; border: 1px solid var(--line, rgba(198,205,214,.16)); border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: rgba(0,0,0,.2); cursor: pointer; }
.pe-lib button:hover { outline: 2px solid var(--ink, #fff); }
.pe-lib img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pe-crop { display: grid; grid-template-columns: 1fr 280px; gap: 18px; align-items: start; }
.pe-stage { position: relative; min-height: 240px; border-radius: 14px; background: #08090a; overflow: hidden; }
.pe-stage canvas { display: block; touch-action: none; }
.pe-stage .pe-cmsg { position: absolute; left: 16px; right: 16px; top: 16px; color: #ccd; }
.pe-stage .pe-cmsg:empty { display: none; }
.pe-ctl .pe-row:first-child { margin-top: 0; }
.pe-sl { display: grid; grid-template-columns: 84px 1fr 34px; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--dim, #99a1ab); }
.pe-sl input { width: 100%; accent-color: var(--ink, #fff); }
.pe-sl output { text-align: right; font-variant-numeric: tabular-nums; }

#pe-back { position: fixed; z-index: 9700; top: 14px; left: 50%; transform: translateX(-50%); display: none; min-height: 42px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--ink, #eef1f5); color: var(--bg, #0b0c0e); font: inherit; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.35); cursor: pointer; }
html.pe-preview #pe-back { display: block; }
#pe-toast { position: fixed; z-index: 9800; left: 50%; bottom: 110px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 10px 16px; border-radius: 12px; background: var(--ck-solid, #131519); border: 1px solid var(--line, rgba(198,205,214,.16)); transition: .2s; }
#pe-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* keep clear of the side dock on laptops */
@media (min-width: 1100px) { #pe-bar { padding-left: 110px; } }

/* tablets and phones */
@media (max-width: 860px) {
  .pe-crop { grid-template-columns: 1fr; }
  .pe-path { display: none; }
}
@media (max-width: 700px) {
  #pe-bar { padding: 8px 10px 6px; min-height: 84px; flex-wrap: wrap; row-gap: 4px; }
  .pe-bar-l { order: 2; width: 100%; gap: 8px; flex-wrap: nowrap; align-items: baseline; }
  .pe-bar-l b { font-size: 12.5px; }
  .pe-status { font-size: 11.5px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pe-bar-r { width: 100%; justify-content: flex-end; }
  html.pe-on:not(.pe-preview) body { padding-top: 88px; }
  #pe-tt.pe-tt-fixed { top: 92px; gap: 2px; padding: 4px; }
  #pe-tt button { padding: 0 8px; font-size: 12.5px; }
  #pe-tt .pe-tt-sep { margin: 4px 1px; }
  .pe-bar-r { gap: 4px; }
  .pe-bar-r .pe-b { padding: 0 11px; }
  .pe-bar-r .pe-b[data-pe=preview] span, .pe-bar-r .pe-b[data-pe=menu] span { display: none; }
  .pe-bar-r .pe-b[data-pe=preview], .pe-bar-r .pe-b[data-pe=menu] { width: 38px; padding: 0; }
  .pe-ib { width: 36px; min-height: 36px; }
  #pe-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 56vh; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  #pe-panel.pe-typing { display: none; }
  html.pe-on:not(.pe-preview) body { padding-bottom: 50vh; }
  .pe-mc { max-height: calc(100vh - 24px); }
  .pe-modal { padding: 12px; align-items: flex-end; }
  .pe-mb { padding: 14px 16px 18px; }
  .pe-grid4 { grid-template-columns: 1fr 1fr; }
  #pe-toast { bottom: calc(var(--ckd-h, 70px) + 24px); }
}
.pe-check { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--ink, #eef1f5); cursor: pointer; }
.pe-check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--ink, #fff); flex: none; }
html.pe-on:not(.pe-preview) .td-track[data-pe-freeze] { transform: var(--pe-tx, none) !important; }
