:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #e2e5ea;
    --text: #1d2330;
    --muted: #6b7385;
    --primary: #1b5cff;
    --primary-soft: #e8efff;
    --ok: #12805c;
    --ok-soft: #e3f5ee;
    --warn: #9a6200;
    --warn-soft: #fff4dc;
    --err: #c0283b;
    --err-soft: #fde8eb;
    --radius: 10px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: .2rem 0; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
h3 { font-size: .95rem; margin: 1.2rem 0 .5rem; }
code, pre, kbd { font-family: ui-monospace, Consolas, monospace; font-size: .85em; }
code { background: #eef0f4; padding: 1px 5px; border-radius: 4px; word-break: break-all; }
kbd { opacity: .7; font-size: .7rem; margin-left: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

/* Layout */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: #121826; color: #c9d1e0; padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: #c9d1e0; padding: 9px 12px; border-radius: 8px; }
.sidebar nav a:hover { background: #1f2738; text-decoration: none; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar nav .nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: #7d879b; padding: 14px 12px 4px; }
.sidebar { overflow-y: auto; }
.account-switch { display: flex; align-items: center; gap: 8px; }
.account-switch select { width: auto; }
.sidebar-user { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: .85rem; padding: 0 6px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: inherit; }
.sidebar .brand { color: #fff; }
.brand-mark { background: var(--primary); color: #fff; border-radius: 8px; width: 32px; height: 32px; display: grid; place-items: center; font-size: .8rem; }
.main { padding: 24px 32px 60px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; margin-bottom: 20px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.grid-2 > .card, .grid-2 .stack > .card { margin-bottom: 0; }
.card-warn { border-color: #f0d391; background: var(--warn-soft); }

/* Form controls */
label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
    font: inherit; font-size: .9rem; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); width: 100%;
}
input:focus, select, textarea:focus { outline-color: var(--primary); }
.row input, .row select, .filters input, .filters select { width: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.span-2 { grid-column: span 2; }
.btn { font: inherit; font-size: .88rem; display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f0f2f6; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #154ad1; }
.btn-danger { color: var(--err); }
.btn-danger:hover { background: var(--err-soft); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
button.link { background: none; border: 0; color: #8fb0ff; cursor: pointer; font: inherit; }

/* Feedback */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: .9rem; }
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--err-soft); color: var(--err); }
.flash-warning { background: var(--warn-soft); color: var(--warn); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; background: #eef0f4; color: var(--muted); font-weight: 600; vertical-align: middle; }
.badge-ok, .stage-customer { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-err, .stage-lost { background: var(--err-soft); color: var(--err); }
.stage-new { background: var(--primary-soft); color: var(--primary); }
.stage-contacted, .stage-qualified { background: #f1e9ff; color: #6a3dc9; }

/* Tables & lists */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.inactive td { opacity: .55; }
.sidebar .role { display: block; color: #8fb0ff; font-size: .7rem; }
.card.narrow { max-width: 560px; }
.table tr.clickable:hover td { background: #fafbfc; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat span { color: var(--muted); font-size: .8rem; }
.stat strong { display: block; font-size: 1.7rem; margin-top: 4px; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist li::before { display: inline-block; width: 22px; font-weight: 700; }
.checklist li.ok::before { content: "✓"; color: var(--ok); }
.checklist li.todo { color: var(--muted); }
.checklist li.todo::before { content: "○"; }
.kv { display: grid; grid-template-columns: minmax(120px, 35%) 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: .85rem; }
.kv dd { margin: 0; word-break: break-word; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pager { display: flex; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.pager a { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); }
.pager a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.timeline { padding-left: 18px; margin: 0; display: grid; gap: 6px; }
.warnings { padding-left: 18px; color: var(--warn); font-size: .85rem; display: grid; gap: 6px; }
.meta-questions { padding-left: 20px; display: grid; gap: 8px; }
pre.code { background: #121826; color: #d6e2ff; padding: 12px; border-radius: 8px; overflow: auto; max-height: 360px; font-size: .78rem; }
.page-row { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.page-row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-row-head h2 { margin: 0; }
details summary { cursor: pointer; color: var(--primary); font-size: .85rem; margin-top: 8px; }

/* Moduli istantanei */
.note { background: var(--primary-soft); border-left: 4px solid var(--primary); padding: 12px 16px; border-radius: 8px; font-size: .9rem; margin-bottom: 20px; }
.form-detail { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; align-items: start; }
.form-detail > .card { margin-bottom: 0; position: sticky; top: 16px; }
.form-detail .stack > .card, .form-detail .stack > .note, .form-detail .stack > .stats { margin-bottom: 0; }
label.inline { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
label.inline input { width: auto; }
.preview-dialog { border: 0; border-radius: 14px; padding: 16px; width: min(420px, 94vw); }
.preview-dialog::backdrop { background: rgba(18, 24, 38, .55); }
.preview-dialog .page-row-head { margin-bottom: 12px; }

.ifp { display: flex; flex-direction: column; align-items: center; }
.ifp-phone { width: 320px; max-width: 100%; min-height: 560px; border: 10px solid #121826; border-radius: 34px; background: #fff; display: flex; flex-direction: column; overflow: hidden; font-size: .88rem; box-shadow: 0 8px 24px rgba(18, 24, 38, .18); }
.ifp-top { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid #e4e6eb; }
.ifp-avatar { width: 30px; height: 30px; border-radius: 50%; background: #1877f2; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.ifp-page { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ifp-close { color: #65676b; }
.ifp-screen { flex: 1; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; max-height: 440px; }
.ifp-screen[hidden] { display: none; }
.ifp-screen h4 { margin: 0; font-size: 1.05rem; }
.ifp-screen p { margin: 0; color: #1c1e21; }
.ifp-hint { color: #65676b !important; font-size: .8rem; }
.ifp-field { display: flex; flex-direction: column; gap: 6px; }
.ifp-label { font-weight: 600; font-size: .82rem; }
.ifp-input { border: 1px solid #ccd0d5; border-radius: 6px; padding: 9px 10px; background: #f5f6f7; }
.ifp-option { display: flex; align-items: center; gap: 8px; border: 1px solid #ccd0d5; border-radius: 6px; padding: 8px 10px; }
.ifp-radio { width: 14px; height: 14px; border: 2px solid #8a8d91; border-radius: 50%; flex-shrink: 0; }
.ifp-btn { margin-top: auto; background: #1877f2; color: #fff; border: 0; border-radius: 6px; padding: 10px; font: inherit; font-weight: 600; cursor: pointer; text-align: center; }
.ifp-btn:hover { background: #166fe5; text-decoration: none; }
.ifp-check { width: 48px; height: 48px; border-radius: 50%; background: #e7f3ff; color: #1877f2; display: grid; place-items: center; font-size: 1.4rem; margin: 20px auto 4px; }
.ifp-thanks h4, .ifp-thanks p { text-align: center; }
.ifp-nav { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-top: 1px solid #e4e6eb; }
.ifp-nav button { background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: #65676b; padding: 0 8px; }
.ifp-dots { display: flex; gap: 6px; }
.ifp-dots i { width: 7px; height: 7px; border-radius: 50%; background: #ccd0d5; }
.ifp-dots i.on { background: #1877f2; }
.ifp-note { margin-top: 8px; text-align: center; }

/* Paginazione */
.pager-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.pager-bar .pager { margin-top: 0; }
.pager span.disabled { padding: 4px 10px; color: var(--muted); opacity: .5; }
.pager .gap { padding: 4px 6px; color: var(--muted); }
.pp-form select { width: auto; padding: 4px 8px; }

/* Kanban */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kb-col { flex: 0 0 290px; background: #eceff4; border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.kb-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 10px 12px; border-radius: var(--radius) var(--radius) 0 0; }
.kb-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kb-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-count { background: rgba(255, 255, 255, .6); color: #1d2330; border-radius: 999px; padding: 0 8px; font-size: .75rem; font-weight: 700; }
.kb-tools { display: flex; align-items: center; gap: 2px; }
.kb-tools form { display: flex; }
.kb-tools button { background: none; border: 0; cursor: pointer; font-size: .95rem; padding: 2px 5px; border-radius: 4px; }
.kb-tools button:hover { background: rgba(0, 0, 0, .08); }
.kb-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 80px; flex: 1; border-radius: 0 0 var(--radius) var(--radius); transition: background .15s; }
.kb-cards.drop-target { background: rgba(27, 92, 255, .1); outline: 2px dashed var(--primary); outline-offset: -4px; }
.kb-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px; cursor: grab; box-shadow: 0 1px 2px rgba(18, 24, 38, .05); }
.kb-card.dragging { opacity: .4; }
.kb-card.saving { opacity: .6; }
.kb-name { font-weight: 600; margin-bottom: 2px; overflow-wrap: anywhere; }
.kb-meta { margin-top: 4px; }
.kb-actions { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.kb-actions .btn-sm { padding: 3px 8px; font-size: .74rem; }
.kb-more { text-align: center; padding: 4px; }
.kb-new { background: transparent; border: 2px dashed var(--border); padding: 14px; align-items: center; }
.stage-dialog { border: 0; border-radius: 12px; padding: 20px; width: min(440px, 94vw); }
.stage-dialog::backdrop { background: rgba(18, 24, 38, .5); }
.stage-dialog h3 { margin: 0; }
.action-dialog { width: min(560px, 94vw); }
.color-input { width: 44px !important; height: 34px; padding: 2px !important; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); cursor: pointer; padding: 0; }
.toast { position: fixed; bottom: 20px; right: 20px; z-index: 60; background: #121826; color: #fff; padding: 10px 14px; border-radius: 8px; font-size: .85rem; max-width: 380px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }
.toast-error { background: var(--err); }

/* Builder: blocchi di contenuto */
.screen-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.field-card.is-content { background: #fbfcfe; }
.field-card.type-page_break { background: transparent; border-style: dashed; padding: 8px 12px; }
.page-break-preview { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); }
.page-break-preview strong { color: var(--text); }
.text-block-title { font-size: 1.05rem; }
.media-preview img, .media-preview video { max-width: 100%; max-height: 220px; border-radius: 8px; display: block; }
.media-yt { position: relative; display: inline-block; }
.media-yt img { max-height: 180px; border-radius: 8px; display: block; }
.media-yt span { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 2rem; text-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.media-empty { padding: 20px; border: 2px dashed var(--border); border-radius: 8px; text-align: center; color: var(--muted); font-size: .85rem; }
.web-settings { margin-top: 6px; }

/* Post: gallerie */
.gallery-preview { display: flex; gap: 6px; flex-wrap: wrap; }
.gallery-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.thumb-wrap { position: relative; display: inline-block; }
.thumb-count { position: absolute; right: -4px; bottom: -4px; background: #121826; color: #fff; font-size: .65rem; border-radius: 999px; padding: 1px 5px; }

/* Email */
.email-editor { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.email-editor > .card { margin-bottom: 20px; }
.ee-toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; border: 1px solid var(--border); border-radius: 8px 8px 0 0; background: #f8f9fb; }
.ee-toolbar button, .ee-color { background: #fff; border: 1px solid var(--border); border-radius: 6px; min-width: 32px; height: 30px; padding: 0 8px; cursor: pointer; font: inherit; font-size: .85rem; display: inline-flex; align-items: center; justify-content: center; }
.ee-toolbar button:hover { background: var(--primary-soft); }
.ee-toolbar select { width: auto; padding: 4px 8px; height: 30px; }
.ee-toolbar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.ee-color { position: relative; font-weight: 700; color: var(--primary); }
.ee-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ee-canvas { border: 1px solid var(--border); border-top: 0; border-radius: 0 0 8px 8px; background: #f5f6f8; padding: 20px; margin-top: -12px; }
.ee-body { background: #fff; max-width: 600px; margin: 0 auto; min-height: 320px; padding: 28px 32px; border-radius: 10px; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 1.6; outline: none; box-shadow: 0 1px 3px rgba(18, 24, 38, .08); }
.ee-body:focus { box-shadow: 0 0 0 3px var(--primary-soft); }
.ee-body img { max-width: 100%; }
.ee-source { width: 100%; min-height: 360px; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
.merge-token, .merge-chip { display: inline-block; background: #f1e9ff; color: #6a3dc9; border: 1px solid #d9c8fb; border-radius: 999px; padding: 0 8px; font-size: .85em; font-weight: 600; white-space: nowrap; }
.merge-chip { cursor: grab; margin: 0 4px 6px 0; padding: 3px 10px; user-select: none; }
.merge-chip:hover { background: #e6d9ff; }
.ee-side { position: sticky; top: 16px; }
.ee-side h2 { margin-top: 0; }
.ee-side h2 + p { margin-top: 0; }
.ee-fields { margin-bottom: 18px; }
.ee-preview-dialog { width: min(720px, 96vw); }
.ee-preview-dialog iframe { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 8px; background: #f5f6f8; }
.cron-fields { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.cron-fields input { font-family: ui-monospace, Consolas, monospace; text-align: center; }

/* Questionario web pubblico */
.wf-body { background: #f0f2f6; }
.wf-wrap { max-width: 640px; margin: 0 auto; padding: 28px 16px 40px; }
.wf { background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 2px 10px rgba(18, 24, 38, .06); }
.wf-header h1 { font-size: 1.5rem; margin: 0 0 6px; }
.wf-header p { color: var(--muted); margin: 0 0 12px; }
.wf-progress { height: 6px; background: #e8ebf0; border-radius: 999px; overflow: hidden; margin: 14px 0 4px; }
.wf-progress span { display: block; height: 100%; background: var(--primary); width: 0; transition: width .3s; }
.wf-screen h2 { font-size: 1.15rem; margin: 18px 0 4px; }
.wf-field { margin: 18px 0; }
.wf-field h3 { margin: 0 0 6px; }
.wf-label { font-size: .95rem; font-weight: 600; margin-bottom: 4px; }
.wf-help { color: var(--muted); font-size: .85rem; margin-bottom: 6px; }
.wf-field input:not([type=checkbox]):not([type=radio]), .wf-field select, .wf-field textarea { padding: 11px 12px; font-size: 1rem; border-radius: 10px; }
.wf-options { display: grid; gap: 8px; }
.wf-option { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; cursor: pointer; font-size: .95rem; }
.wf-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.wf-privacy { border: 0; padding: 0; font-size: .88rem; align-items: flex-start; }
.wf-field.has-error input, .wf-field.has-error select, .wf-field.has-error textarea, .wf-field.has-error .wf-option { border-color: var(--err); }
.wf-error { color: var(--err); font-size: .82rem; margin-top: 4px; }
.wf-media { margin: 0; }
.wf-media img, .wf-media video { width: 100%; border-radius: 12px; display: block; }
.wf-media figcaption { color: var(--muted); font-size: .85rem; margin-top: 6px; text-align: center; }
.wf-video { position: relative; padding-top: 56.25%; border-radius: 12px; overflow: hidden; }
.wf-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.wf-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; }
.wf-nav .btn { padding: 11px 20px; font-size: .95rem; }
.wf-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.wf-thanks { text-align: center; }
.wf-thanks .btn { margin-top: 10px; }
.wf-preview-bar { background: var(--warn-soft); color: var(--warn); text-align: center; padding: 8px; border-radius: 8px; margin-bottom: 12px; font-size: .85rem; font-weight: 600; }
.wf-footer { text-align: center; margin-top: 16px; }

/* Pagine pubbliche */
.public-body { background: var(--surface); }
.public-wrap { max-width: 820px; margin: 0 auto; padding: 0 20px; }
.public-header { border-bottom: 1px solid var(--border); padding: 16px 0; margin-bottom: 28px; }
.public-footer { border-top: 1px solid var(--border); padding: 20px; margin-top: 40px; }
.legal { line-height: 1.65; }
.legal h1 { font-size: 1.9rem; }
.legal h2 { font-size: 1.2rem; margin: 2rem 0 .6rem; scroll-margin-top: 16px; }
.legal h3 { font-size: 1rem; }
.legal li { margin-bottom: 4px; }
.legal .table td { vertical-align: top; }
.legal .toc { background: var(--bg); border-radius: var(--radius); padding: 12px 16px; font-size: .88rem; line-height: 1.9; }
.legal .todo { background: var(--warn-soft); color: var(--warn); padding: 0 4px; border-radius: 4px; font-weight: 600; }

/* Auth */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 32px; width: 100%; max-width: 400px; }
.auth-card .brand { margin-bottom: 20px; }

/* Builder */
.builder { display: grid; grid-template-columns: 220px minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.palette, .props { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.palette h3 { font-size: .72rem; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; margin: 8px 0 6px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; cursor: grab; font-size: .86rem; background: #fff; user-select: none; }
.palette-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.palette-item.disabled { opacity: .4; cursor: not-allowed; }
.palette-item .icon { width: 22px; text-align: center; color: var(--primary); font-weight: 700; }
.canvas-head { color: var(--muted); font-size: .8rem; margin-bottom: 8px; }
.canvas { min-height: 400px; padding: 14px; border: 2px dashed transparent; border-radius: var(--radius); background: #eceff4; display: flex; flex-direction: column; gap: 10px; }
.canvas.drag-over { border-color: var(--primary); }
.canvas-empty { text-align: center; color: var(--muted); padding: 80px 20px; }
.field-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; position: relative; }
.field-card:hover { border-color: #b9c4d8; }
.field-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field-card.is-conditional { margin-left: 26px; border-left: 3px solid #8a63e0; }
.field-card.dragging { opacity: .4; }
.field-card.drop-before::before, .field-card.drop-after::after { content: ""; position: absolute; left: 0; right: 0; height: 3px; background: var(--primary); border-radius: 2px; }
.field-card.drop-before::before { top: -7px; }
.field-card.drop-after::after { bottom: -7px; }
.field-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.field-actions button { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 4px; }
.field-actions button:hover:not(:disabled) { background: #eef0f4; color: var(--text); }
.field-actions button:disabled { opacity: .3; }
.field-label { font-weight: 600; margin-bottom: 6px; }
.req { color: var(--err); }
.field-preview { pointer-events: none; display: grid; gap: 4px; }
.field-preview .opt { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.cond-note { margin-top: 8px; font-size: .78rem; color: #6a3dc9; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tabs button { background: none; border: 0; padding: 8px 10px; cursor: pointer; font: inherit; font-size: .85rem; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: flex; flex-direction: column; gap: 12px; }
.tab-panel[hidden] { display: none; }
.options-editor { display: grid; gap: 6px; }
.options-editor .label { font-size: .85rem; font-weight: 500; }
.option-row { display: flex; gap: 6px; }
fieldset.cond { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: grid; gap: 10px; margin: 0; }
fieldset.cond legend { font-size: .8rem; color: #6a3dc9; padding: 0 4px; }
.meta-check { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; display: grid; gap: 6px; font-size: .8rem; }
.meta-check h4 { margin: 0 0 4px; font-size: .8rem; }
.meta-ok { color: var(--ok); }
.meta-warn { background: var(--warn-soft); color: var(--warn); padding: 6px 8px; border-radius: 6px; }
.meta-err { background: var(--err-soft); color: var(--err); padding: 6px 8px; border-radius: 6px; }

/* Marketing */
.toolbar { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.stat small { font-size: .8rem; color: var(--muted); font-weight: 500; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; }
.status-active { background: var(--ok-soft); color: var(--ok); }
.status-paused, .status-campaign_paused, .status-adset_paused { background: #eef0f4; color: var(--muted); }
.status-with_issues, .status-disapproved { background: var(--err-soft); color: var(--err); }
.status-pending_review, .status-in_process { background: var(--warn-soft); color: var(--warn); }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .bar { fill: var(--primary); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit.on { fill: rgba(27, 92, 255, .06); }
.chart-tip { position: fixed; z-index: 50; background: #121826; color: #fff; font-size: .78rem; padding: 4px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; }
details.card > summary { margin: 0; }

/* Post */
.post-text { max-width: 420px; white-space: pre-line; }
.thumb-video { display: grid; place-items: center; background: #121826; color: #fff; font-size: .8rem; }
.err { color: var(--err); cursor: help; }
.composer { align-items: start; }
.feed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.feed-grid .card { margin-bottom: 0; }
.feed-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--text); font-size: .88rem; }
.feed-item:last-child { border-bottom: 0; }
.feed-item:hover { text-decoration: none; background: #fafbfc; }
.feed-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }

@media (max-width: 1100px) {
    .builder, .form-detail, .email-editor { grid-template-columns: 1fr; }
    .ee-side { position: static; }
    .form-detail > .card { position: static; }
    .palette, .props { position: static; max-height: none; }
}
@media (max-width: 760px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .main { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .cron-fields { grid-template-columns: repeat(3, 1fr); }
    .wf { padding: 20px 16px; }
    .span-2 { grid-column: auto; }
    .grid-2 { grid-template-columns: 1fr; }
}
