:root {
  --bg: #f4f2ee;
  --card: #fff;
  --ink: rgba(0, 0, 0, 0.9);
  --ink2: rgba(0, 0, 0, 0.6);
  --line: rgba(0, 0, 0, 0.12);
  --blue: #0a66c2;
  --blue-dark: #004182;
  --green: #057642;
  --red: #b24020;
  --amber: #915907;
  --font: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Lucida Grande", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.43 var(--font); }
body.no-scroll { overflow: hidden; }
a { color: var(--blue); }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; border: 1px solid rgba(0,0,0,.3); border-radius: 6px; padding: 7px 10px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: transparent; }
input[type="checkbox"] { width: auto; }
textarea { resize: vertical; line-height: 1.5; }
.muted { color: var(--ink2); }
.small { font-size: 12px; }
.hint { color: var(--ink2); font-size: 12px; margin: 4px 0 0; }
.nowrap { white-space: nowrap; }
.over { color: var(--red); font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > input { flex: 1 1 160px; }
.wide { width: 100%; }

/* Buttons */
.btn { border: 1px solid var(--ink2); background: #fff; color: var(--ink2); border-radius: 16px; padding: 5px 14px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; }
.btn:hover:not(:disabled) { background: rgba(0,0,0,.05); color: var(--ink); border-color: var(--ink); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.btn-quiet { border-color: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-link { border: 0; background: none; color: var(--blue); cursor: pointer; padding: 2px 4px; font-weight: 600; }
.btn-link:disabled { color: var(--ink2); opacity: .5; cursor: default; }
.btn-link.danger { color: var(--red); }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 52px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.brand.big { font-size: 22px; justify-content: center; margin-bottom: 16px; }
.brand-mark { background: var(--blue); color: #fff; border-radius: 4px; width: 26px; height: 26px; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.topbar nav { display: flex; gap: 4px; height: 100%; }
.topbar nav a { display: flex; align-items: center; padding: 0 12px; color: var(--ink2); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; }
.topbar nav a.nav-on { color: var(--ink); border-bottom-color: var(--ink); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-right a { text-decoration: none; }
.pill { white-space: nowrap; border-radius: 12px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.pill-ok { background: #dcf2e4; color: var(--green); }
.pill-warn { background: #fdecd2; color: var(--amber); }
.pill-muted { background: #e9e5df; color: var(--ink2); }

.page { max-width: 1180px; margin: 0 auto; padding: 20px 24px 80px; }

/* Feed */
.feed-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: flex; gap: 6px; }
.tab { display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 18px; border: 1px solid var(--line); background: #fff; color: var(--ink2); text-decoration: none; font-weight: 600; }
.tab-on { background: var(--green); border-color: var(--green); color: #fff; }
.count { font-size: 12px; background: rgba(0,0,0,.08); border-radius: 10px; padding: 0 7px; }
.tab-on .count { background: rgba(255,255,255,.25); }
.feed-tools { display: flex; gap: 10px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 5px 12px; cursor: pointer; color: var(--ink2); font-weight: 600; }
.seg button.seg-on { background: var(--ink); color: #fff; }
.feed { display: flex; flex-direction: column; gap: 22px; align-items: center; }
.filter, .banner, .open-slots, .empty { width: 100%; max-width: 720px; }
.item { width: 100%; max-width: 1000px; }
.filter { display: flex; align-items: center; gap: 8px; }
.filter select { width: auto; }
.banner { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.banner-warn { color: var(--amber); font-weight: 600; }
.empty { text-align: center; color: var(--ink2); padding: 40px 0; }
.open-slots { color: var(--ink2); }
.open-slots ul { margin: 4px 0 0; padding-left: 18px; }
.item { display: flex; flex-direction: column; gap: 8px; }
.item-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.item-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.item-label { font-weight: 600; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-ctl { display: flex; gap: 6px; flex-wrap: wrap; }
.sched { font-weight: 600; color: var(--green); }
.item-notes { display: flex; flex-direction: column; gap: 4px; }
.item-card { display: flex; justify-content: center; }
.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; border-radius: 4px; padding: 2px 6px; }
.b-draft { background: #e9e5df; color: var(--ink2); }
.b-queued { background: #dce9f7; color: var(--blue); }
.b-pub { background: #dcf2e4; color: var(--green); }
.b-fail { background: #fbe1da; color: var(--red); }
.note { font-size: 13px; border-radius: 6px; padding: 6px 10px; }
.note-err { background: #fbe1da; color: var(--red); }
.note-warn { background: #fdf1dc; color: var(--amber); }

/* LinkedIn card mock. Measurements follow LinkedIn's feed. */
.li-card { background: #fff; border-radius: 8px; box-shadow: 0 0 0 1px rgba(140,140,140,.2); width: 555px; max-width: 100%; overflow: hidden; color: rgba(0,0,0,.9); font: 14px/1.42857 var(--font); text-align: left; }
.li-mobile { width: 390px; border-radius: 0; box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 -1px 0 rgba(0,0,0,.08); }
.li-head { display: flex; align-items: flex-start; gap: 8px; padding: 12px 16px 0; margin-bottom: 8px; }
.li-mobile .li-head { padding: 12px 12px 0; }
.li-avatar { flex: none; border-radius: 50%; overflow: hidden; background: #c9d6e2; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 16px; }
.li-avatar img { width: 100%; height: 100%; object-fit: cover; }
.li-who { min-width: 0; flex: 1; }
.li-name { font-size: 14px; font-weight: 600; line-height: 1.42857; }
.li-headline { font-size: 12px; color: rgba(0,0,0,.6); line-height: 1.33333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-when { font-size: 12px; color: rgba(0,0,0,.6); line-height: 1.33333; display: flex; align-items: center; gap: 3px; }
.li-when svg { width: 14px; height: 14px; }
.li-head-ctl { display: flex; color: rgba(0,0,0,.6); gap: 4px; }
.li-head-ctl svg { width: 24px; height: 24px; padding: 2px; }
.li-text-wrap { position: relative; padding: 0 16px; margin-bottom: 8px; }
.li-mobile .li-text-wrap { padding: 0 12px; }
.li-text { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.li-clamped .li-text { max-height: 60px; overflow: hidden; }
.li-more { position: absolute; right: 16px; bottom: 0; border: 0; padding: 0 0 0 6px; margin: 0; background: #fff; color: rgba(0,0,0,.6); font: inherit; line-height: 20px; cursor: pointer; box-shadow: -12px 0 10px #fff; }
.li-mobile .li-more { right: 12px; }
.li-more:hover { color: var(--blue); text-decoration: underline; }
.li-link { color: #0a66c2; font-weight: 600; text-decoration: none; }
a.li-link:hover { text-decoration: underline; }
.li-untagged { color: rgba(0,0,0,.6); background: #f1efeb; border-radius: 2px; }
.li-missing { color: #b0a99f; font-style: italic; }
.li-linkcard { display: block; text-decoration: none; color: inherit; margin-top: 4px; }
.li-linkcard-img { aspect-ratio: 1.91 / 1; background: #eef3f8; overflow: hidden; }
.li-linkcard-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.li-linkcard-meta { background: #eef3f8; padding: 8px 12px; }
.li-linkcard-title { font-size: 14px; font-weight: 600; line-height: 1.42857; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.li-linkcard-domain { font-size: 12px; color: rgba(0,0,0,.6); margin-top: 2px; }
.li-images { display: grid; gap: 2px; margin-top: 4px; }
.li-img-cell { position: relative; overflow: hidden; background: #eef3f8; }
.li-img-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.li-images-1 .li-img-cell { aspect-ratio: 1.2; max-height: 680px; }
.li-images-2 { grid-template-columns: 1fr 1fr; }
.li-images-2 .li-img-cell { aspect-ratio: 1 / 1.2; }
.li-images-3 { grid-template-columns: 1fr 1fr; }
.li-images-3 .li-img-cell:first-child { grid-column: 1 / -1; aspect-ratio: 1.9; }
.li-images-3 .li-img-cell { aspect-ratio: 1; }
.li-images-4, .li-images-5 { grid-template-columns: 1fr 1fr 1fr; }
.li-images-4 .li-img-cell:first-child, .li-images-5 .li-img-cell:first-child { grid-column: 1 / -1; aspect-ratio: 1.9; }
.li-images-4 .li-img-cell, .li-images-5 .li-img-cell { aspect-ratio: 1; }
.li-img-more { position: absolute; inset: 0; background: rgba(0,0,0,.5); color: #fff; display: grid; place-items: center; font-size: 28px; font-weight: 600; }
.li-doc { margin-top: 4px; background: #f3f2ef; }
.li-doc-bar { background: rgba(0,0,0,.9); color: #fff; font-size: 14px; font-weight: 600; padding: 8px 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-doc-stage { position: relative; min-height: 200px; display: flex; align-items: center; justify-content: center; }
.li-doc-stage canvas { display: block; max-width: 100%; }
.li-doc-status { position: absolute; color: rgba(0,0,0,.6); }
.li-doc-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(0,0,0,.75); color: #fff; display: grid; place-items: center; cursor: pointer; }
.li-doc-prev { left: 8px; }
.li-doc-next { right: 8px; }
.li-doc-nav[hidden] { display: none; }
.li-doc-counter { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.75); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 10px; }
.li-doc-counter:empty { display: none; }
.li-actions { display: flex; justify-content: space-around; margin: 0 16px; padding: 4px 0; border-top: 1px solid #e8e8e8; margin-top: 8px; }
.li-mobile .li-actions { margin: 8px 12px 0; }
.li-action { display: flex; align-items: center; gap: 4px; padding: 10px 8px; color: rgba(0,0,0,.6); font-weight: 600; font-size: 14px; }
.li-action svg { width: 20px; height: 20px; }
.li-mobile .li-action { flex-direction: column; gap: 0; font-size: 12px; padding: 6px 8px; }

/* Editor */
.ed-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: flex; justify-content: center; align-items: stretch; padding: 24px; }
.ed { background: var(--bg); border-radius: 10px; width: min(1240px, 100%); display: grid; grid-template-columns: minmax(360px, 1fr) minmax(420px, 1.05fr); overflow: hidden; }
.ed-form { background: #fff; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.ed-title { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.ed-preview { overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.ed-preview-head { display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 555px; }
.ed-preview-card { display: flex; justify-content: center; width: 100%; }
.ed-foot { position: sticky; bottom: -20px; background: #fff; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 0 0; border-top: 1px solid var(--line); margin-top: auto; }
.body-input { font: 15px/1.5 var(--font); min-height: 320px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--ink2); }
.block { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.block-title { font-weight: 600; }
.mention-row { display: grid; grid-template-columns: minmax(90px, auto) 1fr auto; gap: 8px; align-items: center; }
.tag-ok { color: var(--blue); font-weight: 600; }
.tag-missing { color: var(--amber); font-weight: 600; }
.asset-list { display: flex; flex-direction: column; gap: 8px; }
.asset { display: grid; grid-template-columns: 64px 1fr; gap: 4px 10px; align-items: center; }
.asset img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; grid-row: span 2; }
.asset-ctl { display: flex; gap: 4px; }
.doc-asset { display: flex; justify-content: space-between; }

/* Briefs */
.briefs { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.brief-list { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 72px; }
.brief-link { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--ink); background: #fff; border: 1px solid transparent; }
.brief-link.on { border-color: var(--blue); }
.brief-editor, .brief-empty, .card { background: #fff; border-radius: 8px; box-shadow: 0 0 0 1px rgba(140,140,140,.2); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.brief-top { display: flex; gap: 12px; align-items: center; }
.brief-title { font-size: 20px; font-weight: 600; border-color: transparent; padding-left: 0; }
.brief-body { font: 15px/1.55 var(--font); min-height: 380px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px; cursor: pointer; }
.brief-posts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.gens { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }

/* Settings */
.settings { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.card h3 { margin: 0; font-size: 16px; }
.card p { margin: 0; }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.switch input { width: 20px; height: 20px; }
.slots { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.slot { display: flex; gap: 8px; align-items: center; }
.slot select { width: 90px; }
.slot input { width: 130px; }
.presets { margin-top: 4px; }
.save-bar { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; display: flex; justify-content: flex-end; align-items: center; gap: 12px; z-index: 5; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.archived { justify-content: space-between; }
.archived span { flex: 1; }

/* Sign in */
.signin { max-width: 360px; margin: 14vh auto 0; text-align: center; padding: 0 16px; }
.signin form { display: flex; flex-direction: column; gap: 10px; }

/* Toasts */
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast { background: #1d2226; color: #fff; padding: 10px 16px; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.2); max-width: 90vw; transition: opacity .5s; }
.toast-ok { background: var(--green); }
.toast-error { background: var(--red); }
.toast-out { opacity: 0; }

@media (max-width: 900px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar-right .btn-link, .topbar .brand-text { display: none; }
  .topbar nav a { padding: 0 8px; }
  .page { padding: 14px 12px 80px; }
  .ed-backdrop { padding: 0; }
  .ed { grid-template-columns: 1fr; border-radius: 0; overflow-y: auto; }
  .ed-form, .ed-preview { overflow: visible; }
  .briefs { grid-template-columns: 1fr; }
  .brief-list { position: static; }
  .grid2 { grid-template-columns: 1fr; }
}

/* Content / Cadence / Account pages */
.aside-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink2); margin: 10px 2px 2px; }
.aside-label:first-child { margin-top: 0; }
.page-intro h2 { margin: 0 0 4px; }
.page-intro p { margin: 0; }
.content-rules { margin: 0; max-width: none; }
@media (max-width: 560px) {
  .topbar-right { display: none; }
  .topbar nav a { padding: 0 6px; }
}

/* Reasoning beside each post */
.item-body { display: grid; grid-template-columns: 555px minmax(0, 1fr); gap: 16px; align-items: start; }
.item-body .item-card { justify-content: flex-start; }
.why { background: #fff; border-radius: 8px; box-shadow: 0 0 0 1px rgba(140,140,140,.2); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; min-width: 0; }
.why-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.why-head .muted { font-size: 12px; }
.why-row p { margin: 0; }
.why-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--ink2); margin-bottom: 2px; }
.why ul { margin: 0; padding-left: 18px; }
.why-sources { list-style: none; padding-left: 0 !important; display: flex; flex-direction: column; gap: 6px; }
.why-sources li { display: flex; flex-direction: column; gap: 2px; border-left: 3px solid var(--line); padding-left: 8px; }
.why-src { font-size: 11px; font-weight: 700; color: var(--blue); }
.why-sources q { color: var(--ink); font-style: italic; }
.why-use { color: var(--ink2); }
.why-check { background: #fdf1dc; border-radius: 6px; padding: 6px 8px; color: var(--amber); }
.why-check .why-label { color: var(--amber); }
.why-foot { display: flex; justify-content: flex-end; }
.why-inline { margin-top: 12px; }
.why .note .btn { margin-left: 6px; padding: 2px 10px; font-size: 12px; }
@media (max-width: 1100px) {
  .item { max-width: 720px; }
  .item-body { grid-template-columns: minmax(0, 1fr); }
  .item-body .item-card { justify-content: center; }
}
