*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
--primary:#2563eb;--primary-dk:#1d4ed8;--primary-lt:#dbeafe;--accent:#3b82f6;
--bg:#eff6ff;--surface:#fff;--border:#e2e8f0;--border-dk:#cbd5e1;
--text:#1a202c;--muted:#64748b;--light:#94a3b8;
--success-bg:#d1fae5;--success-fg:#065f46;
--warning-bg:#fef3c7;--warning-fg:#92400e;
--danger-bg:#fee2e2;--danger-fg:#991b1b;
--info-bg:#dbeafe;--info-fg:#1e40af;
--radius:8px;--radius-lg:12px;
--sidebar-w:220px;--topbar-h:64px;
}
html{font-size:15px}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
    background:var(--bg);color:var(--text);line-height:1.6;min-height:100vh}
a{color:var(--primary);text-decoration:none}
a:hover{text-decoration:underline}

/* ── Sidebar layout (light theme) ────────────────────────────── */
.app-layout{display:flex;min-height:100vh}

:root{--sb-bg:#fbfbfd;--sb-border:#ececf1;--sb-text:#1a1a24;--sb-muted:#6b6b7b;
    --sb-hover:#f2f1fa;--sb-accent:#6d5bd0;--sb-accent-bg:#efebfd;--sb-accent-fg:#5b3fd9}

.sidebar{width:var(--sidebar-w);background:var(--sb-bg);flex-shrink:0;
    display:flex;flex-direction:column;position:fixed;top:0;left:0;
    height:100vh;z-index:200;overflow:hidden;
    border-right:1px solid var(--sb-border)}
.sidebar-brand{height:var(--topbar-h);padding:0 1.25rem;display:flex;align-items:center;gap:.6rem;
    border-bottom:1px solid var(--sb-border);flex-shrink:0;box-sizing:border-box}
.sidebar-logo{max-height:32px;max-width:100%;display:block}
.sidebar-title{color:var(--sb-text);font-weight:700;font-size:1rem;line-height:1.2}

.sidebar-nav{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:.65rem 0}
.sidebar-nav a{display:flex;align-items:center;gap:.6rem;padding:.5rem .8rem;
    color:var(--sb-text);font-size:.85rem;border-radius:7px;
    margin:0 .6rem .05rem;transition:background .15s,color .15s;text-decoration:none}
.sidebar-nav a:hover{background:var(--sb-hover);color:var(--sb-text);text-decoration:none}
.sidebar-nav a.active{background:var(--sb-accent-bg);color:var(--sb-accent-fg);font-weight:600}
.sidebar-nav a .nav-icon{width:17px;text-align:center;flex-shrink:0;
    color:var(--sb-muted);display:inline-flex;align-items:center;transition:color .15s}
.sidebar-nav a:hover .nav-icon{color:var(--sb-text)}
.sidebar-nav a.active .nav-icon{color:var(--sb-accent-fg)}

.sidebar-footer{padding:.875rem 1rem;border-top:1px solid var(--sb-border);flex-shrink:0}
.sidebar-footer a{display:flex;align-items:center;gap:.5rem;padding:.4rem .5rem;
    color:var(--sb-muted);font-size:.82rem;border-radius:6px;
    text-decoration:none;transition:background .15s}
.sidebar-footer a:hover{background:var(--sb-hover);color:var(--sb-text);text-decoration:none}
.sidebar-user{font-size:.8rem;color:var(--sb-text);font-weight:600;padding:.2rem .5rem .6rem;
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center;gap:.4rem}
.sidebar-user .icon,.sidebar-user svg{color:var(--sb-muted)}

/* ── Sidebar: quick nav search ───────────────────────────────── */
.nav-search{padding:0 .85rem .7rem}
.nav-search input{width:100%;padding:.45rem .7rem;border-radius:8px;border:1px solid var(--sb-border);
    background:#fff;color:var(--sb-text);font-size:.8rem}
.nav-search input::placeholder{color:#a3a3b0}
.nav-search input:focus{outline:none;border-color:var(--sb-accent);box-shadow:0 0 0 3px var(--sb-accent-bg)}

/* ── Sidebar: grouped nav ────────────────────────────────────── */
.nav-top-link{margin-bottom:.3rem}
.nav-group{margin-bottom:.05rem}
.nav-group-header{display:flex;align-items:center;gap:.55rem;width:calc(100% - 1.2rem);
    padding:.4rem .8rem;margin:.55rem .6rem .15rem;color:var(--sb-text);font-size:.72rem;
    font-weight:700;text-transform:uppercase;letter-spacing:.05em;
    background:none;border:none;cursor:pointer;border-radius:6px;transition:background .15s,color .15s;
    font-family:inherit}
.nav-group-header:hover{background:var(--sb-hover)}
.nav-group-header .nav-icon{color:var(--sb-muted)}
.nav-group-label{flex:1;text-align:left}
.nav-group-chevron{flex-shrink:0;transition:transform .15s;color:var(--sb-muted)}
.nav-group.closed .nav-group-chevron{transform:rotate(-90deg)}
.nav-group-items{overflow:hidden}
.nav-group.closed .nav-group-items{display:none}
.nav-item{padding-left:2.05rem !important}
.nav-item .nav-icon{display:none}
.nav-badge{margin-left:auto;background:#dc2626;color:#fff;border-radius:999px;
    padding:1px 7px;font-size:.7rem;font-weight:700;flex-shrink:0}
.nav-hidden{display:none !important}

/* ── Sidebar: collapse to icons-only ─────────────────────────── */
.sidebar-collapse-btn{display:flex;align-items:center;gap:.6rem;width:calc(100% - 1.2rem);
    margin:.4rem .6rem;padding:.5rem .8rem;background:none;border:none;cursor:pointer;
    color:var(--sb-muted);font-size:.78rem;border-radius:7px;transition:background .15s,color .15s;
    font-family:inherit;flex-shrink:0}
.sidebar-collapse-btn:hover{background:var(--sb-hover);color:var(--sb-text)}
.sidebar-collapse-btn svg{transition:transform .2s;flex-shrink:0}

body.sidebar-collapsed .sidebar{width:64px}
body.sidebar-collapsed .main-wrap{margin-left:64px}
body.sidebar-collapsed .sidebar-brand{padding:0 .5rem;justify-content:center}
body.sidebar-collapsed .nav-item-label,
body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .nav-search,
body.sidebar-collapsed .nav-group-chevron{display:none}
body.sidebar-collapsed .nav-group-header,
body.sidebar-collapsed .nav-item,
body.sidebar-collapsed .nav-top-link,
body.sidebar-collapsed .sidebar-collapse-btn,
body.sidebar-collapsed .sidebar-footer a{justify-content:center;padding-left:.5rem !important;padding-right:.5rem}
body.sidebar-collapsed .nav-group-items{display:block !important} /* always reachable when icon-only */
body.sidebar-collapsed .nav-item .nav-icon{display:inline-flex} /* icons are the only affordance left once labels hide */
body.sidebar-collapsed .sidebar-collapse-btn svg{transform:rotate(180deg)}
@media(max-width:900px){body.sidebar-collapsed .sidebar{width:var(--sidebar-w)}
    body.sidebar-collapsed .main-wrap{margin-left:var(--sidebar-w)}
    body.sidebar-collapsed .nav-item-label,body.sidebar-collapsed .nav-group-label,
    body.sidebar-collapsed .nav-search,body.sidebar-collapsed .nav-group-chevron{display:revert}
    body.sidebar-collapsed .nav-item .nav-icon{display:none}
    body.sidebar-collapsed .nav-group-items{display:revert !important}
    body.sidebar-collapsed .nav-group.closed .nav-group-items{display:none !important}}

/* ── Main content area ───────────────────────────────────────── */
.main-wrap{flex:1;margin-left:var(--sidebar-w);display:flex;flex-direction:column;min-width:0}
.topbar{height:var(--topbar-h);background:var(--surface);border-bottom:1px solid var(--border);
    padding:0 1.75rem;display:flex;align-items:center;justify-content:space-between;
    position:sticky;top:0;z-index:100;gap:1rem;box-sizing:border-box}
.topbar-title{font-size:1.25rem;font-weight:600;color:var(--text)}
.topbar-actions{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap}

/* Hamburger button — mobile only */
.hamburger-btn{display:none;background:none;border:none;cursor:pointer;
    padding:.4rem;color:var(--primary-dk);flex-shrink:0}
.hamburger-btn svg{display:block}

.main-content{padding:1.75rem 1.75rem 3rem;max-width:1320px}

/* ── Page header (for pages that don't use topbar) */
.page-header{display:flex;align-items:center;justify-content:space-between;
    margin-bottom:1.5rem;gap:1rem;flex-wrap:wrap}
.page-header h1{font-size:1.4rem;font-weight:600}

/* ── Cards ───────────────────────────────────────────────────── */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);
    box-shadow:0 1px 3px rgba(0,0,0,.06);padding:1.5rem;margin-bottom:1.5rem}
.card-title{font-size:1rem;font-weight:600;margin-bottom:1rem}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn{display:inline-flex;align-items:center;gap:.4rem;padding:.45rem 1rem;
    border:1px solid transparent;border-radius:var(--radius);font-size:.875rem;
    font-weight:500;cursor:pointer;text-decoration:none;transition:opacity .15s;
    white-space:nowrap;line-height:1.4}
.btn:hover{opacity:.85;text-decoration:none}
.btn-primary{background:var(--primary);color:#fff}
.btn-secondary{background:#fff;color:var(--text);border-color:var(--border-dk)}
.btn-danger{background:#dc2626;color:#fff}
.btn-success{background:#16a34a;color:#fff}
.btn-sm{padding:.3rem .7rem;font-size:.8rem}
.btn-block{display:flex;width:100%;justify-content:center}
.w-full{width:100%}
.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}
.mb-1{margin-bottom:.5rem}.mb-2{margin-bottom:1rem}

/* ── Forms ───────────────────────────────────────────────────── */
.form-group{margin-bottom:1.1rem}
label{display:block;font-size:.78rem;font-weight:600;color:var(--muted);
    margin-bottom:.35rem;text-transform:uppercase;letter-spacing:.04em}
input[type=text],input[type=email],input[type=password],input[type=number],
input[type=date],input[type=tel],input[type=url],select,textarea{
    width:100%;padding:.55rem .8rem;border:1px solid var(--border-dk);
    border-radius:var(--radius);font-size:.9rem;font-family:inherit;
    background:var(--surface);color:var(--text);transition:border-color .15s,box-shadow .15s}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--accent);
    box-shadow:0 0 0 3px rgba(37,99,235,.15)}
textarea{resize:vertical;min-height:80px}
.form-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:1rem}
.form-hint{font-size:.78rem;color:var(--muted);margin-top:.3rem}
.form-date{margin-bottom:1.1rem}

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrapper{overflow-x:auto;border-radius:var(--radius-lg);
    border:1px solid var(--border);box-shadow:0 1px 3px rgba(0,0,0,.06)}
table{width:100%;border-collapse:collapse;background:var(--surface);font-size:.875rem}
thead tr{background:var(--primary-lt)}
thead th{padding:.75rem 1rem;text-align:left;font-size:.75rem;font-weight:600;
    text-transform:uppercase;letter-spacing:.05em;color:var(--primary-dk);
    white-space:nowrap;border-bottom:1px solid var(--border)}
tbody td{padding:.75rem 1rem;border-bottom:1px solid var(--border);vertical-align:middle}
tbody tr:last-child td{border-bottom:none}
tbody tr:hover{background:#f8faff}
.td-actions{display:flex;gap:.4rem;align-items:center;flex-wrap:wrap}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert{padding:.75rem 1rem;border-radius:var(--radius);margin-bottom:1rem;
    font-size:.9rem;border:1px solid transparent}
.alert-success{background:var(--success-bg);color:var(--success-fg);border-color:#6ee7b7}
.alert-error{background:var(--danger-bg);color:var(--danger-fg);border-color:#fca5a5}
.alert-warning{background:var(--warning-bg);color:var(--warning-fg);border-color:#fcd34d}
.alert-info{background:var(--info-bg);color:var(--info-fg);border-color:#93c5fd}

/* ── Login page ──────────────────────────────────────────────── */
.login-body{display:flex;align-items:center;justify-content:center;min-height:100vh;
    background:linear-gradient(135deg,var(--primary-dk) 0%,var(--accent) 100%)}
.login-card{background:var(--surface);border-radius:var(--radius-lg);
    box-shadow:0 8px 32px rgba(0,0,0,.18);padding:2.5rem;width:100%;
    max-width:400px;margin:1rem}
.login-logo{text-align:center;margin-bottom:1.75rem}
.login-logo img{max-height:56px}
.login-logo span{font-size:1.5rem;font-weight:700;color:var(--primary-dk)}

/* ── Stats ───────────────────────────────────────────────────── */
.stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
    gap:1rem;margin-bottom:1.5rem}
.stat-tile{background:var(--surface);border:1px solid var(--border);
    border-radius:var(--radius-lg);padding:1.25rem 1.5rem;
    box-shadow:0 1px 3px rgba(0,0,0,.06)}
.stat-label{font-size:.75rem;font-weight:600;text-transform:uppercase;
    letter-spacing:.05em;color:var(--muted);margin-bottom:.4rem}
.stat-value{font-size:1.8rem;font-weight:700;color:var(--primary);line-height:1}
.stat-sub{font-size:.78rem;color:var(--muted);margin-top:.3rem}

/* ── Image upload / preview ──────────────────────────────────── */
.img-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:.75rem}
.img-card{position:relative;border-radius:8px;overflow:hidden;
    border:1px solid var(--border);background:#f8f9fa}
.img-card img{width:100%;height:110px;object-fit:cover;display:block}
.img-card-body{padding:.4rem .5rem;font-size:.75rem;color:var(--muted)}
.img-card-del{position:absolute;top:.3rem;right:.3rem;background:rgba(220,38,38,.85);
    color:#fff;border:none;border-radius:50%;width:22px;height:22px;
    cursor:pointer;font-size:.75rem;display:flex;align-items:center;justify-content:center}

/* ── Utilities ───────────────────────────────────────────────── */
.text-muted{color:var(--muted)}.text-right{text-align:right}.text-center{text-align:center}
.flex{display:flex}.gap-1{gap:.5rem}.gap-2{gap:1rem}.items-center{align-items:center}
.justify-between{justify-content:space-between}.center{text-align:center}

/* ── Sidebar overlay (mobile) ────────────────────────────────── */
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.45);
    z-index:199}
.sidebar-overlay.open{display:block}

/* ── Block settings modal (email campaign builder) ───────────────
   The live preview iframe is the editing surface — see campaign_canvas.php
   for the .hv-canvas-block click-to-select styling, injected there since
   it renders inside the iframe's own document, not this stylesheet. ── */
.modal-backdrop{display:none;position:fixed;inset:0;background:rgba(0,0,0,.5);
    z-index:500;align-items:center;justify-content:center}
.modal-backdrop.open{display:flex}
.modal-box{background:var(--surface);border-radius:var(--radius-lg);width:100%;max-width:520px;
    max-height:85vh;display:flex;flex-direction:column;box-shadow:0 10px 40px rgba(0,0,0,.25);margin:1rem}
.modal-header{display:flex;align-items:center;justify-content:space-between;
    padding:1rem 1.25rem;border-bottom:1px solid var(--border);font-weight:600}
.modal-close{background:none;border:none;font-size:1.4rem;line-height:1;cursor:pointer;
    color:var(--muted);padding:0 .25rem}
.modal-close:hover{color:var(--text)}
.modal-body{padding:1.25rem;overflow-y:auto}
.modal-footer{padding:1rem 1.25rem;border-top:1px solid var(--border)}

/* ── Page/campaign/signature builders (inline canvas + gear-triggered
   settings modal) ── */
.main-content:has(.hv-builder-grid){max-width:none}
.hv-builder-grid{display:grid;grid-template-columns:240px 1fr 340px;gap:1rem;align-items:start}
/* All three builders (website/campaign/signature) use the 2-column layout —
   settings live in a gear-triggered modal, not a persistent third column.
   The 3-column .hv-builder-grid above is kept only as the base its gap/
   align-items rules are shared from. */
.hv-builder-grid-2col{grid-template-columns:240px 1fr}

.hv-palette{border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface);
    padding:.5rem .75rem}
.hv-accordion-section{border-bottom:1px solid var(--border)}
.hv-accordion-section:last-child{border-bottom:none}
.hv-accordion-header{width:100%;text-align:left;background:none;border:none;padding:.6rem .1rem;
    font-size:.72rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);
    cursor:pointer;display:flex;justify-content:space-between;align-items:center}
.hv-accordion-body{display:none;flex-direction:column;gap:.35rem;padding-bottom:.6rem}
.hv-accordion-section.open .hv-accordion-body{display:flex}
.hv-accordion-caret{transition:transform .12s;font-size:.65rem;color:var(--light)}
.hv-accordion-section.open .hv-accordion-caret{transform:rotate(90deg)}
.hv-palette-btn{text-align:left;font-size:.8rem;padding:.4rem .6rem;border:1px solid var(--border);
    border-radius:6px;background:var(--surface);cursor:pointer;color:var(--text)}
.hv-palette-btn:hover{background:var(--primary-lt);border-color:var(--primary)}

/* Icon-on-top, label-below palette cards (Hivetell reference) — shared
   layout for GrapesJS's block-manager cards (website/campaign, via each
   block's `label` HTML) and the signature builder's plain palette buttons
   (decorated in place by hvBlockIconLabelHtml(), see signature_edit.php). */
.hv-block-icon{width:26px;height:26px;margin:0 auto .3rem;color:var(--primary)}
.hv-block-icon svg{width:100%;height:100%;display:block}
/* GrapesJS's own grapes.min.css sets a bare ".gjs-block svg{fill:currentColor}"
   which, loading after app.css, wins the cascade at equal specificity and
   solid-fills every outline icon (rect/path/line elements with no fill of
   their own inherit the <svg> root's computed fill). One level of extra
   specificity here beats it regardless of load order — icons that want a
   filled shape (dots, quote marks) set fill="currentColor" directly on
   that element, which this doesn't touch. */
.gjs-block .hv-block-icon svg{fill:none}
.hv-block-icon-label{font-size:.72rem;line-height:1.25;text-align:center}
.hv-palette-btn.hv-block-icon-btn{display:flex;flex-direction:column;align-items:center;
    text-align:center;padding:.6rem .5rem;gap:0}

.hv-canvas-frame{border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface);
    padding:1rem;min-height:420px}
/* GrapesJS owns its container's scrolling internally (it renders the canvas
   inside its own iframe) — a JS-computed explicit pixel height (see
   hvSizeCanvasFrame() in modules/website/edit.php) plus overflow:hidden
   here stops it fighting the outer page for scroll, which is the direct
   cousin of the TinyMCE toolbar/scroll-boundary bug already hit once this
   session. No padding — GrapesJS's iframe should fill edge-to-edge. */
.hv-canvas-frame.hv-gjs-mount{padding:0;overflow:hidden;position:relative}
.hv-canvas-frame.hv-gjs-mount .gjs-cv-canvas,
.hv-canvas-frame.hv-gjs-mount .gjs-editor{height:100%}
/* Custom per-block floating toolbar (drag / gear / delete) — GrapesJS
   renders and positions this itself relative to the selected component;
   these rules only style the icons it wraps in the classes we supply.
   Background/text overridden here specifically (not via --gjs-color-blue,
   which also drives the selection outline / resizer handles / drag-helper
   and must stay blue for those) to match the RTE ribbon's white surface
   instead of GrapesJS's default solid-blue toolbar pill. */
.gjs-toolbar{background-color:var(--surface);color:var(--text);border:1px solid var(--border);
    border-radius:6px;box-shadow:0 2px 6px rgba(0,0,0,.18)}
.gjs-toolbar-item.hv-gjs-tlb-move,
.gjs-toolbar-item.hv-gjs-tlb-settings,
.gjs-toolbar-item.hv-gjs-tlb-delete{
    font-size:.8rem;padding:.3rem .5rem;cursor:pointer}
.gjs-toolbar-item:hover{background-color:var(--primary-lt)}
.gjs-toolbar-item.hv-gjs-tlb-move{cursor:grab}
.gjs-toolbar-item.hv-gjs-tlb-delete:hover{background:#dc2626;color:#fff}
.hv-canvas-empty{color:var(--light);text-align:center;padding:3rem 0;font-size:.9rem}

/* GrapesJS's native RTE ribbon (assets/js/website-canvas-renderer.js's
   sibling config in modules/website/edit.php) — these controls render
   inside GrapesJS's own actionbar spans, which don't otherwise give a
   <select>/<input type=color> enough room to be usable. */
.hv-rte-select{font-size:.72rem;padding:.15rem .3rem;border:1px solid var(--border);
    border-radius:4px;background:var(--surface);color:var(--text);max-width:90px;vertical-align:middle}
.hv-rte-color{width:22px;height:22px;padding:0;border:1px solid var(--border);
    border-radius:4px;cursor:pointer;vertical-align:middle}
.hv-rte-btn{font-size:.85rem;padding:.3rem .5rem;cursor:pointer;background:none;border:1px solid transparent;
    border-radius:4px;color:var(--text);display:inline-flex;align-items:center;justify-content:center}
.hv-rte-btn:hover{background:var(--primary-lt);border-color:var(--border)}

/* Signature builder's own floating RTE toolbar — a hand-rolled equivalent
   of the GrapesJS ribbon above (same .hv-rte-* controls, same execCommand
   mechanism) since the signature canvas is same-document, not a GrapesJS
   iframe. Positioned in JS under whichever block is being edited. */
.hv-inline-rte-toolbar{position:absolute;z-index:20;display:flex;flex-wrap:wrap;align-items:center;gap:.3rem;
    background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:.35rem .5rem;
    box-shadow:0 4px 14px rgba(0,0,0,.18)}

/* GrapesJS's own RTE-action wrapper spans are a fixed 25px — fine for a
   single icon glyph, but it silently squashes our <select>/<input
   type=color> controls down to ~14px (just the native dropdown arrow,
   unreadable without hovering for the title tooltip). Auto-sizing is safe
   for the built-in icon actions too (still flex-centered, just no longer
   clipped) and is what actually lets .hv-rte-select's own max-width above
   take effect. */
.gjs-rte-actionbar .gjs-rte-action{width:auto;min-width:25px}

/* GrapesJS's default skin is a dark charcoal/grey theme (--gjs-main-color:
   #444, light text) — never intentionally chosen, just what shipped
   unstyled. Retheme the RTE toolbar + block palette (the two GrapesJS-
   chrome surfaces still using these vars — the per-component floating
   toolbar already renders correctly via the separate --gjs-color-blue
   variable, untouched here) to match the app's own light surface / blue
   accent instead. Declared on html:root (higher specificity than
   grapesjs.min.css's own bare :root block) so it wins regardless of
   stylesheet load order. */
html:root{
    --gjs-main-color: #ffffff;
    --gjs-primary-color: #ffffff;
    --gjs-font-color: #1a202c;
    --gjs-font-color-active: #2563eb;
    --gjs-secondary-dark-color: #f8fafc;
    --gjs-main-dark-color: rgba(0,0,0,.1);
    --gjs-main-light-color: rgba(37,99,235,.12);
    --gjs-quaternary-color: #2563eb;
    --gjs-secondary-color: #1a202c;
    /* Default GrapesJS reserves a 15%-wide strip (--gjs-left-width) and a
       40px top strip (--gjs-canvas-top) for its own layer/style-manager
       panel and top panel — both stripped entirely in this app (panels:
       {defaults:[]}), but grapes.min.css's own .gjs-cv-canvas width/height
       calc() still reserved the space, silently narrowing every canvas and
       throwing off .hv-content-container's centering math (visible content
       area was ~85% of the actual white frame width, not the frame itself). */
    --gjs-left-width: 0px;
    --gjs-canvas-top: 0px;
}
.gjs-rte-toolbar-ui{box-shadow:0 4px 14px rgba(0,0,0,.18)}
.gjs-block{box-shadow:0 1px 3px rgba(0,0,0,.08)}

/* Website builder's own secondary top bar (page switcher / New / Clone /
   device preview / Settings / Preview / Publish) — sits below the app's
   normal page header, not a replacement for it. */
.hv-topbar-builder{display:flex;align-items:center;justify-content:space-between;
    flex-wrap:wrap;gap:.75rem;background:var(--surface);border:1px solid var(--border);
    border-radius:var(--radius-lg);padding:.6rem .875rem;margin-bottom:1rem}
.hv-topbar-builder-group{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}
.hv-topbar-builder select{font-size:.85rem;padding:.4rem .6rem;border:1px solid var(--border);
    border-radius:6px;background:var(--surface);color:var(--text)}
.hv-device-btn.active{background:var(--primary-lt);border-color:var(--primary);color:var(--primary-dk)}

.hv-block{border:1px dashed transparent;border-radius:6px;margin:4px 0;position:relative}
.hv-block.hv-block-cell,.hv-block.hv-block-table,.hv-block.hv-block-row{margin:0}
/* Floating overlay, not in-flow — opacity:0 alone still reserves layout
   space (unlike display:none), and this sits on EVERY block at EVERY
   nesting level, so with a table nested a few levels deep those invisible
   strips stack into large, confusing gaps between otherwise-adjacent
   lines. Absolute positioning removes it from flow entirely; pointer-
   events is gated the same way opacity is, so a hidden toolbar can't
   swallow clicks meant for whatever's underneath it. */
/* Floating drag/gear/delete cluster — a compact icon-only pill (no label
   text, no hidden badge) matching the RTE ribbon's own white/blue surface
   (see .hv-rte-btn/.hv-rte-select) and the website/campaign builders'
   GrapesJS toolbar (.gjs-toolbar, above) for one consistent look across all
   three builders, just hand-rolled here since this canvas isn't
   GrapesJS-driven. */
.hv-block-toolbar{position:absolute;top:-14px;right:6px;left:auto;z-index:5;opacity:0;pointer-events:none;
    transition:opacity .12s;display:flex;align-items:center;gap:1px;
    background:var(--surface);border:1px solid var(--border);padding:2px;border-radius:6px;white-space:nowrap;
    box-shadow:0 2px 6px rgba(0,0,0,.18)}
.hv-block:hover>.hv-block-toolbar,.hv-block-selected>.hv-block-toolbar{opacity:1;pointer-events:auto}
.hv-block-selected{border-color:var(--primary)!important;box-shadow:0 0 0 1px var(--primary)}
.hv-block-toolbar .hv-drag-handle,.hv-block-toolbar button{
    display:flex;align-items:center;justify-content:center;width:22px;height:20px;
    font-size:.75rem;line-height:1;background:none;border:none;color:var(--text);cursor:pointer;
    border-radius:3px;padding:0}
.hv-block-toolbar .hv-drag-handle:hover,.hv-block-toolbar button:hover{background:var(--primary-lt)}
.hv-drag-handle{cursor:grab;user-select:none}
.hv-drag-handle:active{cursor:grabbing}
.hv-block-settings{font-size:.8rem}
.hv-menu-edit-row{border:1px solid var(--border);border-radius:8px;margin-bottom:.6rem;overflow:hidden}
.hv-menu-edit-top{display:flex;align-items:center;gap:.75rem;padding:.6rem .75rem}
.hv-menu-edit-info{flex:1;min-width:0}
.hv-menu-edit-children{background:var(--bg-subtle,#f8fafc);border-top:1px solid var(--border)}
.hv-menu-edit-child{display:flex;align-items:center;gap:.75rem;padding:.5rem .75rem .5rem 2.25rem;border-top:1px solid var(--border)}
.hv-menu-edit-child:first-child{border-top:none}
.hv-block-delete:hover{background:#dc2626!important;color:#fff!important}
.hv-block-body{padding:.35rem}
.hv-block-table>.hv-block-body,.hv-block-row>.hv-block-body{padding:2px}
.hv-block-hidden{opacity:.4}

.hv-table-rows{display:flex;flex-direction:column;gap:4px}
.hv-table-row{display:flex;gap:4px}
.hv-table-row>.hv-block-cell{flex:1;min-width:0}
.hv-cell-inner{min-height:36px;border:1px dashed var(--border-dk);border-radius:4px;padding:4px;
    background:#fafbfc}
.hv-cell-empty-hint{color:var(--light);font-size:.7rem;text-align:center;padding:.6rem 0}
.hv-add-row-btn,.hv-add-cell-btn{font-size:.7rem;margin-top:4px;background:none;border:1px dashed var(--border-dk);
    border-radius:4px;padding:.2rem .5rem;cursor:pointer;color:var(--muted)}
.hv-add-row-btn:hover,.hv-add-cell-btn:hover{background:var(--primary-lt);color:var(--primary-dk)}
.hv-add-cell-btn{margin-left:4px}

.hv-empty-leaf{background:#f1f5f9;color:var(--light);font-size:.7rem;text-align:center;
    padding:.6rem;border-radius:4px}
.hv-qr-placeholder{background:#f1f5f9;color:var(--light);font-size:.62rem;text-align:center;
    display:flex;align-items:center;justify-content:center;border-radius:4px;
    border:1px dashed var(--border-dk);flex-direction:column;line-height:1.3}
.hv-canvas-hint{font-size:.65rem;color:var(--light);margin-top:2px}
.hv-preview-text{font-size:13px;line-height:1.2}
.hv-preview-text[contenteditable="true"]{outline:1px dashed var(--primary);outline-offset:3px;cursor:text}

.hv-inspector-section{margin-top:1rem;padding-top:.75rem;border-top:1px solid var(--border)}
.hv-inspector-section-title{font-size:.7rem;font-weight:700;text-transform:uppercase;
    color:var(--muted);margin-bottom:.5rem}

/* ── Inspector repeater lists (website builder: FAQ/testimonials/stats/
   team/tabs/awards/downloads items, animated-heading phrases) — generic
   add/edit/remove rows shared across every array-config block type
   rather than bespoke markup per type. ── */
.hv-repeater-item{border:1px solid var(--border);border-radius:6px;padding:.6rem;margin-bottom:.5rem;background:#fafafa}
.hv-repeater-item .form-group{margin-bottom:.4rem}
.hv-repeater-item .form-group:last-child{margin-bottom:0}
.hv-repeater-remove{font-size:.72rem;color:var(--danger-fg);background:none;border:1px solid transparent;
    cursor:pointer;padding:.15rem .4rem;border-radius:4px;margin-top:.3rem}
.hv-repeater-remove:hover{background:#fee2e2;border-color:#fca5a5}
.hv-repeater-add{font-size:.78rem;padding:.35rem .7rem;background:none;border:1px dashed var(--border-dk);
    border-radius:4px;cursor:pointer;color:var(--text);width:100%}
.hv-repeater-add:hover{background:var(--primary-lt);border-color:var(--primary);color:var(--primary)}
.hv-media-pick-btn{font-size:.78rem;padding:.3rem .6rem;background:none;border:1px solid var(--border-dk);
    border-radius:4px;cursor:pointer;margin-top:.3rem}
.hv-media-pick-btn:hover{background:var(--primary-lt);border-color:var(--primary);color:var(--primary)}
.hv-media-pick-preview{max-width:100%;max-height:90px;border-radius:4px;margin-top:.4rem;display:block}

/* ── Responsive ──────────────────────────────────────────────── */
@media(max-width:900px){
    .sidebar{transform:translateX(calc(-1 * var(--sidebar-w)));transition:transform .25s ease}
    .sidebar.open{transform:translateX(0)}
    .main-wrap{margin-left:0}
    .hamburger-btn{display:flex}
    .main-content{padding:1rem 1rem 3rem}
    .page-header{flex-direction:column;align-items:flex-start}
    .form-row{grid-template-columns:1fr}
    .stats-grid{grid-template-columns:1fr 1fr}
    .table-wrapper{font-size:.8rem}
    thead th,tbody td{padding:.5rem .6rem}
    .modal-box{max-width:calc(100vw - 2rem)}
    .hv-builder-grid{grid-template-columns:1fr}
    .hv-inspector-panel{position:static;max-height:none}
}
@media(max-width:480px){
    .stats-grid{grid-template-columns:1fr}
    .login-card{padding:1.5rem}
    .td-actions{flex-direction:column;align-items:flex-start}
    .btn-sm{width:100%;justify-content:center}
}

/* ── Shared media library picker modal (assets/js/media-library-picker.js)
   Embeddable from any builder — website canvas, signature/campaign block
   settings, itineraries — so it lives in the global stylesheet rather than
   a per-page <style> block. ── */
.hv-media-picker-overlay{position:fixed;inset:0;background:rgba(0,0,0,.5);
    z-index:600;display:flex;align-items:center;justify-content:center}
.hv-media-picker{background:var(--surface);border-radius:var(--radius-lg);width:100%;max-width:760px;
    max-height:85vh;display:flex;flex-direction:column;box-shadow:0 10px 40px rgba(0,0,0,.25);margin:1rem}
.hv-media-picker-header{display:flex;align-items:center;gap:.75rem;
    padding:1rem 1.25rem;border-bottom:1px solid var(--border)}
.hv-media-picker-search{flex:1;padding:.5rem .75rem;border:1px solid var(--border);border-radius:6px}
.hv-media-picker-upload-btn{cursor:pointer;white-space:nowrap}
.hv-media-picker-close{background:none;border:none;font-size:1.4rem;line-height:1;cursor:pointer;
    color:var(--muted);padding:0 .25rem}
.hv-media-picker-close:hover{color:var(--text)}
.hv-media-picker-grid{padding:1.25rem;overflow-y:auto;display:grid;
    grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:1rem}
.hv-media-picker-tile{cursor:pointer;border:1px solid var(--border);border-radius:8px;overflow:hidden;
    background:var(--surface);transition:border-color .15s}
.hv-media-picker-tile:hover{border-color:var(--primary,#3b82f6)}
.hv-media-picker-thumb{width:100%;height:90px;background:#f3f4f6 center/cover no-repeat;
    display:flex;align-items:center;justify-content:center;font-size:1.6rem;color:#9ca3af}
.hv-media-picker-name{padding:.4rem .5rem 0;font-size:.75rem;font-weight:500;
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hv-media-picker-size{padding:0 .5rem .4rem;font-size:.72rem;color:var(--muted)}
