:root {
  color-scheme: light;
  --bg: #f3f5f9;
  --panel: #fff;
  --ink: #162033;
  --muted: #677085;
  --line: #dfe4ec;
  --brand: #3159df;
  --brand-dark: #2144bb;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(25, 38, 65, .08);
}

* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
a { color: inherit; }
button, input, textarea, select { font: inherit; }

.admin-nav { height: 68px; padding: 0 max(24px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.admin-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; letter-spacing: -.02em; }
.admin-brand span, .brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: linear-gradient(135deg, #3159df, #7c3aed); box-shadow: 0 7px 20px rgba(49,89,223,.28); }
.nav-link { appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer; }

.admin-shell { width: min(1180px, calc(100% - 36px)); margin: 42px auto 80px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); line-height: 1.1; letter-spacing: -.045em; }
.eyebrow { margin: 0 0 7px; font-size: 11px; font-weight: 800; letter-spacing: .14em; color: var(--brand); }
.muted { color: var(--muted); }
.page-heading .muted { margin: 8px 0 0; }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--muted); text-decoration: none; }

.button { min-height: 42px; padding: 9px 15px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); font-weight: 750; text-decoration: none; cursor: pointer; transition: .18s ease; }
.button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(20,35,60,.1); }
.button-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.button-primary:hover { background: var(--brand-dark); }
.button-danger { color: var(--danger); border-color: #f1b8b3; background: #fff8f7; }
.button-small { min-height: 34px; padding: 5px 11px; font-size: 13px; }
.button-wide { width: 100%; margin-top: 10px; }

.panel { background: var(--panel); border: 1px solid rgba(216,222,232,.9); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 22px; }
.panel-head { padding: 20px 22px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head span { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 22px; text-align: left; border-bottom: 1px solid #edf0f5; white-space: nowrap; }
th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: #fbfcfe; }
tbody tr:last-child td { border-bottom: 0; }
.slug-link { color: var(--brand); font-size: 13px; text-decoration: none; }
.status { display: inline-flex; padding: 4px 9px; border-radius: 100px; font-size: 12px; font-weight: 700; }
.status-live { background: #e9f8ef; color: #08783b; }
.status-draft { background: #eef1f5; color: #606b7b; }
.actions { text-align: right; }
code { padding: 2px 5px; border-radius: 5px; background: #edf1f7; font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.empty { padding: 22px; color: var(--muted); }

.alert { padding: 14px 16px; border-radius: 12px; margin: 0 0 20px; border: 1px solid transparent; }
.alert-success { color: #09633a; background: #eaf8f0; border-color: #bce5cc; }
.alert-error { color: #8d2219; background: #fff1ef; border-color: #f0c4c0; }
.alert-warning { color: #764b00; background: #fff8df; border-color: #ecd48a; }
.alert ul { margin: 7px 0 0; }

.editor-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 22px; align-items: start; }
.form-panel { padding: 24px; overflow: visible; }
.section-title { display: flex; gap: 13px; align-items: start; padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.section-title > span { flex: 0 0 auto; color: var(--brand); font-weight: 850; font-size: 12px; }
.section-title h2 { margin: 0; font-size: 18px; }
.section-title p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
label { display: grid; gap: 7px; margin-bottom: 17px; font-weight: 700; font-size: 13px; }
label small { font-weight: 400; color: var(--muted); }
input, textarea, select { width: 100%; padding: 11px 12px; border: 1px solid #ccd3df; border-radius: 10px; background: #fff; color: var(--ink); outline: none; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(49,89,223,.12); }
input[type="color"] { min-height: 46px; padding: 5px; }
.field-grid { display: grid; gap: 14px; }
.field-grid.two { grid-template-columns: 1fr 1fr; }
.field-grid.three { grid-template-columns: repeat(3, 1fr); }
.check-row { display: flex; gap: 11px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 11px; }
.check-row input { width: 18px; margin-top: 3px; }
.check-row span { display: grid; }
.tracking-note { padding: 15px; border-radius: 12px; background: #f1f4ff; border: 1px solid #d8e0ff; }
.tracking-note p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

/* Visual landing-page editor */
.visual-editor-shell { width: min(1520px, calc(100% - 32px)); }
.visual-editor-layout { display: grid; grid-template-columns: minmax(560px, 1fr) 430px; gap: 24px; align-items: start; }
.editor-panels { min-width: 0; }
.template-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.template-card { min-height: 145px; padding: 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--ink); cursor: pointer; transition: .16s ease; }
.template-card:hover { transform: translateY(-2px); border-color: #aeb9d0; box-shadow: 0 8px 20px rgba(25,38,65,.08); }
.template-card.is-active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(49,89,223,.11); }
.template-swatch { width: 30px; height: 7px; margin-bottom: 7px; border-radius: 99px; background: var(--swatch); }
.template-card strong { font-size: 14px; }
.template-card small { color: var(--brand); font-size: 11px; font-weight: 700; }
.template-card em { margin-top: auto; color: var(--muted); font-size: 11px; line-height: 1.45; font-style: normal; }
.module-title { margin-bottom: 14px; }
.module-toolbar { display: flex; gap: 10px; margin-bottom: 14px; padding: 12px; border-radius: 12px; background: #f5f7fb; }
.module-toolbar select { flex: 1; margin: 0; }
.block-list { display: grid; gap: 12px; }
.block-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease; }
.block-card.is-dragging { opacity: .45; }
.block-card.is-drop-target { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(49,89,223,.12); }
.block-card > header { min-height: 59px; padding: 10px 11px; display: flex; align-items: center; gap: 10px; background: #f9fafc; border-bottom: 1px solid var(--line); cursor: grab; }
.block-card > header:active { cursor: grabbing; }
.drag-handle { width: 25px; color: #8a94a8; font-size: 18px; letter-spacing: -4px; user-select: none; }
.block-card > header > div:nth-child(2) { min-width: 0; display: grid; flex: 1; }
.block-card > header strong { font-size: 13px; }
.block-card > header small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.block-actions { display: flex; gap: 4px; }
.icon-button { width: 30px; height: 30px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #536076; cursor: pointer; }
.icon-button:hover { color: var(--brand); border-color: #b9c6ec; }
.delete-block:hover, .remove-image:hover { color: var(--danger); border-color: #efb7b2; }
.block-fields { padding: 16px; }
.block-fields label:last-child { margin-bottom: 0; }
.mini-check { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; }
.mini-check input { width: 17px; margin: 0; }
.image-input-row { display: flex; gap: 7px; }
.image-input-row input { min-width: 0; flex: 1; }
.image-input-row .button, .image-input-row .icon-button { flex: 0 0 auto; }
.block-fields input[type="range"] { padding: 0; }
.block-fields output { color: var(--muted); font-weight: 500; }

.preview-panel { position: sticky; top: 86px; overflow: hidden; border: 1px solid #d9dfe9; border-radius: 19px; background: #171c28; box-shadow: 0 24px 60px rgba(20,30,52,.2); }
.preview-toolbar { min-height: 58px; padding: 10px 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #fff; background: #202735; }
.preview-toolbar > div:first-child { display: grid; }
.preview-toolbar strong { font-size: 13px; }
.preview-toolbar small { color: #aeb7c8; font-size: 10px; }
.preview-sizes { display: flex; gap: 4px; padding: 3px; border-radius: 9px; background: rgba(0,0,0,.24); }
.preview-sizes button { padding: 5px 8px; border: 0; border-radius: 6px; color: #acb5c7; background: transparent; font-size: 11px; cursor: pointer; }
.preview-sizes button.is-active { color: #192131; background: #fff; }
.preview-stage { height: calc(100vh - 170px); min-height: 650px; padding: 16px 14px 30px; overflow: auto; display: flex; justify-content: center; background: #111620; }
.live-preview { width: 390px; min-width: 390px; min-height: 720px; overflow: hidden; border-radius: 18px; background: #fff; box-shadow: 0 12px 45px rgba(0,0,0,.38); transition: width .2s ease, min-width .2s ease; }
.preview-stage.is-desktop { justify-content: flex-start; }
.preview-stage.is-desktop .live-preview { width: 820px; min-width: 820px; }
.pv-page { min-height: 100%; color: var(--pv-text); background: var(--pv-bg); font: 12px/1.55 Inter, ui-sans-serif, system-ui, sans-serif; }
.pv-block { margin: 0; padding: 25px 22px; }
.pv-hero { display: grid; gap: 18px; padding-top: 38px; }
.pv-copy small { display: inline-flex; margin-bottom: 12px; padding: 5px 8px; border: 1px solid color-mix(in srgb, var(--pv-accent), transparent 35%); border-radius: 99px; color: var(--pv-accent); font-size: 8px; font-weight: 850; letter-spacing: .12em; }
.pv-copy h1 { margin: 0; color: var(--pv-text); font-size: 34px; line-height: 1.02; letter-spacing: -.05em; }
.pv-copy p { margin: 13px 0 0; color: color-mix(in srgb, var(--pv-text), transparent 32%); font-size: 13px; }
.pv-copy button, .pv-cta button { margin-top: 18px; padding: 12px 16px; border: 0; border-radius: 10px; color: #fff; background: var(--pv-accent); font-weight: 800; }
.pv-hero-image, .pv-image { min-height: 245px; overflow: hidden; border-radius: 16px; background: color-mix(in srgb, var(--pv-accent), #101725 77%); }
.pv-hero-image img, .pv-image img, .pv-gallery img { width: 100%; height: 100%; display: block; object-fit: cover; }
.pv-placeholder { min-height: inherit; display: grid; place-content: center; padding: 20px; text-align: center; color: #fff; background: radial-gradient(circle at 75% 20%, var(--pv-accent), transparent 28%), linear-gradient(145deg, color-mix(in srgb, var(--pv-accent), #101725 58%), #101725); }
.pv-placeholder span { font-size: 8px; letter-spacing: .17em; opacity: .7; }
.pv-placeholder strong { margin-top: 6px; font-size: 13px; }
.pv-ticker { padding: 9px 0; overflow: hidden; display: flex; gap: 18px; color: #fff; background: #151922; white-space: nowrap; }
.pv-ticker span { padding-left: 18px; font-size: 9px; }
.pv-heading h2, .pv-text h2 { margin: 0; font-size: 23px; line-height: 1.1; letter-spacing: -.035em; }
.pv-heading p, .pv-text p { margin: 9px 0 0; color: color-mix(in srgb, var(--pv-text), transparent 35%); }
.pv-image { margin-top: 14px; }
.pv-square { aspect-ratio: 1; }.pv-landscape { aspect-ratio: 4/3; }.pv-portrait { aspect-ratio: 3/4; }
.pv-gallery { margin-top: 14px; display: grid; gap: 7px; }.pv-gallery.cols-2 { grid-template-columns: repeat(2,1fr); }.pv-gallery.cols-3 { grid-template-columns: repeat(3,1fr); }
.pv-gallery > div { aspect-ratio: 1; overflow: hidden; border-radius: 9px; background: color-mix(in srgb, var(--pv-accent), #fff 84%); }
.pv-empty { display: grid; place-items: center; color: var(--pv-accent); font-size: 22px; }
.pv-text.align-center { text-align: center; }.pv-text.style-card, .pv-cta.style-card { margin: 11px 16px; border-radius: 14px; background: #fff; box-shadow: 0 10px 25px rgba(25,35,55,.08); }.pv-text.style-dark, .pv-cta.style-dark { margin: 11px 16px; border-radius: 14px; color: #fff; background: #171b25; }.pv-text.style-dark p, .pv-cta.style-dark p { color: rgba(255,255,255,.7); }
.pv-features { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pv-features > div { padding: 12px; display: flex; gap: 7px; align-items: flex-start; border: 1px solid color-mix(in srgb, var(--pv-text), transparent 87%); border-radius: 10px; background: rgba(255,255,255,.45); font-weight: 700; }
.pv-features span { color: var(--pv-accent); }
.pv-quote { margin: 11px 16px; border-left: 3px solid var(--pv-accent); background: rgba(255,255,255,.55); }
.pv-quote p { margin: 0; font: 700 17px/1.45 Georgia, serif; }.pv-quote cite { display: block; margin-top: 9px; color: color-mix(in srgb, var(--pv-text), transparent 40%); font-style: normal; }
.pv-cta { text-align: center; }.pv-cta p { margin: 0; }.pv-cta button { width: 100%; }
.pv-footer { padding: 30px 20px 85px; text-align: center; color: color-mix(in srgb, var(--pv-text), transparent 65%); font-size: 9px; }
.preview-stage.is-desktop .pv-hero { grid-template-columns: 1fr 1fr; align-items: center; padding: 55px 48px; }.preview-stage.is-desktop .pv-copy h1 { font-size: 45px; }.preview-stage.is-desktop .pv-block:not(.pv-hero) { padding-left: 48px; padding-right: 48px; }
.editor-savebar { position: sticky; z-index: 15; bottom: 12px; margin-top: 22px; padding: 13px 15px; display: flex; justify-content: space-between; align-items: center; gap: 18px; border: 1px solid #d1d8e5; border-radius: 14px; background: rgba(255,255,255,.95); box-shadow: 0 14px 40px rgba(25,38,65,.16); backdrop-filter: blur(12px); }
.editor-savebar > span { color: var(--muted); font-size: 12px; }.editor-savebar > div { display: flex; gap: 8px; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left, #dfe7ff, transparent 34%), radial-gradient(circle at bottom right, #e9dcff, transparent 35%), var(--bg); }
.login-card { width: min(430px, 100%); padding: 34px; background: rgba(255,255,255,.94); border: 1px solid rgba(255,255,255,.8); border-radius: 22px; box-shadow: 0 24px 70px rgba(25,38,65,.16); }
.login-card h1 { margin: 18px 0 2px; font-size: 29px; letter-spacing: -.035em; }
.login-card .muted { margin: 0 0 24px; }
.stack { display: grid; gap: 2px; }
.stack .button { margin-top: 3px; }
.setup-note { margin: 20px 0 0; font-size: 12px; color: var(--muted); }

@media (max-width: 820px) {
  .editor-grid { grid-template-columns: 1fr; }
  .field-grid.two { grid-template-columns: 1fr; }
  .page-heading { align-items: start; }
}

@media (max-width: 1120px) {
  .visual-editor-layout { grid-template-columns: 1fr; }
  .preview-panel { position: relative; top: auto; }
  .template-picker { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 560px) {
  .admin-shell { width: min(100% - 24px, 1180px); margin-top: 26px; }
  .admin-nav { padding: 0 14px; }
  .page-heading { display: grid; }
  .page-heading .button { width: 100%; }
  .form-panel { padding: 18px; }
  .field-grid.three { grid-template-columns: 1fr; }
  .template-picker { grid-template-columns: 1fr; }
  .module-toolbar, .editor-savebar { align-items: stretch; flex-direction: column; }
  .editor-savebar > div { display: grid; }
  .live-preview { width: 360px; min-width: 360px; }
}


.admin-nav-actions { display:flex; align-items:center; gap:18px; }
.account-shell { max-width:700px; }
.block-card > header, .block-card > header:active { cursor:default; }
.drag-handle { border:0; background:transparent; padding:8px; min-width:32px; cursor:grab; touch-action:none; user-select:none; color:#8791a5; }
.drag-handle:active { cursor:grabbing; }
.preview-stage { min-height:0; height:calc(100dvh - 240px); max-height:900px; display:block; scroll-padding-bottom:30px; }
.live-preview { height:auto; min-height:720px; margin:0 auto; overflow:hidden; }
.preview-stage.is-desktop .live-preview { margin-left:0; }
.pv-video { width:100%; display:block; border-radius:14px; background:#111; max-height:550px; }
@media(max-width:1100px) { .preview-stage { height:70dvh; min-height:350px; } }
@media(max-width:580px) { .admin-nav { padding:0 12px; } .admin-nav-actions { gap:8px; } .admin-brand { font-size:12px; } }
