/* =========================================================
   Prime AutoDM – design tokens, dashboard and phone preview
   ========================================================= */
:root {
	--pad-ink: #231e4f;
	--pad-ink-2: #3b3470;
	--pad-marigold: #f0a830;
	--pad-paper: #faf9fd;
	--pad-wash: #f1eff8;
	--pad-line: #e3e0ee;
	--pad-text: #1c1a2b;
	--pad-muted: #6a6784;
	--pad-leaf: #1f8a5b;
	--pad-chili: #c2410c;
	--pad-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
	--pad-body: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.pad-app { color: var(--pad-text); font-family: var(--pad-body); line-height: 1.55; }
.pad-app *, .pad-app *::before, .pad-app *::after { box-sizing: border-box; }
.pad-app-wrap { padding-top: 40px; padding-bottom: 96px; }
.pad-app-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.pad-app-head .pad-muted { margin: 0 0 2px; }
.pad-app-title { font-size: clamp(2rem, 4vw, 2.6rem); font-weight: 800; margin: 0 !important; }
.pad-pill { font-size: 14px; font-weight: 600; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--pad-line); background: #fff; color: var(--pad-ink-2); }
.pad-pill-ok { border-color: #c6e7d5; background: #eef8f2; color: var(--pad-leaf); }
.pad-pill-off { border-color: #f2cdbd; background: #fdf1eb; color: var(--pad-chili); }
.pad-big { font-family: var(--pad-display); font-size: 1.6rem; font-weight: 700; color: var(--pad-ink); margin: 0 0 4px; }

/* Tabs */
.pad-tabs { display: flex; gap: 6px; padding: 5px; border-radius: 14px; background: var(--pad-wash); margin-bottom: 32px; overflow-x: auto; width: max-content; max-width: 100%; }
.pad-tab { padding: 9px 18px; border-radius: 10px; color: var(--pad-muted); text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap; transition: background-color 0.15s, color 0.15s; }
.pad-tab:hover { color: var(--pad-ink); }
.pad-tab.is-current { background: #fff; color: var(--pad-ink); box-shadow: 0 1px 2px rgba(35, 30, 79, 0.12); }
.pad-panel { animation: pad-panel-in 0.35s ease both; }
@keyframes pad-panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.pad-empty { padding: 44px; border: 1.5px dashed var(--pad-line); border-radius: 22px; background: #fff; text-align: center; }
.pad-empty p { color: var(--pad-muted); max-width: 46ch; margin: 0 auto 20px; }
.pad-error { color: var(--pad-chili) !important; }

/* Rules list */
.pad-list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.pad-list-head p { margin: 0; }
.pad-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.pad-rule { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding: 20px 22px; background: #fff; border: 1px solid var(--pad-line); border-radius: 18px; transition: border-color 0.15s; }
.pad-rule:hover { border-color: #cfcae3; }
.pad-rule.is-muted { background: var(--pad-paper); }
.pad-rule-main { min-width: 0; flex: 1 1 340px; }
.pad-rule-main p { margin: 0 0 3px; overflow-wrap: anywhere; }
.pad-rule-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 4px; }
.pad-rule-title h3 { font-size: 1.15rem; margin: 0 !important; }
.pad-rule-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.pad-rule-actions form { margin: 0; }
.pad-tag { font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--pad-wash); color: var(--pad-muted); }
.pad-tag-live { background: #e3f4ea; color: var(--pad-leaf); }
.pad-tag-live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--pad-leaf); margin-right: 6px; vertical-align: 1px; animation: pad-pulse 1.8s ease-in-out infinite; }
.pad-tag-wait { background: #fdf0d6; color: #7a5410; }
.pad-tag-err { background: #fdebe3; color: var(--pad-chili); }
.pad-review-note { background: #fdf1eb; border-left: 3px solid var(--pad-chili); padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: 14px; }
@keyframes pad-pulse { 50% { opacity: 0.35; } }

/* Builder */
.pad-builder-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.pad-builder-head .pad-h2 { font-size: 1.8rem; margin-bottom: 4px; }
.pad-template-strip { margin-bottom: 28px; }
.pad-strip-label { font-weight: 600; font-size: 14px; color: var(--pad-muted); margin: 0 0 10px; }
.pad-strip-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x proximity; }
.pad-tpl-pick { flex: none; scroll-snap-align: start; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 190px; max-width: 220px; padding: 14px 16px; border: 1.5px solid var(--pad-line); border-radius: 14px; background: #fff; font: inherit; text-align: left; cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.pad-tpl-pick:hover { border-color: var(--pad-ink); transform: translateY(-2px); }
.pad-tpl-pick strong { font-size: 14.5px; color: var(--pad-ink); line-height: 1.3; }
.pad-tpl-pick span { font-size: 12.5px; color: var(--pad-muted); }
.pad-tpl-pick.is-picked { border-color: var(--pad-ink); background: var(--pad-ink); }
.pad-tpl-pick.is-picked strong { color: #fff; }
.pad-tpl-pick.is-picked span { color: var(--pad-marigold); }

.pad-builder { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.pad-form { min-width: 0; }
.pad-block { border: 1px solid var(--pad-line); border-radius: 20px; background: #fff; padding: 22px 24px 8px; margin: 0 0 18px; }
.pad-block legend { display: flex; align-items: center; gap: 10px; float: left; width: 100%; font-family: var(--pad-display); font-weight: 700; font-size: 1.15rem; color: var(--pad-ink); margin-bottom: 18px; padding: 0; }
.pad-block legend + * { clear: both; }
.pad-block legend em { font-family: var(--pad-body); font-style: normal; font-weight: 500; font-size: 14px; color: var(--pad-muted); }
.pad-block-n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--pad-ink); color: #fff; font-size: 14px; flex: none; }
.pad-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.pad-mt { margin-top: 10px; }
.pad-insert { border: 0; background: var(--pad-wash); color: var(--pad-ink); font: inherit; font-size: 12.5px; font-weight: 600; padding: 3px 8px; border-radius: 6px; cursor: pointer; margin-right: 6px; }
.pad-app [hidden] { display: none !important; }

.pad-segment { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 14px; background: var(--pad-wash); margin-bottom: 18px; }
.pad-segment label { position: relative; cursor: pointer; }
.pad-segment input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pad-segment span { display: block; text-align: center; padding: 11px 10px; border-radius: 10px; font-weight: 600; font-size: 15px; color: var(--pad-muted); transition: background-color 0.2s, color 0.2s; }
.pad-segment input:checked + span { background: #fff; color: var(--pad-ink); box-shadow: 0 1px 3px rgba(35, 30, 79, 0.14); }
.pad-segment input:focus-visible + span { outline: 3px solid var(--pad-marigold); }

.pad-switch-row { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px; background: var(--pad-paper); border: 1px solid var(--pad-line); cursor: pointer; margin-bottom: 18px; position: relative; }
.pad-switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pad-switch-row strong { display: block; color: var(--pad-ink); }
.pad-switch-row small { color: var(--pad-muted); font-size: 13.5px; }
.pad-toggle { position: relative; flex: none; width: 46px; height: 26px; border-radius: 26px; background: #cfcbe0; transition: background-color 0.2s; }
.pad-toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.pad-switch-row input:checked + .pad-toggle { background: var(--pad-ink); }
.pad-switch-row input:checked + .pad-toggle::after { transform: translateX(20px); }
.pad-switch-row input:focus-visible + .pad-toggle { outline: 3px solid var(--pad-marigold); outline-offset: 2px; }
.pad-card-fields { animation: pad-panel-in 0.3s ease both; }

.pad-upload { display: flex; gap: 14px; align-items: center; }
.pad-upload-thumb { flex: none; width: 76px; height: 76px; border-radius: 14px; background: var(--pad-wash) center / cover no-repeat; border: 1.5px dashed #cfcae3; position: relative; }
.pad-upload-thumb:not([style*="background-image"])::after { content: ""; position: absolute; inset: 24px; border: 2px solid #b8b2d6; border-radius: 4px; }
.pad-upload-thumb[style*="background-image"] { border-style: solid; border-color: var(--pad-line); }
.pad-upload small { display: block; margin-top: 6px; }
.pad-file { position: relative; overflow: hidden; }
.pad-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pad-remove-img { font-size: 14px; margin-left: 8px; }
.pad-uploading .pad-upload-thumb { animation: pad-pulse 1s ease-in-out infinite; }

.pad-form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* Sticky preview column */
.pad-preview-col { position: sticky; top: 96px; }
.admin-bar .pad-preview-col { top: 128px; }
.pad-preview-sticky { display: flex; flex-direction: column; align-items: center; }
.pad-preview-label { align-self: flex-start; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--pad-ink); margin: 0 0 12px; }
.pad-live-dot { width: 9px; height: 9px; border-radius: 50%; background: #e0245e; animation: pad-pulse 1.4s ease-in-out infinite; }
.pad-preview-note { font-size: 13px; text-align: center; margin-top: 12px; }

/* Account / connect */
.pad-account-card { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 24px; border-radius: 20px; border: 1px solid var(--pad-line); background: #fff; margin-bottom: 20px; }
.pad-account-card > div { flex: 1; min-width: 200px; }
.pad-account-card form { margin: 0; }
.pad-avatar { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; font-family: var(--pad-display); font-weight: 800; font-size: 1.5rem; color: var(--pad-ink); background: #fff; box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--pad-marigold); }
.pad-help { padding: 24px 28px; border-radius: 20px; background: var(--pad-wash); }
.pad-help h3 { font-size: 1.15rem; }
.pad-help ol { margin: 0; padding-left: 20px; }
.pad-help li { margin-bottom: 8px; }
.pad-connect { display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: center; padding: 40px; border-radius: 24px; background: #fff; border: 1px solid var(--pad-line); }
.pad-plan-status { padding: 24px; border-radius: 20px; background: #fff; border: 1px solid var(--pad-line); margin-bottom: 12px; }
.pad-plan-status .pad-muted { margin: 0; }

/* Activity */
.pad-log { list-style: none; margin: 0; padding: 0; position: relative; }
.pad-log::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--pad-line); }
.pad-log li { position: relative; padding: 4px 0 18px 34px; }
.pad-log li::before { content: ""; position: absolute; left: 0; top: 8px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--pad-leaf); }
.pad-log li.pad-log-failed::before { border-color: var(--pad-chili); }
.pad-log li.pad-log-skipped::before { border-color: var(--pad-marigold); }
.pad-log time { font-size: 13px; color: var(--pad-muted); }
.pad-log p { margin: 2px 0; overflow-wrap: anywhere; }

/* =========================================================
   Phone preview (pv-*). Rendered by app.js from JSON.
   ========================================================= */
.pad-demo { width: 300px; max-width: 100%; }
.pv-phone { position: relative; width: 100%; padding: 10px; border-radius: 46px; background: #17142f; box-shadow: 0 40px 60px -30px rgba(23, 20, 47, 0.55), inset 0 0 0 2px #2c2852; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, var(--pad-body), sans-serif; }
.pv-notch { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 84px; height: 22px; border-radius: 20px; background: #17142f; z-index: 2; }
.pv-screen { background: #fff; border-radius: 37px; min-height: 540px; overflow: hidden; display: flex; flex-direction: column; }
.pv-top { display: flex; align-items: center; gap: 10px; padding: 46px 16px 12px; border-bottom: 1px solid #efeff3; }
.pv-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 700; font-size: 14px; color: var(--pad-ink); background: #fff; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--pad-marigold); flex: none; }
.pv-top strong { display: block; font-size: 14px; color: #111; line-height: 1.2; }
.pv-top small { font-size: 11.5px; color: #8e8e93; }
.pv-body { flex: 1; padding: 14px 12px 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; line-height: 1.38; }
.pv-context { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 14px; background: #f7f7f9; margin-bottom: 6px; }
.pv-post { flex: none; width: 42px; height: 52px; border-radius: 8px; background: linear-gradient(160deg, #f0a830, #e1306c 60%, #833ab4); position: relative; }
.pv-post::after { content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-35%, -50%); border-left: 9px solid rgba(255, 255, 255, 0.9); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.pv-context p { margin: 0 !important; font-size: 12.5px; color: #333; }
.pv-context b { color: #111; }
.pv-context .pv-reply { margin-top: 6px !important; padding-left: 10px; border-left: 2px solid #e4e4ea; color: #555; }
.pv-msg { max-width: 82%; padding: 9px 13px; border-radius: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pv-creator { align-self: flex-start; background: #efeff4; color: #111; border-bottom-left-radius: 6px; }
.pv-follower { align-self: flex-end; background: #7a4df0; color: #fff; border-bottom-right-radius: 6px; }
.pv-chips { align-self: flex-end; display: flex; gap: 6px; }
.pv-chip { border: 1.5px solid #7a4df0; color: #7a4df0; border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 12.5px; background: #fff; }
.pv-tap { align-self: center; font-size: 11px; color: #8e8e93; }
.pv-card { align-self: flex-start; width: 82%; border-radius: 18px; overflow: hidden; border: 1px solid #e6e6ec; background: #fff; }
.pv-card-img { aspect-ratio: 1.91 / 1; background: #f1eff8 center / cover no-repeat; position: relative; }
.pv-card-img.is-empty { background: repeating-linear-gradient(135deg, #f6e3bd 0 12px, #f9ecd1 12px 24px); }
.pv-card-img.is-empty::after { content: "Your image"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #8a6a2a; }
.pv-card-body { padding: 10px 12px 4px; }
.pv-card-body strong { display: block; font-size: 13.5px; color: #111; }
.pv-card-body small { display: block; font-size: 12.5px; color: #6e6e73; margin-top: 2px; }
.pv-card-btn { display: block; margin: 8px 10px 10px; padding: 8px; border-radius: 10px; background: #efeff4; text-align: center; font-weight: 600; font-size: 13px; color: #0a66d6; }
.pv-empty-hint { align-self: center; margin-top: 40px; text-align: center; color: #8e8e93; font-size: 13px; max-width: 200px; }

/* Step-by-step animation for demos; builder & admin previews show everything at once */
.pad-demo [data-step] { opacity: 0; transform: translateY(10px) scale(0.98); transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.pad-demo [data-step].is-on, .pv-static [data-step] { opacity: 1; transform: none; }
.pad-demo.is-fading [data-step] { opacity: 0; transition-duration: 0.6s; }
.pv-static .pv-msg, .pv-static .pv-card, .pv-static .pv-context { animation: pv-pop 0.25s ease; }
@keyframes pv-pop { from { transform: scale(0.98); } to { transform: none; } }
.pv-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; border-radius: 20px; background: #efeff4; }
.pv-typing i { width: 6px; height: 6px; border-radius: 50%; background: #9a9aa3; animation: pv-dot 1s infinite; }
.pv-typing i:nth-child(2) { animation-delay: 0.15s; }
.pv-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes pv-dot { 0%, 60%, 100% { transform: none; opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Admin approvals layout */
.pad-review { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; }
.pad-review-form { margin-top: 16px; }

/* Responsive */
@media (max-width: 980px) {
	.pad-builder { grid-template-columns: 1fr; }
	.pad-preview-col { position: static; order: -1; }
	.pad-connect { grid-template-columns: 1fr; justify-items: center; text-align: left; }
	.pad-review { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
	.pad-field-row { grid-template-columns: 1fr; }
	.pad-block { padding: 18px 16px 4px; }
	.pad-connect, .pad-empty { padding: 24px; }
	.pad-tabs { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
	.pad-app *, .pad-demo * { animation: none !important; transition: none !important; }
	.pad-demo [data-step] { opacity: 1; transform: none; }
}
