/* Inkwell editor UI — neutral, white-label-friendly. Override --ink-accent to brand it. */
:root {
  --ink-accent: #2f6df6;
  --ink-accent-strong: #1f57e0;   /* deeper accent for gradients / pressed states */
  --ink-accent-ink: #ffffff;
  --ink-ink: #0f1729;             /* near-black navy for chrome + text */
  --ink-panel: #ffffff;
  --ink-line: #e6e9f2;            /* hairline borders on light surfaces */
  --ink-muted: #5b6479;           /* secondary text */
  --ink-ring: rgba(47, 109, 246, 0.40);
  --ink-radius: 12px;             /* shared corner radius for panels/inputs */
  /* Layered, soft shadows (close + ambient) read more premium than one big blur. */
  --ink-shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06), 0 6px 16px rgba(16, 24, 40, 0.10);
  --ink-shadow-2: 0 2px 6px rgba(16, 24, 40, 0.10), 0 24px 60px rgba(16, 24, 40, 0.28);
}

.ink-launch {
  position: fixed; right: 18px; bottom: 18px; z-index: 2147483000;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, var(--ink-accent), var(--ink-accent-strong));
  color: var(--ink-accent-ink);
  font: 600 15px/1 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  box-shadow: 0 1px 1px rgba(255, 255, 255, 0.18) inset, 0 8px 22px rgba(16, 24, 40, 0.28);
  transition: transform .15s cubic-bezier(.2,.7,.3,1), box-shadow .15s ease, filter .15s ease;
}
.ink-launch:hover { transform: translateY(-2px); box-shadow: 0 1px 1px rgba(255, 255, 255, 0.18) inset, 0 14px 32px rgba(16, 24, 40, 0.34); }
.ink-launch:active { transform: translateY(0); filter: brightness(.97); }
.ink-launch:focus-visible { outline: 3px solid var(--ink-ring); outline-offset: 2px; }
.ink-launch__icon { font-size: 16px; }

.ink-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2147483000;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 18px; color: #fff;
  /* Frosted glass over a deep navy reads more modern than a flat bar; the solid
     color is a fallback for browsers without backdrop-filter. */
  background: var(--ink-ink);
  background: color-mix(in srgb, var(--ink-ink) 88%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  box-shadow: 0 -10px 30px rgba(16, 24, 40, 0.30);
  transform: translateY(110%); transition: transform .28s cubic-bezier(.2,.7,.3,1);
}
/* Fully off-screen (and non-interactive) until editing, regardless of height. */
.ink-bar:not(.is-on) { pointer-events: none; }
.ink-bar.is-on { transform: translateY(0); }
/* While lifted above the on-screen keyboard, track it quickly instead of gliding. */
.ink-bar--lifted { transition: transform .12s ease; }
.ink-bar__msg { flex: 1 1 320px; min-width: 240px; opacity: .92; }
.ink-bar__msg strong { color: #fff; }
.ink-bar__actions { display: flex; gap: 10px; flex: 0 0 auto; }
.ink-bar__anim { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; font-size: 13px; opacity: .95; }
.ink-bar__anim b { color: #fff; font-weight: 700; }
.ink-bar__animsel {
  padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.ink-bar__animsel option { color: #16203a; }

.ink-btn {
  padding: 9px 16px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06); color: #fff; cursor: pointer; font: inherit; font-weight: 600;
  transition: background .14s ease, border-color .14s ease, transform .08s ease, filter .14s ease;
}
.ink-btn:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.32); }
.ink-btn:active { transform: translateY(1px); }
.ink-btn:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.7); outline-offset: 2px; }
.ink-btn--primary {
  background: linear-gradient(180deg, var(--ink-accent), var(--ink-accent-strong));
  border-color: var(--ink-accent-strong);
  box-shadow: 0 1px 1px rgba(255, 255, 255, 0.16) inset, 0 4px 12px rgba(31, 87, 224, 0.35);
}
.ink-btn--primary:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--ink-accent), var(--ink-accent-strong)); }
.ink-btn:disabled { opacity: .55; cursor: default; filter: grayscale(.2); }

.ink-editing [data-edit] { outline: 1px dashed rgba(47, 109, 246, 0.4); outline-offset: 3px; }
.ink-editable:hover { outline-color: var(--ink-accent); }
.ink-editable:focus { outline: 2px solid var(--ink-accent); background: rgba(47, 109, 246, 0.06); }

[data-photo] { position: relative; }
.ink-photo-tools {
  position: absolute; top: 8px; left: 8px; z-index: 5; display: flex; gap: 6px;
}
.ink-photo-btn {
  padding: 7px 11px; border-radius: 8px; border: 0; cursor: pointer;
  background: linear-gradient(180deg, var(--ink-accent), var(--ink-accent-strong)); color: #fff;
  font: 600 12px/1 system-ui, sans-serif; box-shadow: 0 4px 14px rgba(16, 24, 40, 0.30);
  transition: transform .1s ease, filter .14s ease;
}
.ink-photo-btn:hover { filter: brightness(1.06); }
.ink-photo-btn:active { transform: translateY(1px); }
.ink-photo-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.ink-photo-btn--ghost {
  background: rgba(15, 23, 41, 0.66); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}

/* Position & size (photo framing) floating panel */
.ink-adjust {
  position: fixed; right: 18px; bottom: 92px; z-index: 2147483646; width: 268px;
  background: #fff; color: var(--ink-ink, #1c2230); border-radius: 16px;
  border: 1px solid var(--ink-line); box-shadow: var(--ink-shadow-2); padding: 14px;
  font: 13px/1.4 system-ui, -apple-system, sans-serif;
}
.ink-adjust__hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ink-adjust__hd b { font-size: 14px; }
.ink-adjust__x { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: #6b7280; }
.ink-adjust__pad {
  position: relative; width: 100%; height: 150px; border-radius: 10px;
  background-color: #eef1f6; background-size: cover; background-position: center;
  cursor: grab; touch-action: none; overflow: hidden; border: 1px solid #e3e7ee;
}
.ink-adjust__pad:active { cursor: grabbing; }
.ink-adjust__dot {
  position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.4);
  background: rgba(255, 255, 255, 0.25); transform: translate(-50%, -50%); pointer-events: none;
  left: 50%; top: 50%;
}
.ink-adjust__hint { margin: 8px 0 10px; color: #6b7280; font-size: 12px; }
.ink-adjust__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; }
.ink-adjust__row > span:first-child { font-weight: 600; }
.ink-adjust__seg { display: inline-flex; border: 1px solid #d7dce5; border-radius: 8px; overflow: hidden; }
.ink-adjust__seg button {
  border: 0; background: #fff; padding: 6px 10px; font: 600 12px/1 system-ui, sans-serif;
  cursor: pointer; color: #3a4257;
}
.ink-adjust__seg button + button { border-left: 1px solid #d7dce5; }
.ink-adjust__seg button.is-on { background: var(--ink-accent, #4f46e5); color: #fff; }
.ink-adjust__row--wrap { align-items: flex-start; }
.ink-adjust__chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 190px; }
.ink-adjust__chips button {
  border: 1px solid #d7dce5; background: #fff; border-radius: 7px; padding: 5px 9px;
  font: 600 12px/1 system-ui, sans-serif; cursor: pointer; color: #3a4257;
}
.ink-adjust__chips button.is-on { background: var(--ink-accent, #4f46e5); color: #fff; border-color: var(--ink-accent, #4f46e5); }
.ink-adjust__rng { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: flex-end; }
.ink-adjust__rng input[type="range"] { flex: 1; max-width: 130px; }
.ink-adjust__rng b { min-width: 40px; text-align: right; font-weight: 600; }
.ink-adjust__actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }
.ink-adjust__seg button:focus-visible,
.ink-adjust__chips button:focus-visible,
.ink-adjust__x:focus-visible,
.ink-modal__close:focus-visible { outline: 2px solid var(--ink-accent); outline-offset: 2px; }
/* The focal-point pad is draggable; keyboard users move the dot with arrows. */
.ink-adjust__pad:focus-visible { outline: 3px solid var(--ink-accent); outline-offset: 2px; }
@media (max-width: 640px) {
  .ink-adjust { right: 8px; left: 8px; width: auto; bottom: 8px; }
}
.ink-linkpanel__in {
  width: 100%; box-sizing: border-box; padding: 9px 11px; border-radius: 9px;
  border: 1px solid #d7dce5; font: 13px/1.4 system-ui, sans-serif; color: #1c2230;
  margin-bottom: 4px;
}
.ink-linkpanel__in:focus { outline: 2px solid var(--ink-accent, #4f46e5); outline-offset: 1px; }
/* While editing, show that a photo carries a click-through link. */
.ink-editing .ink-linked { outline: 2px dashed rgba(79, 70, 229, 0.5); outline-offset: 2px; }

[data-pdf] { position: relative; }
.ink-editing [data-pdf] { outline: 1px dashed rgba(47, 109, 246, 0.4); outline-offset: 3px; min-height: 56px; }
.ink-pdf-tools { position: absolute; top: 8px; right: 8px; z-index: 5; display: flex; gap: 6px; }

/* Self-hosted video / audio + video embeds. */
[data-video], [data-audio], [data-embed] { position: relative; }
.ink-editing [data-video], .ink-editing [data-audio], .ink-editing [data-embed] {
  outline: 1px dashed rgba(47, 109, 246, 0.4); outline-offset: 3px; min-height: 56px;
}
.ink-media-tools { position: absolute; top: 8px; right: 8px; z-index: 5; display: flex; gap: 6px; }
.ink-video { width: 100%; max-width: 100%; display: block; border-radius: 12px; background: #000; }
.ink-audio { width: 100%; display: block; }

.ink-toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%) translateY(12px);
  z-index: 2147483001; max-width: min(560px, 92vw);
  padding: 13px 18px; border-radius: 12px; color: #fff;
  background: color-mix(in srgb, var(--ink-ink) 94%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  font: 14px/1.5 system-ui, sans-serif; box-shadow: var(--ink-shadow-2);
  opacity: 0; transition: opacity .35s ease, transform .35s ease; pointer-events: none;
}
.ink-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

.ink-modal {
  position: fixed; inset: 0; z-index: 2147483002; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 12, 22, 0.55); padding: 18px;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  animation: ink-fade .18s ease both;
}
/* The hidden attribute must win over display:flex, or the full-screen
   overlay stays mounted and silently swallows every click on the page. */
.ink-modal[hidden] { display: none !important; }
.ink-modal__box {
  position: relative; width: 100%; max-width: 400px; background: var(--ink-panel); color: var(--ink-ink);
  border-radius: 16px; padding: 26px 24px; box-shadow: var(--ink-shadow-2);
  border: 1px solid var(--ink-line); animation: ink-pop .2s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes ink-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ink-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .ink-modal, .ink-modal__box { animation: none; }
}
.ink-modal__close {
  position: absolute; top: 12px; right: 14px; border: 0; background: transparent;
  font-size: 24px; line-height: 1; color: #8a93a6; cursor: pointer;
}
.ink-modal__title { margin: 0 0 6px; font-size: 20px; }
.ink-modal__sub { margin: 0 0 16px; color: #5b6479; font-size: 14px; }
.ink-modal__err {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 8px;
  background: #fdecec; color: #b42318; font-size: 13px;
}
.ink-field { display: block; margin: 0 0 12px; }
.ink-field span { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 600; color: #3a4257; }
.ink-field input {
  width: 100%; box-sizing: border-box; padding: 11px 12px; border: 1px solid #cdd3df;
  border-radius: 10px; font: inherit; transition: border-color .14s ease, box-shadow .14s ease;
}
.ink-field input:focus { outline: none; border-color: var(--ink-accent); box-shadow: 0 0 0 3px var(--ink-ring); }
.ink-modal__btn {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid #cdd3df; background: #f4f6fb;
  color: var(--ink-ink); font: inherit; font-weight: 600; cursor: pointer; margin-top: 2px;
  transition: background .14s ease, filter .14s ease, transform .08s ease;
}
.ink-modal__btn:hover { background: #eef1f8; }
.ink-modal__btn:active { transform: translateY(1px); }
.ink-modal__btn:focus-visible { outline: 2px solid var(--ink-accent); outline-offset: 2px; }
.ink-modal__btn--primary {
  background: linear-gradient(180deg, var(--ink-accent), var(--ink-accent-strong));
  border-color: var(--ink-accent-strong); color: #fff;
  box-shadow: 0 1px 1px rgba(255, 255, 255, 0.16) inset, 0 4px 12px rgba(31, 87, 224, 0.32);
}
.ink-modal__btn--primary:hover { background: linear-gradient(180deg, var(--ink-accent), var(--ink-accent-strong)); filter: brightness(1.06); }
.ink-modal__btn--quiet {
  margin-top: 8px; border: 0; background: none; color: var(--ink-accent);
  font-weight: 600; text-decoration: underline; padding: 10px;
}
.ink-modal__btn--quiet:hover { background: rgba(47,109,246,.07); }
.ink-modal__btn[disabled] { opacity: .65; cursor: default; }
/* show/hide toggle inside the password field */
.ink-pw { position: relative; display: block; }
.ink-pw input { padding-right: 46px; }
.ink-pw__eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border: 0; border-radius: 8px; background: none;
  cursor: pointer; font-size: 15px; line-height: 1; color: #5b6478;
}
.ink-pw__eye:hover { background: #eef1f8; }
.ink-pw__eye:focus-visible { outline: 2px solid var(--ink-accent); outline-offset: 1px; }
.ink-pw__eye[aria-pressed="true"] { color: var(--ink-accent); }
.ink-modal__or { text-align: center; margin: 14px 0; color: #97a0b3; position: relative; }
.ink-modal__or span { background: var(--ink-panel); padding: 0 10px; position: relative; z-index: 1; }
.ink-modal__or::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: #e4e8f0; }
.ink-modal__note { margin: 12px 0 0; font-size: 13px; color: #2f7a44; background: #eafaf0; padding: 10px 12px; border-radius: 8px; }

/* preview-mode (try it) modal */
.ink-modal--preview .ink-modal__box { max-width: 440px; }
.ink-feature { list-style: none; margin: 0 0 18px; padding: 0; }
.ink-feature li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid #eef1f6; font-size: 14px; color: #3a4257;
}
.ink-feature li:last-child { border-bottom: 0; }
.ink-feature strong { color: var(--ink-ink); }
.ink-feature__i {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; margin-top: 1px; border-radius: 999px;
  background: var(--ink-accent); color: #fff; font-size: 12px; font-weight: 700;
}
.ink-modal--preview .ink-modal__btn { text-decoration: none; text-align: center; display: block; }
.ink-modal--preview .ink-modal__btn--primary { margin-bottom: 8px; }

/* selection panel (animate / link / icon / style) in the bottom bar */
.ink-bar__sel {
  display: flex; align-items: center; gap: 12px; flex: 1 1 360px; flex-wrap: wrap;
  padding: 4px 0; font-size: 13px;
}
.ink-bar__sellbl {
  font-weight: 700; color: #fff; background: rgba(255,255,255,.14);
  padding: 4px 9px; border-radius: 7px; max-width: 200px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ink-bar__field { display: inline-flex; align-items: center; gap: 7px; }
/* A class `display` overrides the bare [hidden] attribute, so restore it
   explicitly: only the controls relevant to the selected element should show. */
.ink-bar__field[hidden] { display: none; }
.ink-bar__fl { opacity: .82; }
.ink-bar__input {
  padding: 7px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.1); color: #fff; font: inherit; min-width: 220px;
}
.ink-bar__input::placeholder { color: rgba(255,255,255,.72); }
.ink-bar__input--icon { min-width: 64px; text-align: center; font-size: 18px; }
.ink-bar__animsel { padding: 7px 10px; }
.ink-btn--sm { padding: 6px 10px; font-size: 13px; }

/* current-page chip in the toolbar message (so per-page edits are obvious) */
.ink-bar__page {
  display: inline-block; font-weight: 700; color: #fff;
  background: rgba(255, 255, 255, 0.16); border-radius: 6px;
  padding: 2px 8px; margin: 0 2px; letter-spacing: .01em;
}

/* "Saves to" page-scope segmented control (This page / All pages) */
.ink-bar__scope { gap: 8px; }
.ink-scope {
  display: inline-flex; border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px; overflow: hidden;
}
.ink-scope__b {
  border: 0; background: transparent; color: #fff; cursor: pointer; opacity: .78;
  padding: 7px 12px; font: 600 13px/1 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  transition: background .12s ease, opacity .12s ease;
}
.ink-scope__b + .ink-scope__b { border-left: 1px solid rgba(255, 255, 255, 0.28); }
.ink-scope__b:hover { background: rgba(255, 255, 255, 0.12); opacity: 1; }
.ink-scope__b:focus-visible { outline: 2px solid #fff; outline-offset: -2px; opacity: 1; }
.ink-scope__b.is-on { background: var(--ink-accent); color: var(--ink-accent-ink); opacity: 1; }

/* emoji picker popover */
.ink-emoji {
  position: fixed; z-index: 2147483004; width: 256px;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px;
  padding: 8px; background: #fff; border-radius: 14px;
  border: 1px solid var(--ink-line); box-shadow: var(--ink-shadow-2);
  max-height: 280px; overflow-y: auto;
}
/* The hidden attribute must win over display:grid above. */
.ink-emoji[hidden] { display: none; }
.ink-emoji__b {
  border: 0; background: transparent; cursor: pointer; font-size: 20px;
  padding: 6px 0; border-radius: 8px; line-height: 1;
}
.ink-emoji__b:hover { background: #eef1f6; }
.ink-emoji__b:focus-visible { outline: 2px solid var(--ink-accent); outline-offset: -2px; }

/* style popover */
.ink-modal--style .ink-modal__box { max-width: 380px; }
.ink-style__grid { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 16px; }
.ink-style__row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid #eef1f6; font-size: 14px; color: #3a4257;
}
.ink-style__row > span:first-child { flex: 0 0 110px; font-weight: 600; }
.ink-style__row input[type="color"] { width: 46px; height: 30px; border: 1px solid #cdd3df; border-radius: 6px; background: #fff; cursor: pointer; padding: 2px; }
.ink-style__row select { padding: 7px 9px; border-radius: 7px; border: 1px solid #cdd3df; font: inherit; }
.ink-style__rng { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: flex-end; }
.ink-style__rng input[type="range"] { flex: 1; max-width: 150px; }
.ink-style__rng b { font-weight: 600; min-width: 48px; text-align: right; color: var(--ink-ink); }
.ink-style__btns { display: inline-flex; gap: 4px; }
.ink-style__btns button {
  width: 30px; height: 30px; border: 1px solid #cdd3df; background: #f4f6fb;
  border-radius: 6px; cursor: pointer; font: 600 12px/1 system-ui, sans-serif; color: #3a4257;
}
.ink-style__btns button.is-on { background: var(--ink-accent); border-color: var(--ink-accent); color: #fff; }

/* editing affordance for link / icon / style targets */
.ink-editing [data-link], .ink-editing [data-icon], .ink-editing [data-style] {
  outline: 1px dashed rgba(47, 109, 246, 0.4); outline-offset: 3px; cursor: pointer;
}
.ink-editing [data-item] { outline: 1px dashed rgba(47, 109, 246, 0.35); outline-offset: 4px; }

/* per-card structure toolbar (duplicate / reorder / remove) */
.ink-item-tools {
  position: absolute; top: 6px; right: 6px; z-index: 2147483002;
  display: inline-flex; gap: 3px; padding: 3px;
  background: var(--ink-ink); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.28);
  opacity: 0; transition: opacity .12s ease; pointer-events: none;
}
/* Hover alone would hide this entire feature from anyone on a touch screen and
   leave keyboard users tabbing through invisible buttons, so the toolbar also
   appears when the card is tapped (.ink-item--active) or holds focus. */
[data-item]:hover > .ink-item-tools,
[data-item]:focus-within > .ink-item-tools,
[data-item].ink-item--active > .ink-item-tools,
.ink-item-tools:hover { opacity: 1; pointer-events: auto; }
/* No hover to reveal it on a phone or tablet: keep it up the whole time the
   client is editing, which is the only way these actions are reachable there. */
@media (hover: none) {
  .ink-editing [data-item] > .ink-item-tools { opacity: 1; pointer-events: auto; }
}
.ink-item-tools button {
  /* 34px, and the destructive button spaced away from Move-down, because the
     people using this are often not steady with a fingertip. */
  width: 34px; height: 34px; border: 0; border-radius: 6px; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff; font: 700 14px/1 system-ui, sans-serif;
}
.ink-item-tools button[data-act="del"] { margin-left: 8px; }
.ink-item-tools button:hover { background: rgba(255,255,255,.3); }
.ink-item-tools button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ink-item-tools button[data-act="del"]:hover { background: #e5484d; }
.ink-item-tools .ink-drag { cursor: grab; touch-action: none; background: rgba(255,255,255,.22); }
.ink-item-tools .ink-drag:active { cursor: grabbing; }
/* While dragging a card: lift it and keep tools visible across the list. */
body.ink-dnd { cursor: grabbing; user-select: none; }
body.ink-dnd [data-item] > .ink-item-tools { opacity: 1; pointer-events: auto; }
.ink-gallery-add {
  display: inline-flex; align-items: center; gap: 6px; margin: 14px 0 4px;
  padding: 10px 16px; border: 2px dashed var(--ink-accent, #4f46e5); border-radius: 10px;
  background: rgba(79,70,229,.06); color: var(--ink-accent, #4f46e5);
  font: 700 13px/1 system-ui, sans-serif; cursor: pointer;
  z-index: 2147483002; position: relative;
}
.ink-gallery-add:hover { background: rgba(79,70,229,.12); }

/* "Add block": same affordance as Add image, plus a small chooser popup listing
   only the block types the developer declared for that region. */
.ink-block-add {
  display: inline-flex; align-items: center; gap: 6px; margin: 14px 8px 4px 0;
  padding: 10px 16px; border: 2px dashed var(--ink-accent, #4f46e5); border-radius: 10px;
  background: rgba(79,70,229,.06); color: var(--ink-accent, #4f46e5);
  font: 700 13px/1 system-ui, sans-serif; cursor: pointer;
  z-index: 2147483002; position: relative;
}
.ink-block-add:hover { background: rgba(79,70,229,.12); }
.ink-block-pop {
  display: inline-flex; flex-direction: column; gap: 2px; vertical-align: top;
  margin: 14px 0 4px; padding: 6px; border-radius: 12px; background: #fff;
  border: 1px solid var(--ink-line, #e5e7eb); box-shadow: 0 18px 44px rgba(0,0,0,.18);
  position: relative; z-index: 2147483003; max-height: 320px; overflow: auto;
}
.ink-block-pop__item {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  text-align: left; padding: 9px 14px; border-radius: 8px; white-space: nowrap;
  font: 600 13px/1.2 system-ui, sans-serif; color: var(--ink-ink, #111827);
}
.ink-block-pop__item:hover { background: rgba(79,70,229,.10); color: var(--ink-accent, #4f46e5); }
.ink-block-pop__item:focus-visible { outline: 2px solid var(--ink-accent, #4f46e5); outline-offset: -2px; }
[data-item].ink-dragging {
  opacity: .82; transform: scale(1.015); transition: transform .08s ease;
  box-shadow: 0 14px 36px rgba(0,0,0,.28); outline: 2px solid var(--ink-accent, #4f46e5);
  position: relative; z-index: 2147483001;
}

/* info modal (first-run tour + publish-success confirmation) */
.ink-modal__body { color: var(--ink-ink); font-size: 14px; line-height: 1.55; margin: 6px 0 14px; }
.ink-modal__foot { display: flex; gap: 10px; flex-wrap: wrap; }
.ink-modal__foot .ink-modal__btn { flex: 1; min-width: 120px; text-align: center; text-decoration: none; }
.ink-tour { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.ink-tour li { font-size: 14px; line-height: 1.5; }

/* SEO modal */
.ink-count { float: right; font-weight: 400; opacity: .8; font-size: 12px; }
.ink-seo__preview {
  border: 1px solid var(--ink-line, #e4e7f2); border-radius: 10px; padding: 12px 14px;
  margin: 6px 0 14px; display: grid; gap: 3px; background: #fafbff;
}
.ink-seo__url { color: #1a7f37; font-size: 12px; }
.ink-seo__t { color: #1a0dab; font-size: 17px; line-height: 1.25; }
.ink-seo__d { color: #4d5156; font-size: 13px; line-height: 1.45; }
.ink-field textarea {
  width: 100%; box-sizing: border-box; resize: vertical; font: inherit;
  border: 1px solid var(--ink-line, #cdd3e6); border-radius: 8px; padding: 9px 11px;
}

/* version history modal */
.ink-hist { display: grid; gap: 8px; max-height: 50vh; overflow: auto; }
.ink-hist__row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--ink-line, #e4e7f2); border-radius: 10px; padding: 10px 12px;
}
.ink-hist__meta { display: grid; gap: 2px; font-size: 13px; }
.ink-hist__meta b { font-size: 14px; }
.ink-hist__meta span { color: #6b7280; font-size: 12px; }

/* team & account panel */
.ink-admin { display: grid; gap: 22px; max-height: 64vh; overflow: auto; }
.ink-admin__sec h3 { margin: 0 0 10px; font-size: 15px; color: var(--ink-ink); }
.ink-admin__sec h4 { margin: 0 0 8px; font-size: 13px; color: #3a4257; }
.ink-admin__list { display: grid; gap: 8px; }
.ink-admin__row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--ink-line, #e4e7f2); border-radius: 10px; padding: 9px 12px;
}
.ink-admin__who { display: flex; flex-direction: column; gap: 1px; margin-right: auto; min-width: 0; }
.ink-admin__who b { font-size: 14px; }
.ink-admin__who span { font-size: 12px; color: #6b7280; overflow: hidden; text-overflow: ellipsis; }
.ink-admin__pend {
  font-style: normal; font-size: 11px; font-weight: 700; color: #92580a;
  background: #fff3d6; border-radius: 999px; padding: 1px 8px; width: fit-content; margin-top: 2px;
}
.ink-admin__role {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  border-radius: 999px; padding: 3px 9px;
}
.ink-admin__role--owner { background: #efe6ff; color: #6b3fd1; }
.ink-admin__role--admin { background: #e3f0ff; color: #1f63c4; }
.ink-admin__role--editor { background: #eef1f6; color: #4b5468; }
.ink-admin__src { font-size: 11px; color: #97a0b3; }
.ink-admin__rolesel { padding: 6px 8px; border: 1px solid #cdd3df; border-radius: 8px; font: inherit; }
.ink-admin__rm { color: #b42318; }
.ink-admin__inviteform { display: flex; gap: 8px; flex-wrap: wrap; }
.ink-admin__inviteform input { flex: 1 1 140px; min-width: 0; padding: 10px 11px; border: 1px solid #cdd3df; border-radius: 8px; font: inherit; }
.ink-admin__inviteform select { padding: 10px; border: 1px solid #cdd3df; border-radius: 8px; font: inherit; }
.ink-admin__inviteform .ink-btn { flex: 0 0 auto; }
.ink-admin__invite { margin-top: 14px; }
.ink-admin__hint { margin: 8px 0 0; font-size: 12px; color: #6b7280; }
.ink-admin__invlink { margin-top: 10px; background: #f4f6fb; border: 1px solid #e1e6f0; border-radius: 8px; padding: 10px 12px; }
.ink-admin__invlink p { margin: 0 0 8px; font-size: 12px; color: #3a4257; line-height: 1.5; }
.ink-admin__copyrow { display: flex; gap: 8px; }
.ink-admin__copyrow input { flex: 1 1 auto; min-width: 0; padding: 9px 10px; border: 1px solid #cdd3df; border-radius: 8px; font: inherit; font-size: 12px; color: #3a4257; background: #fff; }
.ink-admin__copyrow .ink-btn { flex: 0 0 auto; }
.ink-admin__diag { margin-top: 10px; }
.ink-diag__sum { font-size: 12px; font-weight: 600; color: #3a4257; margin-bottom: 8px; }
.ink-diag__row { display: grid; grid-template-columns: 18px 120px 1fr; gap: 8px; align-items: start; padding: 6px 0; border-top: 1px solid #eef1f6; font-size: 12px; }
.ink-diag__i { text-align: center; font-weight: 700; }
.ink-diag__lbl { font-weight: 600; color: #3a4257; }
.ink-diag__d { color: #5b6478; line-height: 1.45; }
.ink-diag__row--ok .ink-diag__i { color: #16a34a; }
.ink-diag__row--warn .ink-diag__i { color: #d97706; }
.ink-diag__row--error .ink-diag__i { color: #dc2626; }
.ink-diag__row--info .ink-diag__i { color: #6b7280; }
.ink-admin__note { margin: 12px 0 0; font-size: 13px; color: #3a4257; background: #f4f6fb; padding: 10px 12px; border-radius: 8px; line-height: 1.5; }
.ink-admin__note code { background: #e7ebf3; padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.ink-admin__you { margin: 0 0 10px; font-size: 13px; }
.ink-admin__pw { display: flex; gap: 8px; flex-wrap: wrap; }
.ink-admin__pw input { flex: 1 1 160px; min-width: 0; padding: 10px 11px; border: 1px solid #cdd3df; border-radius: 8px; font: inherit; }
.ink-admin__pw .ink-btn { flex: 0 0 auto; }
.ink-admin__signout { margin-top: 14px; color: #b42318; }

@media (max-width: 640px) {
  .ink-launch { right: 12px; bottom: 12px; padding: 11px 16px; font-size: 14px; }

  /* The toolbar must never swallow the whole screen: cap its height and let it
     scroll internally, with the content you tapped staying visible above it. */
  .ink-bar {
    flex-direction: column; align-items: stretch; gap: 10px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    max-height: 60vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  /* Short hint up top; it doesn't need to dominate a phone screen. */
  .ink-bar__msg { order: -1; flex: 0 0 auto; min-width: 0; font-size: 12px; opacity: .8; }

  /* What you tapped: make its controls the prominent, full-width block. */
  .ink-bar__sel {
    flex: 1 1 auto; gap: 8px; padding: 8px; border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
  }
  .ink-bar__sellbl { max-width: 100%; }
  .ink-bar__field { display: flex; width: 100%; align-items: center; }
  .ink-bar__field .ink-bar__input { flex: 1; min-width: 0; }
  .ink-bar__input--icon { flex: 0 0 64px; }

  /* Scope control: full-width, equal halves so both are easy thumb targets. */
  .ink-bar__scope .ink-scope { flex: 1; }
  .ink-scope__b { flex: 1; padding: 10px 8px; text-align: center; }

  /* Buttons in a tidy grid instead of nine full-width stacked rows. */
  .ink-bar__actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .ink-bar__actions .ink-btn { width: 100%; text-align: center; padding: 11px 8px; }
  .ink-bar__actions .ink-btn--sm { font-size: 13px; }
  /* Publish is the primary action: give it the full width on its own row. */
  #lePublish { grid-column: 1 / -1; }

  .ink-admin__inviteform input, .ink-admin__pw input { flex: 1 1 100%; }
  .ink-modal__box { max-width: 100%; }
}

/* ---------------- unpublished-changes indicator on Publish ---------------- */
#lePublish { display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.ink-pub__badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.22); color: #fff;
  font: 700 12px/1 system-ui, sans-serif;
}
/* Gently pulse the primary button while there are unpublished edits so the
   business owner knows there's something to publish. Respects reduced motion. */
#lePublish.is-dirty { box-shadow: 0 0 0 0 var(--ink-ring); animation: ink-pulse 2.4s ease-out infinite; }
#lePublish.is-busy { animation: none; }
@keyframes ink-pulse {
  0% { box-shadow: 0 0 0 0 var(--ink-ring); }
  60% { box-shadow: 0 0 0 8px rgba(47, 109, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 109, 246, 0); }
}
@media (prefers-reduced-motion: reduce) {
  #lePublish.is-dirty { animation: none; }
  .ink-launch:hover { transform: none; }
  .ink-bar, .ink-bar--lifted, .ink-toast { transition: none; }
}

/* ---------------- destructive dialog action ---------------- */
.ink-modal__btn--danger {
  background: #fdecec; border-color: #f2c4c0; color: #b42318;
}
.ink-modal__btn--danger:hover { background: #fbdedd; filter: none; }

/* ---------------- branded confirm / prompt dialog ---------------- */
.ink-modal--dialog .ink-modal__box { max-width: 420px; }
.ink-dlg__muted { color: var(--ink-muted); font-size: 13px; margin: 10px 0 0; line-height: 1.5; }
.ink-dlg__muted a { color: var(--ink-accent); }
.ink-dlg__errtext {
  margin: 10px 0 0; padding: 10px 12px; border-radius: 8px;
  background: #fdecec; color: #b42318; font-size: 13px; word-break: break-word;
}
.ink-dlg__field { margin-top: 14px; }
.ink-dlg__input {
  width: 100%; box-sizing: border-box; padding: 11px 12px; border: 1px solid #cdd3df;
  border-radius: 10px; font: inherit;
}
.ink-dlg__input:focus { outline: none; border-color: var(--ink-accent); box-shadow: 0 0 0 3px var(--ink-ring); }
/* In a confirm/prompt the two actions sit side by side; Cancel first, action emphasised. */
.ink-modal--dialog .ink-modal__foot { margin-top: 18px; }
