*{box-sizing:border-box}
html{background:#f3f4f6}
body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;color:#111827}
header{position:sticky;top:0;z-index:5;display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:#111827;color:#fff;box-shadow:0 1px 6px #0002}
header strong{display:block;font-size:16px}
header small{display:block;opacity:.72;margin-top:2px}
main{max-width:760px;margin:auto;padding:12px 12px calc(30px + env(safe-area-inset-bottom))}
.card,.brandbar{background:#fff;border:1px solid #e5e7eb;border-radius:14px;padding:16px;margin:0 0 12px;box-shadow:0 1px 2px #0000000d}
.brandbar{padding:12px 16px}
h1{font-size:22px;margin:0 0 16px}
h2{font-size:18px;margin:0 0 12px}
label{display:block;font-weight:650;margin:12px 0 6px}
.row{display:flex;gap:8px}
input,select,textarea,button,summary{font:inherit}
input,select,textarea{width:100%;border:1px solid #cbd5e1;border-radius:10px;padding:12px;background:#fff;font-size:16px}
textarea{min-height:120px;resize:vertical}
button{min-height:46px;border:0;border-radius:10px;padding:10px 16px;font-weight:700;cursor:pointer}
.primary{background:#111827;color:#fff}
.secondary{background:#e5e7eb;color:#111827}
.full{width:100%;margin-top:14px}
.textbtn{background:transparent;min-height:auto;padding:4px 0}
.platform{border-top:1px solid #e5e7eb;padding:12px 0}
.platform:first-child{border-top:0}
.platform label{display:flex;align-items:center;gap:9px;margin:0 0 8px;text-transform:capitalize}
.platform input[type=checkbox]{width:22px;height:22px}
.sectionhead{display:flex;justify-content:space-between;align-items:center}
.postactions{display:grid;gap:10px;margin-top:8px}
.postactions>.primary{width:100%;min-height:54px;font-size:17px}
details{border:1px solid #e5e7eb;border-radius:10px;padding:10px}
summary{font-weight:700;cursor:pointer}
details input{margin-top:10px}
.chips{display:grid;gap:8px}
.chips span{display:flex;justify-content:space-between;padding:10px 12px;background:#f8fafc;border-radius:9px}
.chips b{font-size:13px;color:#6b7280}
.history{padding:10px 0;border-bottom:1px solid #e5e7eb;font-size:14px}
.history:last-child{border-bottom:0}
.muted{color:#6b7280;font-weight:400;font-size:13px}
#status{font-weight:650}
#install{background:#fff;color:#111827;min-height:36px;padding:6px 10px}
.destination{display:flex;align-items:center;gap:10px;padding:10px;border:1px solid #e5e7eb;border-radius:10px;margin-bottom:8px}
.destination input{width:auto;margin:0}
.destination span{display:flex;flex-direction:column}
.destination small{color:#6b7280;text-transform:capitalize}
.destinations{margin-bottom:14px}
@media(min-width:640px){main{padding:20px}
.postactions{grid-template-columns:1fr 1fr}
.card,.brandbar{padding:20px}
}
@media(min-width:900px){main{max-width:1180px;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;align-items:start;padding:28px}
.card,.brandbar{margin:0}
.brandbar,#posts{grid-column:1/-1}
header{padding:14px max(24px,calc((100vw - 1180px)/2 + 28px))}
}
.wide{grid-column:1/-1}.tabs{display:flex;gap:6px;overflow:auto;margin-top:10px}.tabs button{white-space:nowrap;min-height:36px;padding:7px 10px;background:#f3f4f6}.twocol{display:grid;gap:10px}.namegrid{display:grid;gap:8px;margin-top:14px}.namechoice{display:flex;align-items:center;justify-content:space-between;gap:10px;border:1px solid #e5e7eb;border-radius:10px;padding:10px}.namechoice div{min-width:0}.namechoice small{display:block;color:#6b7280}.plan{border-top:1px solid #e5e7eb;padding:12px 0}.plan:first-child{border-top:0}.plan h3{margin:0 0 8px;text-transform:capitalize}.plan h4{font-size:13px;margin:10px 0 4px}.plan ul{margin:4px 0 8px;padding-left:20px}.plan li{margin:4px 0}.pill{display:inline-block;background:#f3f4f6;border-radius:999px;padding:5px 8px;margin:2px;font-size:12px}.topgap{margin-top:22px!important}@media(min-width:640px){.twocol{grid-template-columns:1fr 1fr}.namegrid{grid-template-columns:1fr 1fr}}

#launch,#profile,#algorithm,#publisher{scroll-margin-top:88px}
.campaign-presets{display:flex;gap:10px;flex-wrap:wrap;margin:10px 0 16px}.threecol{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.campaign-calendar{margin-top:18px;border-top:1px solid #e5e7eb}.campaign-item{padding:12px 0;border-bottom:1px solid #e5e7eb}.campaign-item small{display:block;color:#6b7280;margin-bottom:4px}.campaign-item textarea{min-height:88px;margin-top:8px}@media(max-width:760px){.threecol{grid-template-columns:1fr}}

/* V0.7 KISS cleanup */
:root{--brand:#2563eb;--brand-soft:#eff6ff;--success:#15803d;--success-soft:#f0fdf4;--attention:#b45309;--attention-soft:#fffbeb;--danger:#b91c1c;--ink:#111827}
header{background:linear-gradient(100deg,#111827,#1e3a8a)}
.primary{background:var(--brand)}
.primary:hover{filter:brightness(.96)}
.tabs button{color:#1e3a8a;background:#eff6ff}
.action-card{border-top:4px solid var(--brand)}
.campaign-card{border-top:4px solid #7c3aed}
.accent-card{border-top:4px solid #0891b2}
.brand-kit{border-top:4px solid #d97706;background:linear-gradient(180deg,#fff,#fffbeb)}
.advanced{background:#f8fafc;border-style:dashed}
.advanced>summary,.clean-details>summary{list-style:none;display:flex;align-items:center;justify-content:space-between;padding:2px;cursor:pointer}
.advanced>summary::-webkit-details-marker,.clean-details>summary::-webkit-details-marker{display:none}
.advanced>summary:after,.clean-details>summary:after{content:'▾';font-size:18px;color:#64748b}
.advanced[open]>summary:after,.clean-details[open]>summary:after{content:'▴'}
.advanced summary span,.clean-details summary span{display:flex;flex-direction:column;gap:2px}
.advanced summary small,.clean-details summary small{font-weight:400;color:#64748b}
.advanced-body{padding-top:14px}
.clean-details{border:0;padding:0}
#scheduledDetails{background:#f8fafc;border:1px solid #e2e8f0;padding:12px;border-radius:12px}
#scheduledDetails[open]{background:#fff}
#scheduled .history b{color:#1d4ed8}
.history-detail{margin-top:5px}
.legal-note{font-size:12px;line-height:1.45;color:#64748b;background:#f8fafc;padding:10px;border-radius:8px;margin-top:12px}
.logo-choice{padding:10px 12px;border-radius:10px;background:#fff7ed;margin-bottom:10px}
.logo-choice p{margin:4px 0 0}
#logoPrompt:empty{display:none}
@media(min-width:900px){.brandbar{position:sticky;top:72px;z-index:4}}
.auth-gate{position:fixed;inset:0;z-index:1000;background:#f3f6fb;display:grid;place-items:center;padding:20px}.auth-gate[hidden]{display:none}.auth-card{width:min(430px,100%);background:white;border:1px solid #dbe3ef;border-radius:18px;padding:28px;box-shadow:0 18px 55px rgba(15,23,42,.12)}.auth-logo{width:54px;height:54px;border-radius:14px;display:grid;place-items:center;background:#2563eb;color:white;font-weight:800;margin-bottom:18px}.auth-card h1{margin:0 0 6px}.auth-card input{width:100%;box-sizing:border-box}.auth-note{font-size:.82rem;color:#64748b;text-align:center;margin:18px 0 0}.header-actions{display:flex;align-items:center;gap:10px}.header-actions span{font-size:.85rem;color:#64748b}@media(max-width:650px){.header-actions span{display:none}}
#scheduled .scheduled-item{width:100%;text-align:left;background:transparent;border:0;border-bottom:1px solid #e2e8f0;padding:12px 0;cursor:pointer;color:inherit;font:inherit}
#scheduled .scheduled-item:hover,#scheduled .scheduled-item:focus{background:#f8fafc;outline:2px solid transparent}
#scheduled .scheduled-preview{display:block;color:#475569;margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.scheduled-dialog{border:0;border-radius:16px;padding:0;width:min(680px,calc(100% - 28px));max-height:90%;box-shadow:0 20px 60px rgba(15,23,42,.25)}
.scheduled-dialog::backdrop{background:rgba(15,23,42,.5)}
.scheduled-dialog-card{padding:22px;margin:0;overflow:auto;max-height:85vh}
.scheduled-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px}.scheduled-actions button{flex:1;min-width:180px}
button.danger{background:#fff;border:1px solid #b91c1c;color:#991b1b}

.x-choice{border:1px solid #e2e8f0;border-radius:12px;padding:14px;margin:12px 0}.x-choice h3{margin:0 0 5px}.x-choice p{color:#64748b;margin:0 0 12px}.x-profile-kit{background:#f8fafc;border-radius:10px;padding:10px;margin:10px 0}.x-profile-kit>div{display:grid;grid-template-columns:90px 1fr;gap:8px;padding:5px 0;border-top:1px solid #e2e8f0}.x-profile-kit span{color:#64748b}.x-profile-kit strong{overflow-wrap:anywhere}.x-note{text-align:center}

.quick-connect{display:flex;gap:10px;flex-wrap:wrap;margin:12px 0 16px}.quick-connect button{flex:1;min-width:180px}.x-button{background:#111827;color:#fff}.connection-choice{width:100%;display:flex;flex-direction:column;align-items:flex-start;text-align:left;gap:4px;margin:10px 0;padding:15px;border:1px solid #cbd5e1;background:#fff}.connection-choice span{font-weight:400;color:#64748b}.connection-choice.x-button{background:#111827;border-color:#111827}.connection-choice.x-button span{color:#e2e8f0}.other-platforms{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px}.other-platforms button{background:#f8fafc;border:1px solid #e2e8f0}

/* V0.9.11 Incoming Communications */
.incoming-card{border-top:4px solid #0f766e}.incoming-card .sectionhead{gap:12px}.incoming-card .sectionhead button{flex:0 0 auto}.incoming-item{padding:16px 0;border-bottom:1px solid #e2e8f0}.incoming-item:last-child{border-bottom:0}.incoming-meta{display:flex;align-items:center;gap:7px;flex-wrap:wrap;color:#64748b;font-size:12px;margin-bottom:8px}.source-badge,.status-badge{display:inline-block;border-radius:999px;padding:4px 8px;font-weight:700}.source-badge{background:#111827;color:#fff}.status-badge{background:#ecfdf5;color:#047857}.incoming-text{font-size:16px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}.incoming-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:10px}.incoming-actions small{color:#94a3b8}.incoming-empty{padding:18px 0;color:#64748b}.incoming-card #refreshIncoming{min-height:38px;padding:7px 12px}

/* V0.9.12 cross-communication polish */
.status-badge.status-used{background:#fff7ed;color:#9a3412}
.status-badge.status-distributed{background:#eff6ff;color:#1d4ed8}
.status-badge.status-unmatched{background:#fef2f2;color:#b91c1c}
#refreshIncoming:disabled{opacity:.7;cursor:wait}

/* V0.9.40 Control Room layout; presentation only */
.smm-screen-hidden{display:none!important}
.smm-nav{display:flex;gap:7px;flex-wrap:wrap;overflow:visible}
.smm-nav button{white-space:nowrap}
.smm-nav button.smm-active{background:#1d4ed8;color:white;border-color:#1d4ed8}
.smm-overview{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:18px 0}
.smm-overview button{background:#f8fafc;border:1px solid #dbe3ef;border-radius:12px;padding:18px;text-align:left;display:flex;flex-direction:column;gap:8px;color:#111827;cursor:pointer}
.smm-overview strong{font-size:25px}.smm-overview span{font-weight:600}.smm-overview small{color:#2563eb}
.smm-notice{padding:14px 16px;border-radius:10px;background:#fff7ed;color:#92400e;border:1px solid #fde68a}
#activityPanel #scheduledDetails[hidden],#activityPanel #statsHistory[hidden]{display:none!important}
@media(max-width:650px){.smm-overview{grid-template-columns:1fr}.smm-nav{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}.smm-nav button{font-size:12px;padding:9px 5px}}

.public-intro{margin-top:15px;padding:13px;border-top:1px solid #e2e8f0;font-size:12px;color:#475569;line-height:1.5}.public-intro p{margin:8px 0 0}

.scheduled-bulk{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin:14px 0;padding:12px;border:1px solid #a1a1aa;border-radius:8px}.scheduled-bulk label{display:flex;gap:6px;align-items:center}.scheduled-bulk-row{display:flex;gap:8px;align-items:center}.scheduled-bulk-row .scheduled-item{flex:1}.scheduled-bulk-check{width:18px;height:18px;flex:none}

/* V0.9.51: guided, single-destination CSV campaign import and approval. */
.campaign-import-panel{background:#f8fafc;border:1px solid #dbeafe;border-radius:12px;padding:16px;margin:14px 0}
.campaign-import-panel h3{margin:0 0 8px;font-size:17px}
.campaign-approval{padding:14px;margin:16px 0 8px;border:1px solid #bfdbfe;border-radius:12px;background:#eff6ff}
.campaign-approval strong{display:block;margin-bottom:10px;overflow-wrap:anywhere}
.campaign-approval-actions{display:flex;gap:10px;flex-wrap:wrap}
.campaign-approval-actions button{flex:1 1 220px}
.campaign-advanced{margin-top:22px}
#campaignPreview{overflow-wrap:anywhere}
#campaignPreview textarea{width:100%}
#campaignStatus,#csvImportStatus{white-space:pre-wrap;overflow-wrap:anywhere}
@media(max-width:600px){.campaign-approval-actions{display:grid;grid-template-columns:1fr}}
