:root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --surface-2: #f9fafc;
    --border: #e4e6ef;
    --text: #151827;
    --text-2: #555a70;
    --muted: #8a8fa6;
    --primary: #5b4cf0;
    --primary-dark: #4636d6;
    --primary-soft: #eeecff;
    --success: #1a8f5a;
    --success-soft: #e3f6ec;
    --warning: #b7791f;
    --warning-soft: #fff4dc;
    --danger: #d23b3b;
    --danger-soft: #fde8e8;
    --info-soft: #e7f0fe;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
    --series-1: #2a78d6;
    --sidebar-w: 240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 1em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
img, video { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.pre { white-space: pre-wrap; word-break: break-word; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 500; color: var(--text-2); font-size: 13px; }
label > input, label > select, label > textarea { margin-top: 6px; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=url], input[type=number],
input[type=date], input[type=time], input[type=datetime-local], input[type=search], select, textarea {
    width: 100%;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; min-height: 90px; }
input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; color: var(--text); cursor: pointer; }
.check input { margin-top: 3px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
.row > .shrink { flex: 0 0 auto; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 4px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font: inherit; font-weight: 600; font-size: 13px;
    padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap;
    text-decoration: none !important; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: #f5c2c2; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #157a4c; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.inline { display: inline; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.link-btn.danger { color: var(--danger); }

/* ---------- Alerts / badges ---------- */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: #11603d; border-color: #bfe8d2; }
.alert-error { background: var(--danger-soft); color: #9b2323; border-color: #f5c2c2; }
.alert-info { background: var(--info-soft); color: #1d4f91; border-color: #c8dcfb; }
.alert-warning { background: var(--warning-soft); color: #7a5313; border-color: #f3dca8; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge-scheduled { background: var(--info-soft); color: #1d4f91; border-color: #c8dcfb; }
.badge-published { background: var(--success-soft); color: #11603d; border-color: #bfe8d2; }
.badge-failed, .badge-rejected { background: var(--danger-soft); color: #9b2323; border-color: #f5c2c2; }
.badge-pending_approval { background: var(--warning-soft); color: #7a5313; border-color: #f3dca8; }
.badge-publishing { background: var(--primary-soft); color: var(--primary-dark); border-color: #d6d1ff; }
.badge-demo { background: #f1f1f4; color: #666; }

.net-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 6px; color: #fff;
    font-size: 10px; font-weight: 700; text-transform: none; flex: 0 0 auto;
}
.net-icon.lg { width: 36px; height: 36px; font-size: 13px; border-radius: 9px; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
    background: #14132b; color: #c9c8e3; display: flex; flex-direction: column;
    padding: 18px 12px; z-index: 30; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: inherit; text-decoration: none !important; padding: 0 8px; }
.sidebar .brand { color: #fff; }
.brand-mark { display: inline-flex; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #7a6cff, #5b4cf0); color: #fff; align-items: center; justify-content: center; font-size: 17px; }
.brand-lg { font-size: 22px; justify-content: center; margin-bottom: 18px; }
.ws-switch { margin: 16px 0 10px; }
.ws-switch select { background: #1f1e3d; color: #fff; border-color: #2e2d52; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #c9c8e3; font-weight: 500; text-decoration: none; }
.sidebar nav a:hover { background: #1f1e3d; color: #fff; }
.sidebar nav a.active { background: #2b2860; color: #fff; }
.nav-icon { width: 18px; text-align: center; opacity: .85; }
.nav-count { margin-left: auto; background: #f0b429; color: #1b1400; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 7px; }
.nav-count.danger { background: #f16363; color: #fff; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid #2a2950; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.user-chip { display: flex; gap: 8px; align-items: center; min-width: 0; }
.user-chip strong { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.user-chip small { color: #8e8db2; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #5b4cf0; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; }
.link-muted { color: #8e8db2; font-size: 12px; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 16px 28px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 19px; margin: 0; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.menu-toggle { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; }
.flashes { padding: 0 28px; }
.flashes .alert:first-child { margin-top: 16px; }
.content { padding: 24px 28px 48px; }
.nav-backdrop { display: none; }

/* ---------- Cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .split > .card + .card, .week-grid > * + * { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }

.stat { padding: 18px 20px; }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat .sub { font-size: 12px; color: var(--text-2); }

/* ---------- Dashboard setup tracker (3 steps side by side) ---------- */
.setup { background: linear-gradient(135deg, #f6f5ff 0%, #ffffff 55%); border: 1px solid #e3e0ff; border-radius: var(--radius); padding: 18px 20px 20px; }
.setup-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.setup-top h2 { margin: 0 0 2px; font-size: 17px; }
.setup-top p { margin: 0; color: var(--text-2); font-size: 13px; }
.setup-meter { min-width: 180px; text-align: right; font-size: 12px; font-weight: 600; color: var(--primary-dark); }
.setup-bar { height: 6px; background: #e6e3ff; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.setup-bar i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.setup-track { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.setup-node { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
/* line joining one step to the next */
.setup-node:not(:last-child)::after { content: ""; position: absolute; top: 28px; right: -13px; width: 13px; height: 2px; background: var(--border); }
.setup-node.is-done:not(:last-child)::after { background: #9ad9b9; }
.setup-dot { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 13px; font-weight: 700; }
.setup-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.setup-text strong { font-size: 14px; }
.setup-text span { font-size: 12px; color: var(--muted); }
.setup-node.is-done { background: #f6fcf9; border-color: #cfeedd; }
.setup-node.is-done .setup-dot { background: var(--success); border-color: var(--success); color: #fff; }
.setup-node.is-done .setup-text strong { color: var(--text-2); }
.setup-tag { font-size: 12px; font-weight: 600; color: var(--success); }
.setup-node.is-next { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.setup-node.is-next .setup-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.setup-node.is-later { opacity: .8; }
.setup-link { font-size: 12px; font-weight: 600; }
@media (max-width: 760px) {
    .setup-track { grid-template-columns: 1fr; }
    .setup-node { flex-direction: row; align-items: center; flex-wrap: wrap; }
    .setup-node:not(:last-child)::after { top: auto; bottom: -13px; right: auto; left: 27px; width: 2px; height: 13px; }
    .setup-meter { text-align: left; width: 100%; }
}

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty h3 { color: var(--text); }

/* ---------- Tables / lists ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.post-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.post-item:last-child { border-bottom: 0; }
.post-item .when { width: 120px; flex: 0 0 auto; font-size: 12px; color: var(--text-2); }
.post-item .when strong { display: block; color: var(--text); font-size: 13px; }
.post-item .body { flex: 1; min-width: 0; }
.post-item .text { white-space: pre-wrap; word-break: break-word; }
.post-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.acct-stack { display: inline-flex; gap: 3px; }
.error-text { color: var(--danger); font-size: 12px; margin-top: 6px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }
.tabs .count { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; font-size: 11px; margin-left: 4px; }

/* ---------- Media ---------- */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb-remove { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; line-height: 1; }
.dropzone { border: 2px dashed var(--border); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); cursor: pointer; background: var(--surface-2); }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); color: var(--primary); }
.dropzone input { display: none; }

/* ---------- Composer ---------- */
.account-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.account-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-weight: 500; color: var(--text); background: var(--surface); user-select: none; }
.account-pill input { display: none; }
.account-pill.checked, .account-pill:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.account-pill small { color: var(--muted); font-weight: 400; }
.counters { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.counters .over { color: var(--danger); font-weight: 600; }
.message-label { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 6px 12px; }
.message-label textarea { grid-column: 1 / -1; }
.message-limit { color: var(--muted); font-size: 12px; font-weight: 500; }
.message-limit.near { color: var(--warning); }
.message-limit.over { color: var(--danger); font-weight: 700; }
textarea[aria-invalid="true"] { border-color: var(--danger); }
.editor-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.preview { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface); }
.preview-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.preview-head .avatar { width: 38px; height: 38px; }
.preview-text { white-space: pre-wrap; word-break: break-word; }
.preview-media { margin-top: 10px; display: grid; gap: 4px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.preview-media img, .preview-media video { width: 100%; border-radius: 8px; aspect-ratio: 1; object-fit: cover; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.radio-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-weight: 600; color: var(--text); }
.radio-card small { display: block; font-weight: 400; color: var(--muted); }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio-card input { margin-right: 6px; }

/* ---------- Account picker (composer) ---------- */
.picker-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.picker-count { font-size: 12px; color: var(--text-2); display: inline-flex; gap: 8px; align-items: center; }
.picker-count strong { color: var(--primary); font-size: 14px; }
.picker-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0 12px; }
.picker-bar input[type=search] { flex: 1 1 220px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg-btn { font: inherit; font-size: 12px; font-weight: 600; border: 0; background: transparent; color: var(--text-2); padding: 5px 10px; border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.seg-btn .net-icon { width: 16px; height: 16px; font-size: 8px; border-radius: 4px; }
.seg-btn span:not(.net-icon) { color: var(--muted); font-weight: 500; }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.split > *, .stack > * { min-width: 0; } /* let grid/flex children shrink instead of overflowing on phones */
.picker-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 10px; max-height: 360px; overflow-y: auto; padding: 2px; }
.pgroup { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.pgroup:has(input:checked) { border-color: #cfc9ff; background: #fbfaff; }
.pgroup-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pgroup-avatar { width: 26px; height: 26px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.pgroup-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; text-transform: capitalize; }
.pgroup-toggle { flex: 0 0 auto; }
.pgroup-accts { display: flex; gap: 6px; flex-wrap: wrap; }
.pgroup .account-pill { padding: 5px 10px 5px 5px; font-size: 12px; position: relative; border-radius: 9px; }
.pgroup .account-pill .pill-text { display: inline-flex; flex-direction: column; line-height: 1.2; }
.pgroup .account-pill .pill-text small { color: var(--muted); font-size: 10px; }
.pill-check { display: none; width: 16px; height: 16px; border-radius: 50%; background: var(--net, var(--primary)); color: #fff; font-size: 10px; align-items: center; justify-content: center; margin-left: 2px; }
.pgroup .account-pill:has(input:checked) { border-color: var(--net, var(--primary)); background: color-mix(in srgb, var(--net, var(--primary)) 9%, white); }
.pgroup .account-pill:has(input:checked) .pill-check { display: inline-flex; }
.pgroup .account-pill:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Grammar panel ---------- */
.grammar-panel { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); padding: 10px 12px; }
.grammar-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grammar-head .link-btn { margin-left: auto; }
.grammar-ok { color: var(--success); font-weight: 600; }
.grammar-item { border-top: 1px solid var(--border); padding: 8px 0 2px; margin-top: 8px; }
.grammar-msg { font-size: 12px; color: var(--text-2); }
.grammar-fixes { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.grammar-bad { text-decoration: line-through; text-decoration-color: var(--danger); color: var(--danger); font-weight: 600; }
.grammar-fix { font: inherit; font-size: 12px; font-weight: 600; border: 1px solid #bfe8d2; background: var(--success-soft); color: #11603d; border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.grammar-fix:hover { background: #cdf0dc; }

/* ---------- Hashtag suggestions ---------- */
.hashtag-label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.hashtag-count { font-size: 12px; color: var(--text-2); }
.hashtag-count.over { color: var(--danger); font-weight: 600; }
.hashtag-input-row { display: flex; gap: 8px; margin-top: 6px; }
.hashtag-input-row input { flex: 1; min-width: 0; }
.hashtag-panel { margin-top: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); padding: 12px 14px; }
.hashtag-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hashtag-head .link-btn { margin-left: auto; }
.tag-section { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
.tag-section-title { font-size: 12px; font-weight: 700; color: var(--text); display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.tag-hint { font-size: 11px; color: var(--muted); margin: 2px 0 6px; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { font: inherit; font-size: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.tag-chip:hover { border-color: var(--primary); color: var(--primary); }
.tag-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.tag-chip.group { font-weight: 600; color: var(--primary-dark); background: var(--primary-soft); border-color: #d6d1ff; }
.tag-group { display: inline-flex; align-items: center; }
.tag-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 0 4px; }
.tag-x:hover { color: var(--danger); }

/* ---------- Delete menu (published posts) ---------- */
.delete-menu { position: relative; display: inline-block; }
.delete-menu summary { list-style: none; }
.delete-menu summary::-webkit-details-marker { display: none; }
.delete-menu-box { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.delete-menu-box p { margin: 0; }
.delete-menu-box .hint { display: block; text-align: center; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(12, 12, 30, .45); display: none; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 100; overflow-y: auto; }
.modal.open { display: flex; }
.modal-box { background: var(--surface); border-radius: 14px; width: 100%; max-width: 620px; box-shadow: var(--shadow-lg); padding: 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-close { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); }
.ai-results .ai-option { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-top: 10px; white-space: pre-wrap; }
.ai-option .btn { margin-top: 8px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Calendar ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-toolbar h2 { margin: 0 8px; min-width: 170px; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border); gap: 1px; }
.cal-dow { background: var(--surface-2); padding: 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--muted); text-align: center; }
.cal-day { background: var(--surface); min-height: 118px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.other { background: var(--surface-2); }
.cal-day.other .cal-num { color: var(--muted); }
.cal-day.today .cal-num { background: var(--primary); color: #fff; }
.cal-num { font-size: 12px; font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.cal-head { display: flex; justify-content: space-between; align-items: center; }
.cal-add { opacity: 0; font-size: 16px; color: var(--primary); text-decoration: none !important; padding: 0 4px; }
.cal-day:hover .cal-add { opacity: 1; }
.cal-chip { display: flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 5px; border-radius: 5px; background: var(--info-soft); color: #1d4f91; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none !important; border-left: 3px solid transparent; }
.cal-chip.published { background: var(--success-soft); color: #11603d; }
.cal-chip.failed { background: var(--danger-soft); color: #9b2323; }
.cal-chip.pending_approval { background: var(--warning-soft); color: #7a5313; }
.cal-chip.slot { background: #f4f3fb; color: var(--text-2); border-left-color: currentColor; }
.cal-chip .net-icon { width: 14px; height: 14px; font-size: 7px; border-radius: 3px; }
.cal-more { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Schedule grid ---------- */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.week-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 160px; }
.week-col h3 { font-size: 13px; text-align: center; margin-bottom: 10px; }
.slot-card { border-radius: 8px; padding: 8px; background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--series-1); margin-bottom: 8px; font-size: 12px; }
.slot-card strong { font-size: 13px; }
.slot-card .acct-stack { margin-top: 5px; flex-wrap: wrap; }
.slot-card form { display: inline; }

/* ---------- Library ---------- */
.library-card { display: flex; flex-direction: column; gap: 8px; border-top: 4px solid var(--series-1); }
.library-card h3 { margin: 0; }
.library-card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.drag-handle { cursor: grab; color: var(--muted); padding: 0 6px; user-select: none; }
.sortable-row.dragging { opacity: .4; }

/* ---------- Charts (plain HTML/CSS) ---------- */
.chart { position: relative; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 190px; padding: 0 0 0 36px; position: relative; border-bottom: 1px solid var(--border); }
.bars .gridline { position: absolute; left: 36px; right: 0; border-top: 1px dashed #eceef4; font-size: 10px; color: var(--muted); }
.bars .gridline span { position: absolute; left: -34px; top: -7px; width: 28px; text-align: right; }
.bar { flex: 1; min-width: 4px; background: var(--series-1); border-radius: 4px 4px 0 0; position: relative; cursor: default; z-index: 1; }
.bar:hover { filter: brightness(1.1); }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.bar-col .tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: #14132b; color: #fff; font-size: 11px; padding: 5px 8px; border-radius: 6px; white-space: nowrap; z-index: 5; pointer-events: none; }
.bar-col:hover .tip { display: block; }
.bar-col:hover .bar { filter: brightness(1.1); }
.bar-col.fail-only .bar { background: transparent; }
.x-labels { display: flex; gap: 3px; padding-left: 36px; margin-top: 6px; }
.x-labels span { flex: 1; font-size: 10px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; }
.hbar-row { display: grid; grid-template-columns: 150px 1fr 56px; gap: 10px; align-items: center; padding: 6px 0; }
.hbar-label { display: flex; gap: 8px; align-items: center; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.hbar-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.heat { display: grid; grid-template-columns: 40px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: 10px; color: var(--muted); }
.heat div { aspect-ratio: 1; border-radius: 3px; }
.heat .lbl { aspect-ratio: auto; display: flex; align-items: center; }

/* ---------- Auth ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(circle at 20% 0%, #ecebff, transparent 50%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 32px; }
.auth-card h1 { font-size: 22px; text-align: center; }
.auth-card > .muted { text-align: center; }
.auth-foot { text-align: center; margin-top: 18px; color: var(--text-2); }

/* ---------- Landing ---------- */
.public { background: #fff; }
.lp-nav { display: flex; align-items: center; justify-content: space-between; max-width: 1180px; margin: 0 auto; padding: 18px 24px; gap: 16px; }
.lp-nav .brand { color: var(--text); padding: 0; }
.lp-links { display: flex; gap: 22px; align-items: center; }
.lp-links a:not(.btn) { color: var(--text-2); font-weight: 500; }
.hero { max-width: 1180px; margin: 0 auto; padding: 60px 24px 40px; display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.eyebrow { display: inline-block; background: var(--primary-soft); color: var(--primary-dark); padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; margin-bottom: 16px; }
.hero h1 { font-size: 48px; line-height: 1.08; letter-spacing: -.02em; margin-bottom: 18px; }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero p.lead { font-size: 18px; color: var(--text-2); max-width: 540px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.hero-cta .btn { padding: 13px 22px; font-size: 15px; }
.hero-visual { background: linear-gradient(160deg, #f3f1ff, #eef6ff); border-radius: 22px; padding: 22px; border: 1px solid #e6e3ff; }
.mock { background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); padding: 16px; }
.mock-row { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; border: 1px solid var(--border); margin-top: 8px; font-size: 13px; }
.mock-row .t { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.logos { text-align: center; color: var(--muted); padding: 24px; font-weight: 600; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; align-items: center; }
.section { max-width: 1180px; margin: 0 auto; padding: 64px 24px; }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 40px; }
.section-head h2 { font-size: 34px; letter-spacing: -.01em; }
.section-head p { color: var(--text-2); font-size: 16px; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.feature { border: 1px solid var(--border); border-radius: 16px; padding: 24px; background: #fff; }
.feature .ic { width: 42px; height: 42px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 14px; }
.feature p { color: var(--text-2); margin: 0; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; counter-reset: step; }
.step { padding: 24px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.step::before { counter-increment: step; content: counter(step); display: inline-flex; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 12px; }
.pricing { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.plan { border: 1px solid var(--border); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; background: #fff; }
.plan.featured { border: 2px solid var(--primary); box-shadow: var(--shadow-lg); }
.plan .price { font-size: 34px; font-weight: 800; margin: 8px 0; }
.plan .price small { font-size: 14px; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 12px 0 20px; flex: 1; }
.plan li { padding: 5px 0; color: var(--text-2); }
.plan li::before { content: "✓ "; color: var(--success); font-weight: 700; }
.faq details { border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; background: #fff; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 10px 0 0; color: var(--text-2); }
.cta-band { background: linear-gradient(135deg, #5b4cf0, #3d2fc7); color: #fff; border-radius: 22px; padding: 48px 32px; text-align: center; }
.cta-band h2 { font-size: 30px; }
.cta-band .btn { background: #fff; color: var(--primary-dark); border-color: #fff; padding: 13px 24px; font-size: 15px; }
.lp-foot { border-top: 1px solid var(--border); padding: 28px 24px; text-align: center; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: 1fr; }
    .pricing { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; }
    .nav-open .sidebar { transform: none; }
    .nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
    .main { margin-left: 0; }
    .menu-toggle { display: block; }
    .topbar, .content { padding-left: 16px; padding-right: 16px; }
    .flashes { padding: 0 16px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .hero { grid-template-columns: 1fr; padding-top: 32px; }
    .hero h1 { font-size: 36px; }
    .features, .steps { grid-template-columns: 1fr; }
    .lp-links a:not(.btn) { display: none; }
    .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cal-day { min-height: 76px; }
    .cal-chip span.txt { display: none; }
    .post-item { flex-direction: column; gap: 6px; }
    .post-item .when { width: auto; }
    .hbar-row { grid-template-columns: 100px 1fr 44px; }
}
@media (max-width: 520px) {
    .grid-4, .pricing { grid-template-columns: 1fr; }
    .topbar h1 { font-size: 16px; }
    .topbar-actions .btn { padding: 7px 10px; }
}

/* ---------- Upload progress (Queue) ---------- */
.upload-progress { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--primary-dark); }
.upload-bar { width: 120px; height: 6px; background: var(--primary-soft); border-radius: 999px; overflow: hidden; display: inline-block; }
.upload-bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s; }
.upload-bar.indeterminate span { width: 35%; animation: upload-slide 1.2s ease-in-out infinite; }
@keyframes upload-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

/* ---------- Composer: instant upload + restored draft ---------- */
.thumb.uploading img, .thumb.uploading video { opacity: .45; }
.thumb-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--primary-dark); }
.thumb-progress { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; background: rgba(255,255,255,.8); border-radius: 4px; overflow: hidden; }
.thumb-progress span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.thumb.failed { border-color: #f5c2c2; background: var(--danger-soft); }
.thumb-error { font-size: 10px; color: #9b2323; padding: 6px; line-height: 1.2; }
.draft-banner { background: var(--info-soft); border: 1px solid #c8dcfb; color: #1d4f91; border-radius: 10px; padding: 10px 14px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Queue: toolbar + action menu ---------- */
.queue-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.queue-toolbar .tabs { border-bottom: 0; margin-bottom: 0; }
.queue-filter { padding-bottom: 8px; }
.queue-filter select { width: auto; min-width: 220px; padding: 7px 10px; font-size: 13px; }
.tabs .count.danger { background: var(--danger-soft); color: #9b2323; border-color: #f5c2c2; }
.post-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.post-actions .btn-ghost { color: var(--text-2); }
.post-actions .btn-ghost .net-icon { width: 16px; height: 16px; font-size: 8px; border-radius: 4px; }
.menu { position: relative; display: inline-block; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { background: var(--surface-2); border-color: var(--primary); }
.menu-box { position: absolute; z-index: 25; top: calc(100% + 6px); left: 0; min-width: 270px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; font: inherit; font-size: 13px; font-weight: 500; color: var(--text); background: none; border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer; flex-wrap: wrap; }
.menu-item:hover { background: var(--surface-2); }
.menu-item small { flex-basis: 100%; padding-left: 23px; color: var(--muted); font-weight: 400; font-size: 11px; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
.menu-row { padding: 8px 10px; }
.menu-label { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.menu-inline { display: flex; gap: 6px; }
.menu-inline select { padding: 5px 8px; font-size: 12px; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
