:root {
  --ink: #1d2433;
  --ink-2: #4a5468;
  --muted: #7b8496;
  --line: #e4e6eb;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --side: #fbfbfc;
  --accent: #f2a541;      /* warm amber, used sparingly */
  --focus: #3b6fd8;
  --danger: #c8372d;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 28, 45, .06), 0 4px 16px rgba(20, 28, 45, .06);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color: var(--ink);
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
#app { height: 100%; display: flex; flex-direction: column; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
.boot { margin: auto; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 4px 12px; }

/* ---------- Buttons & inputs ---------- */
.btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px;
  padding: 7px 14px; font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { border-color: #cfd3db; background: #f9fafb; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #2c3548; border-color: #2c3548; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b02f26; }
.icon-btn {
  border: 0; background: transparent; border-radius: 6px; width: 28px; height: 28px;
  display: inline-grid; place-items: center; color: var(--ink-2); font-size: 15px; flex: none;
}
.icon-btn:hover { background: #eceef2; color: var(--ink); }
.input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit;
  background: #fff; color: var(--ink);
}
.input:focus, .name-input:focus { outline: 2px solid color-mix(in srgb, var(--focus) 35%, transparent); border-color: var(--focus); }
.input.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; line-height: 1.5; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Top bar ---------- */
.topbar {
  height: 56px; flex: none; display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; text-decoration: none; letter-spacing: -.01em; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--ink); color: var(--accent); display: grid; place-items: center; font-size: 14px; }


.topbar-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- Library ---------- */
.lib { flex: 1; display: flex; min-height: 0; }
.sidebar { width: 260px; flex: none; background: var(--side); border-right: 1px solid var(--line); overflow-y: auto; padding: 12px 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 18px; }
.nav-item, .tree-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; text-decoration: none;
  color: var(--ink-2); cursor: pointer; user-select: none; min-height: 32px;
}
.nav-item:hover, .tree-row:hover { background: #eef0f3; color: var(--ink); }
.nav-item.active, .tree-row.active { background: #e6e9ef; color: var(--ink); font-weight: 600; }
.nav-item.drop, .tree-row.drop, .subfolder.drop { background: #fff4e3; outline: 2px dashed var(--accent); outline-offset: -2px; }
.nav-icon { width: 16px; text-align: center; color: var(--muted); font-size: 12px; flex: none; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-head { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 6px 10px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.twisty { border: 0; background: none; width: 14px; padding: 0; color: var(--muted); font-size: 10px; flex: none; }
.twisty.leaf { visibility: hidden; }
.tree-row .row-menu { opacity: 0; width: 22px; height: 22px; }
.tree-row:hover .row-menu, .tree-row.active .row-menu { opacity: 1; }
.tree-row:hover .count, .tree-row.active .count { display: none; }

.lib-main { flex: 1; overflow-y: auto; padding: 28px 32px 48px; }
.lib-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.lib-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { text-decoration: none; } .crumbs a:hover { text-decoration: underline; }
.subfolders { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.subfolder { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 12px; }
.subfolder:hover { border-color: #cfd3db; }
.subfolder .count { margin-left: 4px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: box-shadow .15s, transform .15s; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.card.dragging { opacity: .5; }
.thumb-wrap { height: 260px; background: #eef0f3; overflow: hidden; cursor: pointer; position: relative; border-bottom: 1px solid var(--line); }
.thumb { position: absolute; inset: 0; pointer-events: none; }
.thumb iframe { width: 640px; height: 800px; border: 0; transform: scale(.4); transform-origin: 0 0; background: #fff; }
.card-body { padding: 10px 10px 12px 14px; }
.card-title-row { display: flex; align-items: center; gap: 6px; }
.card-title { flex: 1; font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.badge { background: #fff1db; color: #8a5a10; border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 600; }
.chip { background: #eef0f3; color: var(--ink-2); border-radius: 4px; padding: 1px 6px; font-size: 11px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty-state { margin: 80px auto; text-align: center; color: var(--muted); }
.empty-mark { font-size: 36px; color: #c7ccd6; }
.empty-actions { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }

/* ---------- Menus, modals, toasts ---------- */
.menu { position: absolute; z-index: 1000; min-width: 200px; background: #fff; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 8px 30px rgba(20,28,45,.16); padding: 5px; }
.menu-item { display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 6px; }
.menu-label { flex: 1; }
.menu-keys { font: 500 11px/1 ui-sans-serif, -apple-system, sans-serif; color: var(--muted); background: none; border: 0; padding: 0; }
.menu-item:disabled { opacity: .45; cursor: default; background: none; }
.menu-heading { padding: 6px 10px 4px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.menu-item:hover { background: #f0f2f5; }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,28,45,.35); display: grid; place-items: center; z-index: 900; padding: 24px; }
.modal { background: #fff; border-radius: 14px; width: 420px; max-width: 100%; box-shadow: 0 20px 60px rgba(20,28,45,.25); max-height: 90vh; display: flex; flex-direction: column; }
.modal-wide { width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 4px 20px; }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 14px 20px; overflow-y: auto; }
.modal-body p { margin: 0; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 9px; opacity: 0; transition: .2s; pointer-events: none; z-index: 2000; max-width: 80vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* ---------- Editor ---------- */
body.is-editor { overflow: hidden; }
.editor-bar { gap: 12px; }
.back { font-size: 18px; }
.name-input { border: 1px solid transparent; border-radius: 7px; padding: 6px 8px; font: inherit; font-weight: 600; font-size: 15px; min-width: 220px; max-width: 360px; background: transparent; color: var(--ink); }
.name-input:hover { border-color: var(--line); }
.save-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.save-status.dirty { color: #a26a12; }
.save-status.error { color: var(--danger); }
.segmented { display: flex; background: var(--bg); border-radius: 8px; padding: 3px; margin-left: auto; }
.seg { border: 0; background: none; padding: 5px 12px; border-radius: 6px; font-size: 13px; color: var(--ink-2); }
.seg.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }
.editor-bar .topbar-actions { margin-left: auto; }
.editor-wrap { flex: 1; min-height: 0; display: flex; }
.ed-canvas { flex: 1; min-width: 0; position: relative; }
.ed-side { width: 300px; flex: none; background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 6px; flex: none; }
.tab { flex: 1; border: 0; background: none; padding: 12px 4px 10px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.pane { flex: 1; overflow-y: auto; min-height: 0; }
.pane[hidden] { display: none; }
.sel-head { padding: 14px 16px 8px; display: flex; flex-direction: column; gap: 4px; }
.sel-kind { font-weight: 700; font-size: 15px; }
.sel-hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.sel-hint:empty { display: none; }
/* Email settings */
.es-settings { padding: 6px 16px 24px; }
.es-settings h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.es-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.es-field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.es-field small { font-size: 11px; color: var(--muted); }
.es-input { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; font: inherit; font-size: 13px; background: #fff; color: var(--ink); resize: vertical; }
.es-input:focus { outline: 2px solid color-mix(in srgb, var(--focus) 30%, transparent); border-color: var(--focus); }
.es-color-row { display: flex; gap: 8px; align-items: center; }
.es-color { width: 36px; height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 2px; background: #fff; flex: none; cursor: pointer; }
.es-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#gjs { height: 100%; }

/* GrapesJS light theme to match the app */
.gjs-one-bg { background-color: #fff !important; }
.gjs-two-color { color: var(--ink-2) !important; }
.gjs-three-bg { background-color: var(--ink) !important; color: #fff !important; }
.gjs-four-color, .gjs-four-color-h:hover { color: var(--focus) !important; }
.gjs-cv-canvas { background-color: #eceef2; }
.gjs-pn-panel { border-color: var(--line); }
.gjs-pn-views-container, .gjs-pn-views { border-left: 1px solid var(--line); box-shadow: none; }
.gjs-pn-commands { box-shadow: none; border-bottom: 1px solid var(--line); }
.gjs-pn-views { border-bottom: 1px solid var(--line); }
.gjs-pn-btn { border-radius: 6px; }
.gjs-pn-btn.gjs-pn-active { background: #eef0f3; box-shadow: none; }
.gjs-block { border-radius: 8px; border-color: var(--line); box-shadow: none; min-height: 84px; }
.gjs-block:hover { box-shadow: var(--shadow); color: var(--ink); }
.gjs-sm-sector-title, .gjs-layer-title, .gjs-block-category .gjs-title { background-color: #f6f7f9 !important; border-color: var(--line) !important; }
.gjs-field { background-color: #f3f4f7; border-radius: 6px; }
.gjs-field input, .gjs-field select, .gjs-field textarea { color: var(--ink); }
.gjs-sm-property .gjs-sm-label, .gjs-trt-trait .gjs-label { color: var(--ink-2); }
.gjs-layer { background-color: #fff; }
.gjs-layer.gjs-selected .gjs-layer-item { background-color: #eef3ff; }
.gjs-mdl-dialog { background-color: #fff; color: var(--ink); border-radius: 12px; }
.gjs-mdl-header { border-bottom: 1px solid var(--line); }
.gjs-mdl-container { background-color: rgba(20,28,45,.35); }
.gjs-block svg { width: 40px; height: 40px; }
.gjs-block { min-height: 76px; padding: 10px 6px 8px; }
.gjs-block-label { font-size: 11px; color: var(--ink-2); }

/* GrapesJS canvas fills the area left of our sidebar */
.ed-canvas .gjs-cv-canvas { width: 100%; }
.ed-canvas .gjs-pn-options { right: 0; }
.ed-canvas .gjs-pn-commands { width: 100%; }
/* Blocks / layers / traits / styles inside our sidebar */
.ed-side .gjs-blocks-c { padding: 8px; gap: 0; }
.ed-side .gjs-block-category .gjs-title { font-size: 12px; font-weight: 600; padding: 10px 12px; }
.ed-side .gjs-trt-traits { padding: 0 8px; }
.ed-side .gjs-trt-trait { padding: 6px 8px; font-size: 12px; }
.ed-side .gjs-trt-trait .gjs-label { color: var(--ink-2) !important; font-weight: 600; }
.ed-side .traits { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.ed-side .traits:empty { display: none; }
.ed-side .gjs-sm-sector-title { font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; padding: 11px 14px; color: var(--ink) !important; }
.ed-side .gjs-sm-properties { padding: 8px 10px 12px; }
.ed-side .gjs-sm-property { font-size: 12px; }
.ed-side .gjs-sm-label { color: var(--ink-2); font-weight: 600; }
.ed-side .gjs-radio-item-label { font-size: 11px; padding: 5px 2px; }
.ed-side .gjs-radio-item input:checked + .gjs-radio-item-label { background-color: var(--ink); color: #fff; }
.ed-side .gjs-field-color-picker { border-radius: 4px; }
.ed-side .gjs-clm-tags, .ed-side .gjs-sm-header { display: none; }
.gjs-rte-toolbar { border-radius: 8px; overflow: hidden; background: #fff !important; border: 1px solid var(--line); box-shadow: var(--shadow); }
.gjs-rte-action { color: var(--ink) !important; border-right-color: var(--line) !important; min-width: 28px; }
.gjs-rte-active { background-color: #eef0f3 !important; }
.sp-container { border-radius: 8px; border-color: var(--line) !important; background: #fff !important; box-shadow: 0 8px 30px rgba(20,28,45,.16); }
.ed-side .gjs-radio-item-label { color: var(--ink-2); opacity: 1; }
.ed-side .gjs-radio-items { border-radius: 6px; overflow: hidden; }

/* Drag-and-drop file import */
.drop-overlay { position: fixed; inset: 0; z-index: 1500; background: rgba(29,36,51,.55); display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity .12s; }
.drop-overlay.show { opacity: 1; }
.drop-card { background: #fff; border-radius: 16px; padding: 36px 48px; text-align: center; border: 2px dashed var(--accent); box-shadow: 0 20px 60px rgba(20,28,45,.3); }
.drop-icon { font-size: 36px; color: var(--accent); }
.drop-title { font-size: 18px; font-weight: 700; margin-top: 6px; }
.drop-sub { color: var(--muted); margin-top: 4px; }

/* ---------- Status, templates, filters ---------- */
.status { border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 600; }
.st-draft { background: #eef0f3; color: #4a5468; }
.st-review { background: #fff1db; color: #8a5a10; }
.st-approved { background: #e3f5ea; color: #1d6b3d; }
.st-sent { background: #e6eefc; color: #2c55a8; }
.badge.tmpl { background: #efe9fb; color: #5b3fa3; }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 18px; }
.pill { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; font-size: 12px; color: var(--ink-2); }
.pill:hover { border-color: #cfd3db; }
.pill.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.brand-pill { margin-left: auto; }

/* ---------- New email ---------- */
.start-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; max-height: 360px; overflow-y: auto; padding: 2px; }
.start-opt { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 8px; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.start-opt:hover { border-color: #cfd3db; }
.start-opt.on { border-color: var(--ink); }
.start-thumb { height: 120px; border-radius: 6px; background: #eef0f3; overflow: hidden; position: relative; }
.start-thumb iframe { width: 640px; height: 800px; border: 0; transform: scale(.205); transform-origin: 0 0; pointer-events: none; background: #fff; }
.start-thumb.blank { display: grid; place-items: center; font-size: 28px; color: #b6bcc8; }
.start-thumb.brand { border-top: 6px solid; display: grid; place-items: center; }
.start-thumb.brand span { width: 60px; height: 16px; border-radius: 4px; }
.start-title { font-weight: 600; font-size: 13px; }
.start-sub { font-size: 11px; color: var(--muted); }

/* ---------- Brand kit ---------- */
.brand-kit h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
.brand-kit h3:first-of-type { margin-top: 4px; }
.brand-kit .field { margin-bottom: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.note { background: #fff6e8; border: 1px solid #f6d9a8; border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 54px; height: 54px; border-radius: 8px; border: 1px solid rgba(0,0,0,.08); position: relative; cursor: pointer; display: flex; align-items: flex-end; }
.swatch span { font-size: 9px; background: rgba(255,255,255,.85); width: 100%; text-align: center; border-radius: 0 0 7px 7px; padding: 1px 0; }
.swatch.add { background: #fff; border: 1px dashed #c3c8d2; align-items: center; justify-content: center; font-size: 20px; color: var(--muted); }
.swatch-add { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.logo-row { display: flex; gap: 8px; align-items: center; }
.logo-preview { width: 44px; height: 44px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #f6f7f9; flex: none; }
.logo-preview[src=""] { visibility: hidden; }
.link-btn { border: 0; background: none; color: var(--danger); font-size: 12px; padding: 0; margin: -6px 0 12px; }
.modal-actions .btn-danger { margin-right: auto; }

/* ---------- Editor top bar extras ---------- */
.editor-bar .topbar-actions { gap: 6px; }
.editor-bar .btn { padding: 7px 11px; }
.status-select { border: 0; border-radius: 6px; padding: 4px 6px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-ai { background: #fff6e8; border-color: #f6d9a8; color: #8a5a10; }
.btn-ai:hover { background: #ffefd6; border-color: #f0c98a; }
.check-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 9px; font-size: 11px; font-weight: 700; padding: 0 5px; margin-left: 2px; background: #eef0f3; color: var(--muted); }
.check-badge.ok { background: #e3f5ea; color: #1d6b3d; }
.check-badge.warn { background: #fff1db; color: #8a5a10; }
.check-badge.bad { background: #fde5e3; color: var(--danger); }
.tab { position: relative; font-size: 12px; }
.tab-badge { position: absolute; top: 6px; right: 2px; background: var(--accent); color: #fff; font-size: 10px; border-radius: 8px; padding: 0 5px; line-height: 15px; }
.tab-badge[hidden] { display: none; }
.es-top { padding-top: 14px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.es-apply { width: 100%; margin-top: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; }
.check input { margin-top: 3px; }
.code-block { background: #1d2433; color: #fff; padding: 10px 12px; border-radius: 8px; font-size: 12px; }
.error-text { color: var(--danger); font-size: 13px; }

/* History */
.hist { display: grid; grid-template-columns: 240px 1fr; gap: 14px; height: 62vh; }
.hist-list { overflow-y: auto; border-right: 1px solid var(--line); padding-right: 10px; display: flex; flex-direction: column; gap: 4px; }
.hist-save { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.hist-item { text-align: left; border: 0; background: none; border-radius: 8px; padding: 8px 10px; }
.hist-item:hover { background: #f3f4f7; }
.hist-item.on { background: #e8ebf1; }
.hist-time { font-weight: 600; font-size: 13px; }
.hist-sub { font-size: 11px; color: var(--muted); }
.hist-preview { display: flex; flex-direction: column; min-height: 0; }
.hist-frame { flex: 1; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; }
.hist-actions { display: flex; justify-content: flex-end; padding-top: 10px; }

/* Checks */
.checks { display: flex; flex-direction: column; gap: 8px; }
.check-item { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.check-text { flex: 1; font-size: 13px; line-height: 1.45; }
.lvl { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.lvl-error { background: #fde5e3; color: var(--danger); }
.lvl-warn { background: #fff1db; color: #8a5a10; }
.lvl-info { background: #e6eefc; color: #2c55a8; }
.all-good { background: #e3f5ea; color: #1d6b3d; border-radius: 10px; padding: 18px; text-align: center; font-weight: 600; }

/* Preview */
.pv { display: flex; flex-direction: column; gap: 10px; }
.pv-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pv-bar .segmented { margin-left: 0; }
.pv-bar .btn { margin-left: auto; }
.pv-stage { height: 60vh; background: #e9ecf1; border-radius: 10px; display: flex; justify-content: center; padding: 16px; overflow: hidden; }
.pv-stage iframe { border: 0; background: #fff; height: 100%; width: 100%; max-width: 900px; border-radius: 6px; box-shadow: var(--shadow); }
.pv-stage.mobile iframe { width: 375px; }
.pv-text { width: 100%; max-width: 640px; margin: 0; background: #fff; padding: 20px; border-radius: 6px; overflow: auto; white-space: pre-wrap; font-size: 13px; line-height: 1.5; }
.pv-text[hidden], .pv-stage iframe[hidden] { display: none; }
.segmented { display: flex; background: var(--bg); border-radius: 8px; padding: 3px; }
.seg { border: 0; background: none; padding: 5px 12px; border-radius: 6px; font-size: 13px; color: var(--ink-2); }
.seg.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }

/* Comments / review pane */
.cm { padding: 4px 16px 24px; }
.cm h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; }
.cm-section { display: flex; flex-direction: column; gap: 8px; }
.cm-link { display: flex; flex-direction: column; gap: 6px; }
.cm-link-actions { display: flex; gap: 6px; }
.cm-link-actions .btn { padding: 5px 9px; font-size: 12px; }
.cm-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.cm-item.resolved { opacity: .55; }
.cm-item.approved { border-color: #b6e2c6; background: #f3fbf6; }
.cm-item.changes { border-color: #f6d9a8; background: #fffaf2; }
.cm-head { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.cm-head .muted { margin-left: auto; }
.cm-kind { font-weight: 700; font-size: 12px; margin-bottom: 2px; }
.cm-kind.ok { color: #1d6b3d; } .cm-kind.warn { color: #8a5a10; }
.cm-body { white-space: pre-wrap; line-height: 1.45; }
.cm-anchor { border: 0; background: #f3f4f7; border-radius: 6px; padding: 4px 8px; margin-top: 6px; font-size: 12px; color: var(--ink-2); text-align: left; width: 100%; }
.cm-anchor:hover { background: #e8ebf1; }
.cm-actions { display: flex; gap: 12px; margin-top: 6px; }
.link { border: 0; background: none; padding: 0; font-size: 12px; color: var(--focus); }
.link.danger { color: var(--danger); }

/* Ask Claude */
.ai-out { display: flex; flex-direction: column; gap: 6px; }
.ai-choice { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 9px 12px; }
.ai-choice:hover { border-color: var(--ink); }
.modal-actions .btn-primary + .btn-primary { margin-left: 0; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ---------- Media library ---------- */
.media-bar { display: flex; gap: 8px; align-items: center; margin: -4px 0 8px; flex-wrap: wrap; }
.media-bar .media-sort { width: auto; }
.media-sort-wrap { display: flex; align-items: center; gap: 6px; }
.media-bar .folder-filter { width: 220px; }
.media-bar input[type=search] { max-width: 260px; }
.media-bar .btn-primary { margin-left: auto; }
.media-tip { margin: 0 0 18px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.media-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: box-shadow .15s; }
.media-card:hover { box-shadow: var(--shadow); }
.media-thumb { height: 150px; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 10px; overflow: hidden;
  background: repeating-conic-gradient(#f1f2f5 0% 25%, #fff 0% 50%) 50% / 16px 16px; border-bottom: 1px solid var(--line); }
.media-thumb img { max-width: 100%; max-height: 130px; object-fit: contain; }
.media-body { padding: 8px 8px 10px 12px; }
.media-title-row { display: flex; align-items: center; gap: 4px; }
.media-name { flex: 1; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-meta { font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 3px; }
.warn-dot { color: var(--accent); }
.chip.lock { background: #fff1db; color: #8a5a10; }
.media-detail { display: grid; grid-template-columns: 1fr 280px; gap: 18px; }
.media-detail-img { background: repeating-conic-gradient(#f1f2f5 0% 25%, #fff 0% 50%) 50% / 16px 16px; border-radius: 8px; display: grid; place-items: center; padding: 12px; min-height: 260px; max-height: 60vh; overflow: auto; }
.media-detail-img img { max-width: 100%; }
.media-detail-info dl { display: grid; grid-template-columns: 70px 1fr; gap: 6px 10px; margin: 0 0 12px; font-size: 13px; }
.media-detail-info dt { color: var(--muted); }
.media-detail-info dd { margin: 0; min-width: 0; }
.media-detail-info h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; }
.usage-list { display: flex; flex-direction: column; gap: 4px; }
.usage-item { display: flex; justify-content: space-between; gap: 8px; text-decoration: none; padding: 6px 8px; border-radius: 6px; font-size: 13px; }
.usage-item:hover { background: #f3f4f7; }
.blocks-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.blocks-bar .btn { padding: 6px 10px; font-size: 12px; }
.blocks-bar .link { margin-left: auto; text-decoration: none; }
.blocks-bar.drop { background: #fff4e3; outline: 2px dashed var(--accent); outline-offset: -2px; }
.ed-side .gjs-block img { pointer-events: none; }

/* ---------- Image editor ---------- */
.modal.modal-xl { width: min(1180px, 96vw); }
.ie { display: grid; grid-template-columns: 1fr 290px; gap: 18px; }
.ie-left { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ie-stage { height: min(62vh, 620px); background: #1d2433; border-radius: 10px; overflow: hidden; }
.ie-stage img { max-width: 100%; }
.ie-info { font-size: 12px; color: var(--muted); }
.ie-panel { overflow-y: auto; max-height: min(66vh, 660px); padding-right: 4px; }
.ie-panel h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 8px; }
.ie-panel h3:first-child { margin-top: 0; }
.ie-panel .filters { margin: 0; }
.ie-panel .field { margin-bottom: 10px; }
.ie-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ie-btn { padding: 6px 10px; font-size: 15px; min-width: 38px; }
.ie-reset { font-size: 12px; margin-left: auto; }
.ie-slider { display: grid; grid-template-columns: 80px 1fr 34px; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.ie-slider[hidden] { display: none; }
.ie-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.ie-size { min-height: 16px; margin: 4px 0 6px; }

/* ---------- Image details (media library) ---------- */
.modal.md-modal { width: min(1040px, 94vw); padding: 0; overflow: hidden; border-radius: 16px; }
.md-modal .modal-head { display: none; }
.md-modal .modal-body { padding: 0; overflow: hidden; }
.md { display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: 480px; max-height: 86vh; }
.md-view { background: #f2f3f6; display: flex; align-items: center; justify-content: center; padding: 32px; min-height: 0; }
.md-view.checker { background: repeating-conic-gradient(#eceef2 0% 25%, #f7f8fa 0% 50%) 50% / 18px 18px; }
.md-view img { max-width: 100%; max-height: calc(86vh - 64px); object-fit: contain; border-radius: 6px; box-shadow: 0 1px 2px rgba(20,28,45,.08), 0 12px 32px rgba(20,28,45,.14); }
.md-panel { padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; border-left: 1px solid var(--line); }
.md-top { display: flex; gap: 10px; align-items: flex-start; }
.md-name { flex: 1; font-size: 15px; font-weight: 600; line-height: 1.35; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.md-x { border: 0; background: #f2f3f6; width: 30px; height: 30px; border-radius: 50%; color: var(--ink-2); flex: none; font-size: 13px; }
.md-x:hover { background: #e6e8ed; color: var(--ink); }
.md-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: -6px; }
.md-chip { background: #f2f3f6; color: var(--ink-2); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.md-facts { display: grid; grid-template-columns: 64px 1fr; gap: 6px 12px; font-size: 13px; }
.md-facts span:nth-child(odd) { color: var(--muted); }
.md-url { display: flex; align-items: center; gap: 8px; width: 100%; border: 1px solid var(--line); background: #fafbfc; border-radius: 10px; padding: 9px 10px; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.md-url:hover { border-color: #c9ced8; background: #fff; }
.md-url.copied { border-color: #9fd6b3; background: #f1faf4; }
.md-url-icon { font-size: 12px; opacity: .6; flex: none; }
.md-url-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--ink-2); }
.md-copy-state { flex: none; font-size: 12px; font-weight: 600; color: var(--focus); }
.md-url.copied .md-copy-state { color: #1d6b3d; }
.md-hint { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--ink-2); line-height: 1.45; padding-left: 10px; border-left: 2px solid var(--accent); }
.md-link { border: 0; background: none; padding: 0; color: var(--focus); font-weight: 600; font-size: 12px; white-space: nowrap; }
.md-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.md-usage .usage-item { padding: 6px 8px; margin: 0 -8px; }
.md-actions { display: flex; gap: 8px; margin-top: auto; }
.md-actions .btn-primary { flex: 1; justify-content: center; }
.md-foot { display: flex; gap: 14px; border-top: 1px solid var(--line); padding-top: 12px; margin: -4px -22px 0; padding-left: 22px; padding-right: 22px; }
.md-quiet { border: 0; background: none; padding: 0; font-size: 12px; color: var(--muted); }
.md-quiet:hover { color: var(--ink); }
.md-quiet.danger { margin-left: auto; }
.md-quiet.danger:hover { color: var(--danger); }
@media (max-width: 760px) { .md { grid-template-columns: 1fr; } .md-panel { border-left: 0; border-top: 1px solid var(--line); } }
.md-view { position: relative; }
.md-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.92); color: var(--ink); font-size: 26px; line-height: 1; padding-bottom: 3px;
  box-shadow: 0 2px 10px rgba(20,28,45,.18); opacity: 0; transition: opacity .15s, transform .15s; }
.md-nav.prev { left: 14px; } .md-nav.next { right: 14px; }
.md-view:hover .md-nav, .md-nav:focus-visible { opacity: 1; }
.md-nav:hover { transform: translateY(-50%) scale(1.06); }
.md-count { margin-left: auto; font-size: 12px; color: var(--muted); align-self: center; font-variant-numeric: tabular-nums; }

/* ---------- Icons (Lucide) ---------- */
.ic { display: block; flex: none; }
.btn .ic { display: inline-block; vertical-align: -3px; margin-right: 6px; }
.nav-icon { width: 18px; height: 18px; display: grid; place-items: center; color: #8a93a5; }
.nav-item.active .nav-icon, .tree-row.active .nav-icon { color: var(--ink); }
.nav-item:hover .nav-icon, .tree-row:hover .nav-icon { color: var(--ink-2); }
.twisty { width: 16px; height: 16px; display: grid; place-items: center; border-radius: 4px; color: #9aa2b1; }
.twisty:hover { background: #e3e6ec; color: var(--ink); }
.twisty .ic { transition: transform .15s ease; }
.twisty .ic.open { transform: rotate(90deg); }
.subfolder .nav-icon { color: #8a93a5; }
.brand-mark { color: #fff; background: linear-gradient(135deg, #2b3550, #1d2433); }
.brand-mark .ic { color: var(--accent); }
.empty-mark { color: #c3c9d4; display: flex; justify-content: center; margin-bottom: 6px; }
.icon-btn .ic { color: inherit; }
.search { position: relative; display: flex; align-items: center; max-width: 380px; width: 100%; margin-left: 24px; }
.search .ic { position: absolute; left: 11px; color: #98a0ae; pointer-events: none; }
.search input { background: var(--bg); border-color: transparent; padding-left: 34px; }
.search input:focus { background: #fff; }
.md-url-icon { color: #98a0ae; opacity: 1; }
.md-nav { display: grid; place-items: center; padding: 0; font-size: 0; }
.ie-btn { display: inline-grid; place-items: center; }
.ie-btn .ic { margin: 0; }
.start-thumb.blank { color: #b6bcc8; }
.blocks-bar .btn { display: inline-flex; align-items: center; }
.blocks-bar .btn .ic { margin-right: 5px; }
.src-area { min-height: 340px; font-size: 12.5px; line-height: 1.55; tab-size: 2; white-space: pre-wrap; word-break: break-word; }
.es-code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; line-height: 1.5; tab-size: 2; }
.es-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--ink-2); line-height: 1.4; margin-top: -4px; }
.es-check input { margin-top: 2px; }

/* ---------- Inspect ---------- */
.insp { margin: 0 12px 10px; border: 1px solid #f6d9a8; background: #fffaf2; border-radius: 10px; padding: 10px 12px; }
.insp[hidden] { display: none; }
.insp-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13px; }
.insp-rows { display: flex; flex-direction: column; gap: 4px; }
.insp-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "prop val" "src src"; gap: 1px 8px; padding: 5px 0; border-top: 1px solid #f3e6cf; font-size: 12px; }
.insp-row:first-child { border-top: 0; }
.insp-prop { grid-area: prop; color: var(--ink-2); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; }
.insp-val { grid-area: val; font-weight: 600; display: flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.insp-sw { width: 11px; height: 11px; border-radius: 3px; border: 1px solid rgba(0,0,0,.12); display: inline-block; }
.insp-src { grid-area: src; justify-self: start; border: 0; border-radius: 999px; padding: 1px 8px; font-size: 10.5px; font-weight: 600; cursor: default; }
.src-block { background: #e6eefc; color: #2c55a8; }
.src-class { background: #efe9fb; color: #5b3fa3; }
.src-email { background: #e3f5ea; color: #1d6b3d; cursor: pointer; }
.src-mjml { background: #eef0f3; color: #6b7385; }
.insp-foot { margin: 8px 0 0; line-height: 1.4; }
.src-seg { align-self: flex-start; }
.src-html { margin: 0; min-height: 340px; max-height: 52vh; overflow: auto; background: #1d2433; color: #e6e9ef; border-radius: 8px; padding: 12px 14px; font-size: 11.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; }
.src-html[hidden], .src-area[hidden] { display: none; }
body.inspecting .gjs-pn-btn.gjs-pn-active.fa-crosshairs { background: #ffe3b8; color: #8a5a10; }

/* ---------- Copy HTML ---------- */
.thumb-copy { position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 8px; padding: 7px 11px; font-size: 12px; font-weight: 600; color: #fff;
  background: rgba(29,36,51,.88); box-shadow: 0 4px 14px rgba(20,28,45,.25); backdrop-filter: blur(4px);
  opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s, background .15s; }
.card:hover .thumb-copy, .thumb-copy:focus-visible { opacity: 1; transform: none; }
.thumb-copy:hover { background: #1d2433; }
.thumb-copy.done, .btn-copy.done { background: #1d6b3d; color: #fff; border-color: #1d6b3d; opacity: 1; }
.btn-copy { display: inline-flex; align-items: center; gap: 6px; }
.btn-copy .ic { margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Settings ---------- */
.side-foot { margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--line); }
.settings { display: flex; flex-direction: column; gap: 18px; max-width: 720px; }
.set-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.set-card-head h2 { margin: 0 0 4px; font-size: 16px; }
.set-card-head p { margin: 0; font-size: 13px; }
.set-field { display: flex; flex-direction: column; gap: 6px; }
.set-label { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.set-field small { font-size: 12px; color: var(--muted); }
.set-status { font-size: 11px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.set-status.ok { color: #1d6b3d; }
.set-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.set-actions .link-btn { margin: 0 0 0 auto; }
.set-test-out.ok { color: #1d6b3d; font-weight: 600; }
.set-test-out.bad { color: var(--danger); }
.set-foot { max-width: 720px; }

.src-area-tall { min-height: 60vh; }
.src-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.comment-badge { display: inline-flex; align-items: center; gap: 3px; border: 0; cursor: pointer; font: inherit; font-size: 11px; font-weight: 600;
  background: #e8effc; color: #2a56b8; border-radius: 4px; padding: 1px 6px; }
.comment-badge svg { width: 12px; height: 12px; }
.comment-badge:hover { background: #d8e4fb; }
.comment-badge.new { background: #e5484d; color: #fff; }
.comment-badge.new:hover { background: #d13a3f; }

.tmpl-flag { display: inline-flex; align-items: center; gap: 5px; background: #efe9fb; color: #5b3fa3; border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }

/* Editor side panel: left by default; Settings → Appearance can put it back on the right. */
html:not([data-panel="right"]) .ed-side { order: -1; border-left: 0; border-right: 1px solid var(--line); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }

/* Image tray in the Blocks tab */
.tray { border-bottom: 1px solid var(--line); }
.tray-head { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: #f6f7f9; padding: 8px 12px; font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; text-align: left; letter-spacing: .02em; }
.tray-caret { display: inline-block; transition: transform .15s; font-size: 10px; }
.tray.closed .tray-caret { transform: rotate(-90deg); }
.tray.closed .tray-body { display: none; }
.tray-count { margin-left: auto; font-weight: 500; color: var(--muted); }
.tray-body { padding: 8px 10px 10px; }
.tray-search { margin-bottom: 8px; padding: 5px 8px; font-size: 12px; }
.tray-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-height: 172px; overflow-y: auto; }
.tray-tile { aspect-ratio: 1; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #f3f4f7; overflow: hidden; cursor: grab; }
.tray-tile img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.tray-tile:hover { border-color: var(--focus); box-shadow: 0 0 0 2px rgba(59,111,216,.2); }
.tray-empty { grid-column: 1 / -1; margin: 4px 0; }

.share-new { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 4px; }
.share-new .check { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.cm-link-actions { align-items: center; flex-wrap: wrap; }
.cm-link-actions > .muted { margin-right: auto; }
.share-opts { display: flex; flex-direction: column; gap: 6px; }

.loc-hosts { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.7; }
.loc-status { font-weight: 600; margin: 0; }
.loc-bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.loc-fill { height: 100%; width: 0; background: var(--focus); transition: width .3s; }
.loc-fails { font-size: 12px; }
.loc-fails ul { margin: 6px 0 0; padding-left: 18px; max-height: 160px; overflow: auto; }
.loc-fails code { word-break: break-all; }
/* Bulk import */
.bulk-pick { display: flex; align-items: center; gap: 14px; justify-content: space-between; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; background: #f8f9fb; }
.bulk-pick-btns { display: flex; gap: 8px; flex: none; }
.bulk-facts { font-size: 15px; font-weight: 600; margin: 0; }
.bulk .check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.bulk-log { max-height: 220px; overflow: auto; font-size: 12px; font-family: ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.bulk-log:empty { display: none; }
.bulk-line { padding: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bulk-line.ok { color: #1d6b3d; } .bulk-line.bad { color: var(--danger); } .bulk-line.skip { color: var(--muted); }

.lib-head-right { display: flex; align-items: center; gap: 12px; }
.lib-sort { width: auto; padding: 5px 8px; font-size: 13px; }
.grid-more { grid-column: 1 / -1; text-align: center; padding: 20px 0; }
.thumb:empty { background: linear-gradient(180deg, #fff 0 38%, #f1f3f6 38% 100%); }

/* Multi-select */
.card-check { position: absolute; top: 10px; left: 10px; z-index: 2; width: 24px; height: 24px; border-radius: 6px; border: 2px solid #fff; background: rgba(29,36,51,.35); color: transparent; display: grid; place-items: center; padding: 0; cursor: pointer; opacity: 0; transition: opacity .12s; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.card:hover .card-check, body.selecting .card-check, .card-check:focus-visible { opacity: 1; }
.card.selected .card-check { background: #3b6fd8; border-color: #3b6fd8; color: #fff; }
.card.selected { outline: 2px solid #3b6fd8; outline-offset: -1px; }
body.selecting .thumb-copy { display: none; }
.sel-bar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 34px rgba(20,28,45,.22); min-width: 520px; }
.sel-bar[hidden] { display: none; }
.sel-n { font-weight: 700; white-space: nowrap; }
.sel-sp { flex: 1; }
.sel-bar .btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
body.selecting .toast { bottom: 96px; }
.media-thumb { user-select: none; -webkit-user-select: none; }

.flag-badge { display: inline-flex; align-items: center; gap: 2px; border: 0; cursor: pointer; font: inherit; font-size: 11px; font-weight: 700; background: #f2a541; color: #fff; border-radius: 4px; padding: 1px 6px; }
.flag-badge:hover { background: #e08a00; }
.flag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.flag-list li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.flag-note { margin: 6px 0 0; font-size: 14px; }

.clip-card { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: #eef4ff; border-bottom: 1px solid var(--line); font-size: 13px; }
.clip-card[hidden] { display: none; }
.clip-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---- Clean-up tools (duplicate emails, duplicate / unused images) ---- */
.dup-modal, .cl-modal { width: 860px; max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); display: flex; flex-direction: column; }
.dup-modal .modal-body, .cl-modal .modal-body { overflow: auto; min-height: 0; }
.dup-list { border: 1px solid var(--line); border-radius: var(--radius); max-height: 52vh; overflow: auto; margin: 12px 0; }
.dup-group { border-bottom: 1px solid var(--line); }
.dup-group:last-child { border-bottom: 0; }
.dup-group summary { padding: 10px 14px; cursor: pointer; list-style-position: inside; }
.dup-group summary:hover { background: var(--bg); }
.dup-name { font-weight: 600; }
.dup-rows { padding: 0 8px 8px; }
.dup-row { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 8px; }
.dup-row.is-keep { background: color-mix(in srgb, var(--focus) 9%, transparent); }
.dup-row.is-del .dup-title { text-decoration: line-through; color: var(--muted); }
.dup-main { flex: 1; min-width: 0; }
.dup-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.dup-title:hover { text-decoration: underline; }
.dup-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.dup-keep, .dup-del { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; }
.cl-section { margin-bottom: 22px; }
.cl-section h3 { margin: 0 0 4px; font-size: 15px; }
.cl-set { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin: 10px 0; }
.cl-set.off { opacity: .45; }
.cl-set-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; cursor: pointer; }
.cl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cl-card { display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; cursor: pointer; min-width: 0; }
.cl-card.is-keep { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.cl-card.is-del { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.cl-thumb { display: flex; align-items: center; justify-content: center; height: 96px; border-radius: 6px; background: repeating-conic-gradient(var(--bg) 0 25%, var(--panel) 0 50%) 0 0 / 14px 14px; overflow: hidden; }
.cl-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cl-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-pick { display: flex; align-items: center; gap: 4px; }
.cl-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.dup-modal > .modal-actions, .cl-modal > .modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dup-modal > .modal-actions .btn-danger { margin-right: 0; }
.badge.html { background: #fde4e2; color: #b42318; }
.badge.mjml { background: #dcf5e3; color: #17733a; }
.ext-flag { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; border: 1px solid #f3c27a; background: #fff4e0; color: #8a5a10; border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 600; }
.ext-flag:hover { background: #ffe9c4; }
.ext-flag[hidden] { display: none; }
.miss-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.miss-card { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; text-decoration: none; }
.miss-card img { width: 100%; height: 100px; object-fit: contain; background: var(--bg); border-radius: 4px; }
/* Layers: hover + selected indicators (rows also light up when hovering the block in the email) */
.gjs-layer-item { cursor: pointer; box-shadow: inset 3px 0 0 transparent; transition: background-color .12s, box-shadow .12s; }
.gjs-layer.gjs-hovered > .gjs-layer-item { background-color: color-mix(in srgb, var(--focus) 8%, var(--panel)) !important; box-shadow: inset 3px 0 0 color-mix(in srgb, var(--focus) 45%, transparent); }
.gjs-layer.gjs-hovered > .gjs-layer-item .gjs-layer-title, .gjs-layer.gjs-selected > .gjs-layer-item .gjs-layer-title { background-color: transparent !important; }
.gjs-layer.gjs-selected > .gjs-layer-item { background-color: color-mix(in srgb, var(--focus) 16%, var(--panel)) !important; box-shadow: inset 3px 0 0 var(--focus); }
.gjs-layer.gjs-selected > .gjs-layer-item .gjs-layer-name { color: var(--focus); font-weight: 600; }

/* ---- v2: account box (sidebar) and super admin Teams page ---- */
.acct { display: flex; align-items: center; gap: 9px; width: 100%; margin-top: 8px; padding: 7px 8px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; color: var(--ink); }
.acct:hover { background: #eef0f3; }
.acct-avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.acct-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acct-team { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr.is-off td { opacity: .6; }
.admin-table .right { text-align: right; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- v2 settings: members, usage meters, sub-sections ---- */
.members { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; }
.member { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: 0; }
.member.pending { background: var(--bg); }
.member-text { flex: 1; min-width: 0; font-size: 13px; }
.member-text .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-spacer { width: 28px; }
.acct-avatar.ghost { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.role-chip { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.role-chip.role-owner { background: #fde9cf; color: #8a5a10; }
.role-chip.role-admin { background: #e3ebff; color: #2f5bc2; }
.role-chip.role-editor { background: #dcf5e3; color: #17733a; }
.role-opts { display: flex; flex-direction: column; gap: 8px; }
.role-opt { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.usage { display: flex; flex-direction: column; gap: 6px; }
.usage-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 600; }
.meter { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; border: 1px solid var(--line); }
.meter-bar { height: 100%; background: var(--focus); border-radius: 999px; }
.meter.full .meter-bar { background: var(--danger); }
.set-sub { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.set-sub h3 { margin: 0; font-size: 14px; }
.own-storage[hidden] { display: none; }
/* Viewers: hide controls that would only be refused */
[data-role="viewer"] .edit-only, [data-role="viewer"] .sel-bar { display: none !important; }
[data-role="viewer"] .status-select { pointer-events: none; opacity: .7; }
.view-only-flag { font-size: 12px; font-weight: 600; color: var(--muted); border: 1px dashed var(--line); border-radius: 999px; padding: 4px 10px; }
.no-team { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; } .no-team .set-card { max-width: 420px; width: 100%; } .no-team h2 { margin: 0; font-size: 18px; }
.set-card > p { margin: 0; }

/* ---------- Color picker ---------- */
.cp-pop {
  position: fixed; z-index: 10000; width: 248px; padding: 12px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 12px 36px rgba(20, 28, 45, .18), 0 2px 6px rgba(20, 28, 45, .08);
  display: flex; flex-direction: column; gap: 10px; user-select: none;
}
.cp-area { position: relative; height: 148px; border-radius: 8px; cursor: crosshair; touch-action: none; overflow: visible; }
.cp-area-white, .cp-area-black { position: absolute; inset: 0; border-radius: 8px; pointer-events: none; }
.cp-area-white { background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0)); }
.cp-area-black { background: linear-gradient(to top, #000, rgba(0, 0, 0, 0)); }
.cp-knob, .cp-hue-knob {
  position: absolute; width: 16px; height: 16px; border-radius: 50%; transform: translate(-50%, -50%);
  border: 2.5px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25), 0 2px 6px rgba(0, 0, 0, .3); pointer-events: none;
}
.cp-hue {
  position: relative; height: 12px; border-radius: 6px; cursor: pointer; touch-action: none;
  background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}
.cp-hue-knob { top: 50%; }
.cp-row { display: flex; align-items: center; gap: 6px; }
.cp-chip, .cp-field-sw {
  width: 28px; height: 28px; flex: none; border-radius: 7px; border: 1px solid rgba(0, 0, 0, .12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}
.cp-none {
  background: linear-gradient(to top right, transparent calc(50% - 1px), var(--danger) calc(50% - 1px), var(--danger) calc(50% + 1px), transparent calc(50% + 1px)), var(--panel) !important;
}
.cp-hex {
  flex: 1; min-width: 0; height: 30px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px;
  font: 500 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); background: var(--panel); text-transform: lowercase;
}
.cp-hex:focus { outline: 2px solid color-mix(in srgb, var(--focus) 30%, transparent); border-color: var(--focus); }
.cp-tool {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 7px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2);
}
.cp-tool:hover { background: var(--bg); color: var(--ink); }
.cp-swatches { display: flex; flex-direction: column; gap: 6px; max-height: 210px; overflow: auto; }
.cp-swatches:empty { display: none; }
.cp-group-title { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.cp-group { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.cp-sw {
  aspect-ratio: 1; width: 100%; border-radius: 6px; border: 1px solid rgba(0, 0, 0, .12); padding: 0;
  transition: transform .08s;
}
.cp-sw:hover { transform: scale(1.12); }
.cp-sw.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--focus); }

/* Swatch + hex field used in Email settings */
.cp-field { display: flex; align-items: center; gap: 8px; }
.cp-field-sw { cursor: pointer; padding: 0; }
.cp-field-text { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Style panel color property (replaces GrapesJS's picker) */
.es-colorprop { display: flex; align-items: center; gap: 6px; width: 100%; }
.es-colorprop .cp-field-sw { width: 30px; height: 30px; }
.es-colorprop input {
  flex: 1; min-width: 0; height: 32px; border: 0; border-radius: 8px; padding: 0 10px; background: var(--bg);
  font: 500 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink);
}
.es-colorprop input:focus { outline: 2px solid color-mix(in srgb, var(--focus) 30%, transparent); }

/* Padding: link all four sides */
.es-pad-link {
  margin-left: auto; width: 26px; height: 22px; display: inline-grid; place-items: center; border-radius: 6px;
  border: 1px solid transparent; background: transparent; color: var(--muted); padding: 0; vertical-align: middle;
}
.es-pad-link:hover { background: var(--bg); color: var(--ink); }
.es-pad-link.on { color: var(--focus); background: color-mix(in srgb, var(--focus) 12%, transparent); border-color: color-mix(in srgb, var(--focus) 35%, transparent); }
.gjs-sm-property__padding.es-linked .gjs-sm-composite { outline: 1.5px solid color-mix(in srgb, var(--focus) 45%, transparent); }

/* =====================================================================
   Editor polish (top bar, canvas bar, toolbar, breadcrumb, panels)
   ===================================================================== */
/* Top bar */
.editor-bar .btn { display: inline-flex; align-items: center; gap: 6px; }
.editor-bar .btn .ic { flex: none; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg); border-color: transparent; }
.editor-bar .btn-icon { padding: 7px 8px; }
.editor-bar .btn-primary .ic-chevronDown, .editor-bar .btn .ic-chevronDown { margin-left: -2px; opacity: .75; }
.save-status {
  border: 0; background: transparent; padding: 4px 8px; border-radius: 6px; font-size: 12px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
}
.save-status:hover { background: var(--bg); color: var(--ink-2); }
.save-status.saved::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #2f9e6b; }
.save-status.dirty::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.undo-redo { display: flex; gap: 2px; padding-left: 6px; margin-left: 2px; border-left: 1px solid var(--line); }
.undo-redo .icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }

/* Canvas bar */
.ed-canvas .gjs-pn-panel.gjs-pn-options, .ed-canvas .gjs-pn-panel.gjs-pn-devices-c { padding: 6px 8px; }
.ed-canvas .gjs-pn-options { display: flex; align-items: center; gap: 2px; }
.ed-canvas .gjs-pn-options .gjs-pn-buttons { display: flex; gap: 2px; }
.gjs-pn-btn.es-pn-ic { display: inline-grid; place-items: center; width: 30px; height: 28px; padding: 0; color: var(--ink-2); font-size: 0; }
.gjs-pn-btn.es-pn-ic svg { width: 17px; height: 17px; fill: none !important; }
.gjs-pn-btn.es-pn-ic:hover { background: var(--bg); color: var(--ink); }
.gjs-pn-btn.es-pn-ic.gjs-pn-active { background: color-mix(in srgb, var(--focus) 12%, transparent); color: var(--focus); }
.es-zoom { display: inline-flex; align-items: center; gap: 0; margin-right: 6px; padding-right: 8px; border-right: 1px solid var(--line); }
.es-zoom-btn, .es-zoom-val { border: 0; background: transparent; color: var(--ink-2); border-radius: 6px; height: 28px; }
.es-zoom-btn { width: 28px; display: inline-grid; place-items: center; }
.es-zoom-val { min-width: 46px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.es-zoom-btn:hover, .es-zoom-val:hover { background: var(--bg); color: var(--ink); }

/* Selection toolbar on the canvas */
.gjs-toolbar { background: var(--ink) !important; border-radius: 8px !important; padding: 2px !important; box-shadow: 0 4px 14px rgba(20, 28, 45, .25); }
.gjs-toolbar-item { width: 28px !important; height: 26px !important; display: inline-grid !important; place-items: center; border-radius: 6px; padding: 0 !important; color: #fff; }
.gjs-toolbar-item:hover { background: rgba(255, 255, 255, .14); }
.gjs-toolbar-item svg { width: 15px; height: 15px; display: block; fill: none !important; }
.gjs-toolbar-item.es-tb.fa-trash-o:hover, .gjs-toolbar-item[title="Delete"]:hover { background: var(--danger); }
.gjs-badge { background: var(--ink) !important; border-radius: 5px !important; padding: 2px 7px !important; font: 600 11px/16px ui-sans-serif, -apple-system, sans-serif !important; }

/* Selection header + breadcrumb */
.crumbs-path { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: -2px 0 2px -4px; }
.crumbs-path:empty { display: none; }
.crumb { border: 0; background: transparent; padding: 2px 4px; border-radius: 5px; font-size: 11.5px; color: var(--muted); }
.crumb:not(:disabled):hover { background: var(--bg); color: var(--ink); }
.crumb.on { color: var(--ink-2); font-weight: 600; cursor: default; }
.crumb-sep { color: var(--line); font-size: 12px; }
html[data-theme="dark"] .crumb-sep { color: #4e5564; }

/* Advanced (Id, Title, CSS class) */
.adv-sector { border-top: 1px solid var(--line); }
.adv-sector > summary { list-style: none; cursor: pointer; padding: 11px 14px; font-size: 12px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.adv-sector > summary::-webkit-details-marker { display: none; }
.adv-sector > summary::before { content: ''; border: 4px solid transparent; border-left-color: currentColor; margin-right: 2px; transition: transform .12s; }
.adv-sector[open] > summary::before { transform: rotate(90deg) translateX(2px); }
.adv-body { padding: 0 0 12px; }

/* Icon segmented control */
.es-seg { display: flex; width: 100%; background: var(--bg); border-radius: 8px; padding: 2px; gap: 2px; }
.es-seg-btn { flex: 1; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); display: inline-grid; place-items: center; padding: 0; position: relative; }
.es-seg-btn:hover { color: var(--ink); background: color-mix(in srgb, var(--panel) 60%, transparent); }
.es-seg-btn.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 28, 45, .12), 0 0 0 1px var(--line); }
.es-seg-btn.inherited:not(.on)::after { content: ''; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }

/* Inherited values: faded hints in empty fields */
.ed-side .gjs-sm-property input::placeholder { color: var(--muted); opacity: .75; }
.cp-field-sw.cp-inherited { opacity: .55; border-style: dashed; }

/* Drag a number label to change the value */
.ed-side .gjs-sm-property.gjs-sm-number > .gjs-sm-label { cursor: ew-resize; user-select: none; }
body.es-scrubbing, body.es-scrubbing * { cursor: ew-resize !important; user-select: none !important; }

/* Padding box */
.ed-side .gjs-sm-property__padding .gjs-sm-composite { background: transparent; border: 0; padding: 0; }
.ed-side .gjs-sm-property__padding .gjs-sm-properties {
  display: grid !important; grid-template-columns: 1fr 64px 1fr; grid-template-rows: auto auto auto;
  grid-template-areas: ". t ." "l c r" ". b ."; align-items: center; justify-items: center; gap: 4px;
  padding: 10px 8px !important; border: 1.5px dashed color-mix(in srgb, var(--focus) 40%, var(--line)); border-radius: 10px;
  background: color-mix(in srgb, var(--focus) 4%, transparent);
}
.ed-side .gjs-sm-property__padding .gjs-sm-properties > .gjs-sm-property { width: 72px !important; margin: 0 !important; padding: 0 !important; }
.ed-side .gjs-sm-property__padding-top { grid-area: t; }
.ed-side .gjs-sm-property__padding-right { grid-area: r; }
.ed-side .gjs-sm-property__padding-bottom { grid-area: b; }
.ed-side .gjs-sm-property__padding-left { grid-area: l; }
.ed-side .gjs-sm-property__padding .gjs-sm-properties > .gjs-sm-property > .gjs-sm-label { display: none; }
.ed-side .gjs-sm-property__padding .gjs-sm-properties .gjs-field { text-align: center; }
.ed-side .gjs-sm-property__padding .gjs-sm-properties .gjs-field input { text-align: center; padding-right: 0; }
.ed-side .gjs-sm-property__padding .gjs-sm-properties .gjs-field-units { display: none; }
.es-pad-center {
  grid-area: c; width: 64px; height: 36px; display: grid; place-items: center; border-radius: 6px;
  background: var(--panel); border: 1px solid var(--line);
}
.es-pad-link { width: 30px; height: 26px; display: inline-grid; place-items: center; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--muted); padding: 0; }
.es-pad-link:hover { background: var(--bg); color: var(--ink); }
.es-pad-link.on { color: var(--focus); background: color-mix(in srgb, var(--focus) 12%, transparent); border-color: color-mix(in srgb, var(--focus) 35%, transparent); }
.gjs-sm-property__padding.es-linked .gjs-sm-properties { border-style: solid; }
.gjs-sm-property__padding.es-linked .gjs-sm-composite { outline: 0; }
.es-pad-presets { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.es-pad-presets-l { font-size: 11px; color: var(--muted); margin-right: 2px; }
.es-pad-preset { flex: 1; height: 24px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font-size: 11.5px; font-weight: 500; color: var(--ink) !important; padding: 0; font-variant-numeric: tabular-nums; }
.es-pad-preset:hover { border-color: var(--focus); color: var(--focus); }

/* Blocks panel */
.ed-side .gjs-blocks-c { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 12px 14px; }
.ed-side .gjs-block {
  width: auto !important; min-height: 0 !important; margin: 0 !important; padding: 8px 6px 7px !important;
  display: flex; flex-direction: column; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.ed-side .gjs-block:hover { border-color: color-mix(in srgb, var(--focus) 55%, var(--line)); box-shadow: 0 4px 14px rgba(20, 28, 45, .08); transform: translateY(-1px); }
.ed-side .gjs-block__media { width: 100%; display: grid; place-items: center; }
.ed-side .gjs-block svg.blk-thumb { width: 100%; max-width: 72px; height: auto; aspect-ratio: 64 / 44; }
.blk-thumb .b { fill: var(--bg); stroke: color-mix(in srgb, var(--ink-2) 35%, transparent); stroke-width: 1; }
.blk-thumb .o { fill: none; stroke: color-mix(in srgb, var(--ink-2) 40%, transparent); stroke-width: 1; stroke-dasharray: 3 2; }
.blk-thumb .l { fill: color-mix(in srgb, var(--ink-2) 40%, transparent); }
.blk-thumb .d { fill: var(--ink-2); }
.blk-thumb .a { fill: var(--focus); }
.blk-thumb .w { fill: #fff; }
.blk-thumb .img { fill: color-mix(in srgb, var(--focus) 35%, #9fb4d9); stroke: none; }
.blk-thumb .s { fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ed-side .gjs-block-label { font-size: 11px; line-height: 1.2; text-align: center; color: var(--ink-2); }

/* Command palette */
.pal-back { position: fixed; inset: 0; z-index: 10001; background: rgba(20, 28, 45, .28); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
.pal { width: min(560px, 92vw); max-height: 64vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px rgba(20, 28, 45, .3); overflow: hidden; }
.pal-search { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; padding: 15px 0; color: var(--ink); }
.pal-list { overflow: auto; padding: 6px; }
.pal-item { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; text-align: left; color: var(--ink); }
.pal-item.on { background: color-mix(in srgb, var(--focus) 11%, transparent); }
.pal-grp { width: 84px; flex: none; font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-label { flex: 1; font-size: 13.5px; }
.pal-item kbd { font: 600 11px/1 ui-monospace, Menlo, monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 3px 5px; }
.pal-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }

/* Raw HTML code editor (Design panel) */
.raw-editor { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.raw-editor[hidden] { display: none; }
.raw-head { display: flex; align-items: center; gap: 8px; }
.raw-title { font-size: 12px; font-weight: 700; }
.raw-note { font-size: 11px; color: #a26a12; margin-right: auto; }
.raw-area { width: 100%; min-height: 240px; resize: vertical; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2; white-space: pre; }
.raw-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* One-to-one email: Copy for Gmail / Outlook, Send to one person, Create Gmail draft */
.oto-modal { width: 500px; }
.oto-modal .field small { font-weight: 400; }
.oto-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.oto-check input { margin: 0; accent-color: var(--focus); }
.oto-warn { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid #f0d49b; background: #fff8ea; border-radius: 8px; color: #6b4a0f; font-size: 13px; }
.oto-warn .oto-check { color: #6b4a0f; }
.oto-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.oto-tags code { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: #fdecc8; border-radius: 4px; padding: 1px 6px; color: #5a3d07; }
.oto-err { color: var(--danger); font-size: 13px; }
.oto-err[hidden] { display: none; }
.modal-body p.oto-meta { color: var(--ink-2); }
.modal-body p.oto-note { color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.oto-flags { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.oto-flags li { display: flex; flex-direction: column; gap: 2px; padding-left: 12px; border-left: 3px solid var(--accent); }
.oto-flags strong { font-size: 13px; }

/* ---------- Signatures ---------- */
.sig-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -6px 0 20px; }
.sig-tab { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.sig-tab:hover { color: var(--ink); }
.sig-tab.on { color: var(--ink); border-bottom-color: var(--ink); }
.sig-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.sig-thumb { display: block; position: relative; height: 170px; overflow: hidden; background: #ffffff; border-bottom: 1px solid var(--line); cursor: pointer; }
.sig-thumb iframe { width: 620px; height: 340px; border: 0; transform: scale(.48); transform-origin: 0 0; pointer-events: none; background: #ffffff; }
.sig-card .card-meta .chip { max-width: none; }
.sig-empty-state h2 { color: var(--ink); margin: 10px 0 4px; font-size: 18px; }
.sig-empty-icon { color: #b6bcc8; }
.sig-start-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.sig-start-thumb { background: #ffffff; border: 1px solid var(--line); }
.sig-start-thumb iframe { width: 100%; height: 100%; transform: none; }
.sig-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.sig-toolbar .search { width: 220px; }
.sig-toolbar select.input { width: auto; }
.sig-count { white-space: nowrap; }
.sig-selbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px 8px 14px; margin-bottom: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.sig-selbar[hidden] { display: none; }
.sig-selbar .btn { display: inline-flex; align-items: center; gap: 6px; }
.sig-table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.sig-people { min-width: 900px; }
.sig-people td { padding: 4px 6px; }
.sig-people th:first-child, .sig-people td:first-child { padding-left: 12px; }
.sig-people .c-check { width: 30px; }
.sig-people .c-photo { width: 44px; }
.cell-in { width: 100%; min-width: 90px; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 6px 7px; font: inherit; color: var(--ink); resize: none; }
.cell-in:hover:not([readonly]):not([disabled]) { border-color: var(--line); }
.cell-in:focus { outline: none; border-color: var(--focus); background: var(--panel); }
.cell-in.saved { border-color: #7cc79a; }
select.cell-in { min-width: 130px; }
.sig-avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); display: grid; place-items: center; padding: 0; overflow: hidden; color: var(--muted); }
.sig-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chip.sig-status { max-width: none; white-space: nowrap; }
.sig-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sig-photo-prev { width: 120px; height: 120px; border-radius: 10px; background: var(--bg); display: grid; place-items: center; color: var(--muted); overflow: hidden; border: 1px solid var(--line); }
.sig-photo-prev img { width: 100%; height: 100%; object-fit: cover; }
.sig-field-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr auto; gap: 8px; align-items: center; }
.sig-map td { padding: 6px 8px; }
.sig-changes { max-width: 820px; }
.sig-change-head { font-size: 15px; }
.sig-diff { border-collapse: collapse; font-size: 13px; width: 100%; }
.sig-diff th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 10px 6px 0; width: 120px; vertical-align: top; }
.sig-diff td { padding: 6px 8px; vertical-align: top; white-space: pre-line; }
.sig-diff td.old { color: var(--ink-2); text-decoration: line-through; text-decoration-color: #c9ced8; }
.sig-diff td.new { font-weight: 600; }
.sig-diff td.arrow { color: var(--muted); width: 20px; }
.sig-diff img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.sig-prev-stage { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #ffffff; }
.sig-preview-frame { display: block; width: 100%; border: 0; min-height: 200px; background: #ffffff; }
.sig-set-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 2px; }
.sig-settings { gap: 10px; }
.sig-settings .sig-set-h:first-child { margin-top: 2px; }
.sig-locks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sig-banner-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sig-banner-list li { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px; align-items: center; font-size: 12px; }
.sig-banner-list img { width: 70px; height: 34px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); }
.sig-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; max-height: 200px; overflow-y: auto; }
.sig-pick-grid .tray-tile.on { outline: 2px solid var(--focus); }
.sig-ai-thumb { max-width: 100%; max-height: 180px; border-radius: 8px; border: 1px solid var(--line); align-self: flex-start; }
.sig-ai .segmented { align-self: flex-start; }
.sig-canvas { background: #f1f2f5; }
.sig-preview-pane { position: absolute; left: 0; right: 0; top: 40px; bottom: 0; z-index: 5; overflow: auto; background: var(--bg); padding: 18px 24px; }
.sig-preview-pane[hidden] { display: none; }
.sig-preview-pane .sig-preview-frame { border: 1px solid var(--line); border-radius: 10px; max-width: 900px; }
.sig-mode-note { margin: 0 0 10px; }
.sig-modes { margin: 0; }
.sig-modes .seg { padding: 4px 10px; font-size: 12px; }
.ed-canvas .gjs-pn-commands { display: flex; align-items: center; padding: 6px 8px; }
.sig-person-sel { max-width: 200px; }
.sig-flag { background: #e6eefc; color: #2c55a8; }
.sig-social-edit { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; width: 100%; }
.sig-social-head { font-weight: 600; color: var(--ink-2); font-size: 12px; }
.sig-social-row { display: grid; grid-template-columns: 96px 1fr 24px; gap: 4px; align-items: center; }
.sig-social-row .es-input { min-width: 0; }
.ed-side .gjs-trt-trait--sig-social { flex-direction: column; align-items: stretch; }
@media (max-width: 760px) { .sig-form-grid, .sig-field-row { grid-template-columns: 1fr; } }
.ed-side .gjs-block svg.ic { fill: none; width: 26px; height: 26px; color: var(--ink-2); }
.sig-blocks-hint { margin: 8px 12px 0; }
.sig-more { margin: 0; padding: 8px 12px; border-top: 1px solid var(--line); }

/* Setup guides in Settings */
.set-guide { border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--focus) 4%, var(--panel)); margin: 4px 0 6px; }
.set-guide > summary { cursor: pointer; list-style: none; padding: 10px 14px; font-weight: 600; font-size: 13px; color: var(--focus); display: flex; align-items: center; gap: 8px; }
.set-guide > summary::-webkit-details-marker { display: none; }
.set-guide > summary::before { content: ''; border: 4px solid transparent; border-left-color: currentColor; transition: transform .12s; margin-right: 2px; }
.set-guide[open] > summary::before { transform: rotate(90deg) translateX(2px); }
.set-guide[hidden] { display: none; }
.guide-steps { margin: 0; padding: 0 16px 12px 36px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 1.5; color: var(--ink); }
.guide-steps ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.guide-steps code, .guide-note code { font: 12px ui-monospace, Menlo, monospace; background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.guide-link { color: var(--focus); font-weight: 600; text-decoration: none; white-space: nowrap; }
.guide-link:hover { text-decoration: underline; }
.guide-note { padding: 0 16px 12px; margin: 0; }
.guide-snippet { margin: 8px 0 2px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.guide-snippet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 10px; font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--line); }
.guide-pre { margin: 0; padding: 10px; font: 11.5px/1.45 ui-monospace, Menlo, monospace; white-space: pre; overflow: auto; max-height: 220px; }
.guide-pick { max-width: 420px; }
.guide-pick .es-seg-btn { font-size: 13px; font-weight: 500; padding: 0 10px; }

/* Sending: choose one service */
.send-choose { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; display: flex; flex-direction: column; gap: 6px; }
.send-choose h3 { margin: 0; font-size: 14px; }
.send-choose p { margin: 0 0 4px; }
.send-pane[hidden] { display: none; }
.send-pane { border-top: 0; padding-top: 4px; }
.send-tab-badge { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; font-size: 11px; font-weight: 600; color: #2f9e6b; }
.sig-card { cursor: pointer; transition: box-shadow .12s, transform .12s, border-color .12s; }
.sig-card:hover { box-shadow: 0 6px 20px rgba(20, 28, 45, .1); transform: translateY(-1px); }
.sig-card .card-body .icon-btn { cursor: pointer; }
.es-note { font-size: 11.5px; line-height: 1.45; color: var(--muted); margin: -2px 0 8px; }

/* Text and drawn-line options in segmented controls */
.es-seg-btn .es-seg-txt { font-size: 12px; font-weight: 500; padding: 0 4px; white-space: nowrap; }
.es-seg-btn svg { display: block; }
.es-seg-btn:has(.es-seg-txt) { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.es-trait-seg { max-width: 100%; }
.traits .gjs-trt-trait .es-trait-seg { flex: 1; }

/* On/off traits (e.g. Full width) as switches */
.traits .gjs-field-checkbox { background: none !important; border: 0 !important; padding: 0 !important; width: auto !important; }
.traits .gjs-field-checkbox input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; display: inline-block !important; position: relative; width: 34px; height: 20px; margin: 0;
  border-radius: 999px; background: var(--line); cursor: pointer; transition: background .15s; opacity: 1 !important;
}
.traits .gjs-field-checkbox input[type="checkbox"]::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s;
}
.traits .gjs-field-checkbox input[type="checkbox"]:checked { background: var(--focus); }
.traits .gjs-field-checkbox input[type="checkbox"]:checked::after { transform: translateX(14px); }
.traits .gjs-field-checkbox input[type="checkbox"]:focus-visible { outline: 2px solid color-mix(in srgb, var(--focus) 40%, transparent); outline-offset: 2px; }
.traits .gjs-field-checkbox .gjs-chk-icon { display: none !important; }

/* Layers: "open in Design" button beside the move handle */
.es-layer-inspect { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .12s, background .12s, color .12s; }
.gjs-layer-item:hover .es-layer-inspect, .gjs-layer.gjs-selected > .gjs-layer-item .es-layer-inspect { opacity: 1; }
.es-layer-inspect:hover { background: #e8eefc; color: #2f5fd0; }

/* Design → Text → Paragraph spacing */
.es-pspace { display: flex; align-items: center; width: 100%; box-sizing: border-box; }
.es-pspace .gjs-input-holder { flex: 1; min-width: 0; }
.es-pspace input::placeholder { color: var(--muted); }
.es-pspace-unit { color: var(--muted); font-size: 12px; padding: 0 10px 0 2px; }

/* Design → link → Remove link */
.es-unlink-btn { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 4px; }
.ed-side .gjs-field.gjs-field-es-unlink, .gjs-field.gjs-field-es-unlink, .ed-side .gjs-field.gjs-field-es-open-text, .gjs-field.gjs-field-es-open-text { background: none; border: 0; box-shadow: none; padding: 0; }

.es-open-text-btn { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 4px; }

/* Large text editor */
.modal.te-modal .modal-body { padding-top: 6px; }
.te { display: flex; flex-direction: column; gap: 8px; }
.te-head { position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.te-tools { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.te-tools.off { opacity: .4; pointer-events: none; }
.te-btn { display: grid; place-items: center; width: 32px; height: 30px; border: 0; border-radius: 7px; background: none; color: var(--ink-2); cursor: pointer; }
.te-btn:hover { background: #eef1f6; color: var(--ink); }
.te-btn.on { background: #e3ebfb; color: #2f5fd0; }
.te-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.te-format { height: 30px; border: 0; border-radius: 7px; background: #f1f3f7; color: var(--ink); padding: 0 8px; font: inherit; font-size: 13px; margin-right: 4px; }
.te-stage { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f4f4f4; }
.te-frame { display: block; width: 100%; height: min(62vh, 640px); border: 0; }
.te-source { display: block; width: 100%; height: min(62vh, 640px); border: 0; border-radius: 0; resize: none; padding: 14px 16px; box-sizing: border-box; }
.te-note { margin: 0; }
.te-link { position: absolute; z-index: 20; top: 44px; width: 340px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.te-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.te-link-actions { display: flex; align-items: center; gap: 6px; }
.te-link-actions .btn { display: inline-flex; align-items: center; gap: 4px; }

/* Ask Claude: the ✦ button on each element's toolbar, and answers in the dialog */
.gjs-toolbar-item.es-tb-ai, .es-tb.es-tb-ai { color: #f2b25c; }
/* While text is being edited, the text toolbar takes the block toolbar's place. */
.es-rte-on .gjs-toolbar { display: none !important; }
.ai-answer { padding: 10px 12px; border-radius: 10px; background: #f6f3ff; border: 1px solid #e4dcff; font-size: 14px; line-height: 1.5; }

/* ---------- Claude chat drawer (right side of the editor) */
.chat-drawer { width: 380px; flex: none; display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); }
.chat-drawer[hidden] { display: none; }
.chat-drawer.drop { outline: 2px dashed #6c97f0; outline-offset: -6px; }
.chat-head { display: flex; align-items: center; gap: 2px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); flex: none; }
.chat-title { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-title .ic { color: #e2a03f; }
.chat-usage { margin-left: 4px; white-space: nowrap; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 16px; }
.chat-msg { display: flex; flex-direction: column; gap: 6px; }
.chat-msg.user { align-items: flex-end; }
.chat-who { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); }
.chat-who .ic { color: #e2a03f; }
.chat-bubble { max-width: 88%; padding: 8px 12px; border-radius: 14px 14px 4px 14px; background: #e8eefc; color: var(--ink); font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.user:not(.mine) .chat-bubble { background: #f1f3f6; }
.chat-md { font-size: 14px; line-height: 1.55; color: var(--ink); overflow-wrap: anywhere; }
.chat-md p, .chat-md ul, .chat-md ol { margin: 0 0 8px; }
.chat-md > :last-child { margin-bottom: 0; }
.chat-md ul, .chat-md ol { padding-left: 20px; }
.chat-md li { margin-bottom: 3px; }
.chat-md code { font: 12px ui-monospace, Menlo, monospace; background: #f1f3f6; border-radius: 4px; padding: 1px 4px; }
.chat-imgs { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.chat-imgs img { max-width: 150px; max-height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.chat-card { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 1px 2px rgba(20,28,45,.06), 0 4px 14px rgba(20,28,45,.06); }
.chat-card.applied { background: #f2faf5; border-color: #cde8d7; box-shadow: none; }
.chat-card.discarded { opacity: .55; box-shadow: none; }
.chat-card-top { display: flex; align-items: center; gap: 8px; }
.chat-card-kind { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #2f5fd0; }
.chat-card-top .link { margin-left: auto; }
.chat-card-sum { font-size: 14px; font-weight: 500; line-height: 1.4; color: var(--ink); }
.chat-card-val { font-size: 13px; color: var(--ink); }
.chat-card-actions { display: flex; gap: 6px; margin-top: 2px; }
.chat-card-status { font-size: 12px; color: var(--muted); }
.chat-card-status.applied { color: #1a8a4a; font-weight: 600; }
.chat-typing { display: flex; gap: 4px; padding: 6px 0; }
.chat-typing i { width: 7px; height: 7px; border-radius: 50%; background: #b4bccb; animation: chatdot 1.2s infinite ease-in-out; }
.chat-typing i:nth-child(2) { animation-delay: .15s; } .chat-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes chatdot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-empty { display: flex; flex-direction: column; gap: 12px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.chat-empty p { margin: 0; }
.chat-suggest { display: flex; flex-direction: column; gap: 6px; }
.chat-sugg { text-align: left; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.chat-sugg:hover { background: #f4f6fa; border-color: #d5dbe6; }
.chat-compose { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat-input { width: 100%; box-sizing: border-box; resize: none; max-height: 180px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font: inherit; font-size: 14px; line-height: 1.4; }
.chat-input:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.chat-compose-foot { display: flex; align-items: center; gap: 8px; }
.chat-hint { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chat-chips[hidden] { display: none; }
.chat-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 4px 3px 10px; border-radius: 999px; background: #e8eefc; color: #2f5fd0; font-size: 12px; font-weight: 600; }
.chat-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-chip .muted { font-weight: 400; }
.chat-chip-x { display: grid; place-items: center; width: 18px; height: 18px; flex: none; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.chat-chip-x:hover { background: rgba(47,95,208,.14); }
.chat-thumb { position: relative; display: inline-block; }
.chat-thumb img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.chat-thumb .chat-chip-x { position: absolute; top: -7px; right: -7px; background: #1d2433; color: #fff; }

.chat-convert { flex: none; display: flex; flex-direction: column; gap: 8px; margin: 12px 12px 0; padding: 10px 12px; border: 1px solid #f0d9a8; border-radius: 10px; background: #fdf6e7; font-size: 13px; line-height: 1.45; color: var(--ink); }
.chat-convert[hidden] { display: none; }
.chat-convert .btn { align-self: flex-start; }

.chat-pending { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; border-radius: 10px; background: #eef3fd; border: 1px solid #d6e2fb; font-size: 13px; line-height: 1.4; color: var(--ink); }
.chat-pending > span { flex: 1; }
.chat-pending .btn { flex: none; }

/* ---------- Phone (≤ 700px). Everything below is phone-only; desktop never sees it. ---------- */
.m-only, .m-backdrop { display: none; }
@media (max-width: 700px) {
  /* Top bar */
  .topbar { gap: 8px; padding: 0 10px; height: 54px; }
  .m-nav-btn { display: grid; place-items: center; width: 38px; height: 38px; flex: none; margin-right: -2px; }
  .is-library .brand { font-size: 0; gap: 0; flex: none; }
  .search { margin-left: 0; min-width: 0; max-width: none; flex: 1; }
  .search input { font-size: 16px; } /* 16px stops iPhone zooming in on focus */
  .is-library .topbar-actions { gap: 6px; flex: none; margin-left: 0; }
  .is-library .topbar-actions .btn:not(.btn-primary) { display: none; }
  .is-library .topbar-actions .btn-primary { padding: 8px 12px; white-space: nowrap; }
  input.input, select.input, textarea.input, .modal input, .modal select, .modal textarea { font-size: 16px; }

  /* Sidebar → slide-out drawer */
  .sidebar { position: fixed; z-index: 950; top: 0; bottom: 0; left: 0; width: min(300px, 84vw); padding: 18px 10px calc(18px + env(safe-area-inset-bottom));
    transform: translateX(-102%); transition: transform .22s ease, box-shadow .22s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(20,28,45,.28); }
  .m-backdrop { display: block; position: fixed; inset: 0; z-index: 940; background: rgba(20,28,45,.38); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .m-nav-backdrop, body.m-sheet .m-sheet-backdrop { opacity: 1; pointer-events: auto; }
  .nav-item, .tree-row { min-height: 44px; font-size: 15px; }
  .tree-row .row-menu { opacity: 1; }
  .es-layer-inspect { opacity: 1; }

  /* Library and other pages */
  .lib-main { padding: 18px 14px calc(96px + env(safe-area-inset-bottom)); }
  .lib-head { flex-wrap: wrap; align-items: flex-start; gap: 12px; }
  .lib-head h1 { font-size: 22px; }
  .lib-head-right { flex-wrap: wrap; }
  .filters { flex-wrap: nowrap; overflow-x: auto; margin: -4px -14px 16px; padding: 0 14px 4px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filters > * { flex: none; white-space: nowrap; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .thumb-wrap { height: 220px; }
  .card:hover, .sig-card:hover { transform: none; }
  .sig-grid { grid-template-columns: 1fr; }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .sel-bar { min-width: 0; left: 8px; right: 8px; transform: none; bottom: calc(10px + env(safe-area-inset-bottom)); flex-wrap: wrap; padding: 10px 12px; }
  .row2, .row3, .media-detail, .ie, .hist, .md { grid-template-columns: 1fr; }
  .hist { height: auto; }

  /* Dialogs rise from the bottom; menus get finger-sized rows */
  .modal-backdrop { padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); place-items: end center; }
  .modal, .modal-wide, .modal.modal-xl, .modal.md-modal { width: 100%; max-height: 88vh; }
  .modal-actions { flex-wrap: wrap; }
  .menu { max-width: calc(100vw - 16px); }
  .menu-item { padding: 11px 12px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* Editors: preview first, trimmed top bar, side panel as a bottom sheet */
  .editor-bar { gap: 4px; padding: 0 6px; }
  .editor-bar .name-input { min-width: 0; flex: 1; font-size: 15px; }
  .editor-bar .tmpl-flag, .editor-bar .undo-redo, .editor-bar .save-status, .editor-bar .status-select, .editor-bar .ext-flag,
  .editor-bar [title^="Commands"], .editor-bar [title="Version history"], .editor-bar [title="Pre-send checks"],
  .editor-bar [title="Signature checks"] { display: none; }
  .editor-bar .topbar-actions { gap: 4px; flex: none; margin-left: 0; }
  .editor-bar .topbar-actions .btn:not(.m-keep-label) { font-size: 0; gap: 0; padding: 8px 10px; }
  .editor-bar .topbar-actions .btn:not(.m-keep-label) .ic ~ .ic { display: none; } /* drop the ▾ next to an icon */
  .editor-bar .topbar-actions .m-keep-label { padding: 8px 10px; }
  .editor-bar .view-only-flag { display: none; }
  .ed-side { position: fixed; z-index: 950; left: 0; right: 0; bottom: 0; width: auto; height: 64vh; border-left: 0;
    border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgba(20,28,45,.22); padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(105%); transition: transform .24s ease; }
  body.m-sheet .ed-side { transform: none; }
  .ed-side .tabs { overflow-x: auto; scrollbar-width: none; }
  .ed-side .gjs-blocks-c { grid-template-columns: repeat(4, 1fr); }
  .m-sheet-btn { display: inline-flex; align-items: center; gap: 7px; position: fixed; z-index: 960; left: 50%; transform: translateX(-50%);
    bottom: calc(18px + env(safe-area-inset-bottom)); padding: 11px 20px; border: 0; border-radius: 999px;
    background: var(--ink); color: var(--panel); font: 600 15px/1 inherit; box-shadow: 0 8px 26px rgba(20,28,45,.3); }
  body.m-sheet .m-sheet-btn { bottom: calc(64vh + 12px); }
  body:has(.modal-backdrop) .m-sheet-btn, body:has(.modal-backdrop) .m-tip { display: none; }
  .m-tip { display: flex; align-items: center; gap: 8px; position: fixed; z-index: 930; left: 10px; right: 10px; top: 62px;
    padding: 10px 8px 10px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line);
    box-shadow: var(--shadow); font-size: 13px; line-height: 1.4; color: var(--ink-2); }
  .m-tip span { flex: 1; }
  .chat-drawer { position: fixed; z-index: 975; inset: 0; width: auto; border: 0; padding-bottom: env(safe-area-inset-bottom); }
  body.chat-open .m-sheet-btn, body.chat-open .m-tip { display: none; }
  .chat-input { font-size: 16px; }
  .te-tools { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  .te-frame, .te-source { height: 52vh; }
  .ed-canvas .gjs-pn-options [title*="Outline"], .ed-canvas .gjs-pn-options [title*="ullscreen"] { display: none; }
}/* Freeform signatures: tabs, sharing */
.sig-tabs-sp { flex: 1; }
.sig-tab-adv { color: var(--muted); font-weight: 500; }
.sig-tab-adv .adv-tag { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.sig-card .card-title-row .sig-share-btn { margin-left: auto; }
.sig-card .card-title-row .sig-share-btn + .icon-btn { margin-left: 0; }
.sig-share { gap: 12px; }
.sig-share p { margin: 0; }
.sig-share-row { display: flex; gap: 8px; }
.sig-share-row .input { flex: 1; min-width: 0; font-size: 12.5px; }
.sig-share-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; line-height: 1.5; }
.sig-share-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sig-share-actions a.btn { text-decoration: none; }
.sig-share-label { margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; font-size: 11px; font-weight: 600; }
.sig-share-prev { width: 100%; height: 180px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.sig-share-warn { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: #fff6e0; color: #6b4e00; font-size: 12.5px; line-height: 1.45; }
.sig-share-warn svg { flex: none; margin-top: 2px; }
.danger-text { color: #c53030; }
.sig-person-photo { display: flex; align-items: center; gap: 12px; }
.sig-person-photo-label { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.sig-avatar.lg { width: 56px; height: 56px; }
.sig-new-details { margin-top: 2px; }

/* Varies per person: designer box and the People list on a signature */
.btn[hidden] { display: none; }
.var-box { margin: 10px 14px 4px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); display: flex; flex-direction: column; gap: 8px; }
.var-box[hidden] { display: none; }
.var-box p { margin: 0; }
.var-box .var-btn { align-self: flex-start; }
.var-title { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.var-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.var-now { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); word-break: break-word; }
.modal.modal-xwide { width: min(1100px, 96vw); max-width: none; }
.sig-list { display: flex; flex-direction: column; gap: 12px; }
.sig-list p { margin: 0; }
.sig-list-table { width: 100%; border-collapse: collapse; }
.sig-list-table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 8px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sig-list-table td { padding: 4px 3px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sig-list-table tr:last-child td { border-bottom: 0; }
.sig-list-table .c-img { width: 48px; text-align: center; }
.sig-list-table .cell-in { min-width: 150px; }
.sig-list-table .c-act { white-space: nowrap; text-align: right; padding-right: 8px; }
.sig-list-table .c-act .btn { margin-right: 2px; }
.sig-list-img { cursor: pointer; width: 34px; height: 34px; }
.sig-list-foot { display: flex; align-items: center; gap: 8px; }
.sig-list-empty { padding: 26px 18px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }
.sig-list-empty p { margin: 0 0 6px; }

/* Signatures grouped by client */
.sig-group + .sig-group { margin-top: 26px; }
.sig-group-head { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.sig-group-head a, .sig-group-head > span:first-child { display: inline-flex; align-items: center; gap: 7px; color: inherit; text-decoration: none; }
.sig-group-head a:hover { color: var(--ink); text-decoration: underline; }
.sig-group-head .count { font-weight: 500; color: var(--muted); font-size: 12px; }
.sig-card.dragging { opacity: .45; }
.pill .pill-n { margin-left: 4px; font-weight: 600; opacity: .7; }

/* Import images from links */
.url-import { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.url-import-box { width: 100%; box-sizing: border-box; }
.url-import p { margin: 0; }
.url-import-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; resize: vertical; min-height: 84px; }
.url-import-status { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; }
.url-import-status:empty { display: none; }
.url-import-row { font-size: 12.5px; line-height: 1.4; }
.url-import-state { display: inline-block; width: 18px; font-weight: 600; color: var(--muted, #888); }
.url-import-state.ok { color: #1a9b5b; }
.url-import-state.bad { color: #d64545; }
.url-import-url { word-break: break-all; }
.url-import-err { margin-left: 18px; }


