/* ============================================================
   Eterna International — Content Platform UI
   Mobile-first, server-rendered, brand-token driven.
   Tokens come from brand.css (--ib-*). No build step.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--ib-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ib-navy);
  background: var(--ib-bone);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul, ol { list-style: none; }
input, select, textarea { font: inherit; color: inherit; }
:where(a,button,input,select,textarea,[tabindex]):focus-visible {
  outline: 2px solid var(--ib-azure); outline-offset: 2px;
}
h1,h2,h3,h4 { font-family: var(--ib-serif); font-weight: 500; color: var(--ib-navy); line-height: 1.15; }

.eyebrow {
  font-family: var(--ib-mono); font-size: 10px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--ib-navy-60);
}
.muted { color: var(--ib-navy-60); }
.mono { font-family: var(--ib-mono); }
.small { font-size: 13px; }
.tiny { font-size: 11px; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.stack > * + * { margin-top: var(--ib-3); }

/* ── App shell ─────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-bottom: 72px; }

/* Sidebar (desktop) */
.sidebar {
  display: none; flex-direction: column; width: 232px; flex-shrink: 0;
  background: var(--ib-navy); color: var(--ib-bone);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar__brand { padding: 20px 20px 14px; display: flex; align-items: center; gap: 10px; }
.sidebar__brand img { height: 26px; width: auto; }
.sidebar__wordmark { font-family: var(--ib-serif); font-size: 18px; color: #fff; line-height: 1; }
.sidebar__tag { font-family: var(--ib-mono); font-size: 8.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: rgba(246,244,238,.5); }
.sidebar__nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar__link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px;
  color: rgba(246,244,238,.72); font-size: 14px; font-weight: 500; transition: background .15s, color .15s;
}
.sidebar__link svg { width: 18px; height: 18px; }
.sidebar__link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar__link.is-active { background: var(--ib-azure); color: #fff; }
.sidebar__spacer { flex: 1; }
.sidebar__foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; color: rgba(246,244,238,.55); }
.sidebar__foot a { color: rgba(246,244,238,.8); }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--ib-rule); background: var(--ib-paper);
  position: sticky; top: 0; z-index: 20;
}
.topbar__back {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border-radius: 8px; color: var(--ib-navy-60); flex-shrink: 0;
}
.topbar__back:hover { background: rgba(11,27,53,.06); color: var(--ib-navy); }
.topbar__title { flex: 1; min-width: 0; }
.topbar__title .eyebrow { display: block; }
.topbar__h1 { font-size: 20px; font-weight: 600; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }

.app-content { padding: 18px; max-width: 1320px; width: 100%; margin: 0 auto; }
@media (min-width: 880px) {
  .sidebar { display: flex; }
  .app-main { padding-bottom: 0; }
  .app-content { padding: 26px 32px; }
}

/* ── Mobile bottom nav ─────────────────────────────────────── */
.botnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: var(--ib-navy); border-top: 1px solid rgba(255,255,255,.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.botnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 4px 8px; color: rgba(246,244,238,.6); font-size: 10px;
}
.botnav a svg { width: 20px; height: 20px; }
.botnav a.is-active { color: #fff; }
@media (min-width: 880px) { .botnav { display: none; } }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--ib-paper); border: 1px solid var(--ib-rule); border-radius: 12px;
  padding: 18px; box-shadow: 0 1px 2px rgba(11,27,53,.04);
}
.card + .card { margin-top: 16px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card__title { font-family: var(--ib-sans); font-size: 13px; font-weight: 700; letter-spacing: .02em;
  text-transform: uppercase; color: var(--ib-navy-60); }
.card--navy { background: var(--ib-navy); color: var(--ib-bone); border-color: transparent; }
.card--navy h1, .card--navy h2, .card--navy h3 { color: #fff; }

.grid { display: grid; gap: 16px; }
@media (min-width: 720px) { .grid--2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .grid--3 { grid-template-columns: repeat(3,1fr); } .grid--side { grid-template-columns: 1fr 320px; } }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 9px; font-size: 14px; font-weight: 600;
  background: var(--ib-paper); border: 1px solid var(--ib-rule-strong); color: var(--ib-navy);
  transition: background .15s, border-color .15s, transform .05s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--ib-navy-60); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ib-azure); border-color: var(--ib-azure); color: #fff; }
.btn--primary:hover { background: var(--ib-azure-deep, #1252B8); border-color: var(--ib-azure-deep, #1252B8); }
.btn--navy { background: var(--ib-navy); border-color: var(--ib-navy); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ib-navy-60); }
.btn--ghost:hover { background: rgba(11,27,53,.06); color: var(--ib-navy); }
.btn--danger { color: #b3261e; border-color: rgba(179,38,30,.3); }
.btn--sm { padding: 6px 11px; font-size: 13px; }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Badges / pills ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 1.4;
  background: rgba(11,27,53,.07); color: var(--ib-navy-60);
}
.badge--success { background: rgba(43,179,176,.16); color: #1F8E8B; }
.badge--info { background: rgba(27,107,224,.12); color: var(--ib-azure); }
.badge--warning { background: rgba(214,158,46,.16); color: #9a6b00; }
.badge--danger { background: rgba(179,38,30,.12); color: #b3261e; }
.badge--muted { background: rgba(11,27,53,.07); color: var(--ib-navy-60); }
.badge--default { background: rgba(11,27,53,.07); color: var(--ib-navy-60); }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 8px;
  font-size: 12.5px; font-weight: 500; background: rgba(11,27,53,.05); border: 1px solid var(--ib-rule);
}
.chip--on { background: var(--ib-azure); color: #fff; border-color: var(--ib-azure); }

/* ── Forms ─────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field > label, .label {
  display: block; font-size: 12px; font-weight: 600; color: var(--ib-navy-60);
  text-transform: uppercase; letter-spacing: .03em; margin-bottom: 5px;
}
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--ib-rule-strong);
  background: #fff; font-size: 15px; color: var(--ib-navy);
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--ib-azure); outline: none; }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.textarea--tall { min-height: 260px; font-family: var(--ib-mono); font-size: 13px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1; min-width: 160px; }
.help { font-size: 12px; color: var(--ib-navy-60); margin-top: 4px; }

/* ── Board (kanban) ────────────────────────────────────────── */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x proximity; }
.board__col {
  flex: 0 0 240px; scroll-snap-align: start; background: rgba(11,27,53,.035);
  border: 1px solid var(--ib-rule); border-radius: 12px; padding: 10px; min-height: 120px;
}
.board__colhead { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; }
.board__colname { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ib-navy-60); }
.board__count { font-size: 11px; font-weight: 700; color: var(--ib-navy-30); }
.pcard {
  display: block; background: var(--ib-paper); border: 1px solid var(--ib-rule); border-radius: 10px;
  padding: 11px 12px; margin-bottom: 9px; box-shadow: 0 1px 2px rgba(11,27,53,.05); transition: border-color .15s, transform .05s;
}
.pcard:hover { border-color: var(--ib-azure); }
.pcard__title { font-size: 14px; font-weight: 600; line-height: 1.3; margin-bottom: 6px; }
.pcard__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pcard__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; }
.advance-btn { font-size: 11px; color: var(--ib-azure); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.advance-btn svg { width: 13px; height: 13px; }

/* ── Calendar ──────────────────────────────────────────────── */
.cal { width: 100%; border-collapse: collapse; }
.cal th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ib-navy-60); padding: 8px 4px; text-align: left; }
.cal td { border: 1px solid var(--ib-rule); vertical-align: top; height: 92px; width: 14.28%; padding: 5px; }
.cal__daynum { font-size: 12px; font-weight: 600; color: var(--ib-navy-60); }
.cal td.out { background: rgba(11,27,53,.02); }
.cal td.today .cal__daynum { color: #fff; background: var(--ib-azure); border-radius: 50%; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.cal__ev { display: block; font-size: 11px; padding: 2px 6px; border-radius: 6px; margin-top: 3px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal__ev--linkedin_post { background: var(--ib-azure); }
.cal__ev--linkedin_carousel { background: #1252B8; }
.cal__ev--website_article { background: var(--ib-teal); }

/* ── Tables ────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ib-navy-60); padding: 9px 10px; border-bottom: 1px solid var(--ib-rule-strong); }
.table td { padding: 10px; border-bottom: 1px solid var(--ib-rule); vertical-align: middle; }
.table tr:hover td { background: rgba(11,27,53,.02); }
.table--wrap { overflow-x: auto; }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--ib-rule); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 9px 14px; font-size: 14px; font-weight: 600; color: var(--ib-navy-60); border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer; }
.tab.is-active { color: var(--ib-azure); border-bottom-color: var(--ib-azure); }

/* ── Channel previews ──────────────────────────────────────── */
.li-preview { max-width: 540px; border: 1px solid var(--ib-rule-strong); border-radius: 12px; background: #fff; overflow: hidden; }
.li-preview__head { display: flex; gap: 10px; padding: 12px 14px 6px; }
.li-preview__avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--ib-navy); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--ib-serif); font-size: 16px; flex-shrink: 0; }
.li-preview__name { font-weight: 700; font-size: 14px; }
.li-preview__sub { font-size: 12px; color: var(--ib-navy-60); }
.li-preview__body { padding: 4px 14px 12px; font-size: 14px; white-space: pre-wrap; line-height: 1.5; }
.li-preview__media img { width: 100%; border-top: 1px solid var(--ib-rule); }
.li-preview__doc { border-top: 1px solid var(--ib-rule); background: var(--ib-bone); }
.li-preview__actions { display: flex; border-top: 1px solid var(--ib-rule); }
.li-preview__actions span { flex: 1; text-align: center; padding: 9px; font-size: 12px; color: var(--ib-navy-60); font-weight: 600; }

.carousel-viewer { display: flex; gap: 10px; overflow-x: auto; padding: 8px 0; scroll-snap-type: x mandatory; }
.carousel-viewer img { flex: 0 0 auto; width: 240px; height: 300px; object-fit: cover; border-radius: 10px; border: 1px solid var(--ib-rule); scroll-snap-align: center; }

.article-preview { max-width: 720px; background: #fff; border: 1px solid var(--ib-rule); border-radius: 12px; overflow: hidden; }
.article-preview__hero img { width: 100%; }
.article-preview__body { padding: 24px 28px; }
.article-preview__body h1 { font-size: 30px; margin-bottom: 10px; }
.article-preview__body h2 { font-size: 21px; margin: 22px 0 8px; }
.article-preview__body p { margin-bottom: 14px; line-height: 1.7; color: #25324a; }

/* ── Compliance flag highlight ─────────────────────────────── */
.flagmark { background: rgba(179,38,30,.16); border-radius: 3px; padding: 0 2px; }
.verdict { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.verdict--pass { color: #1F8E8B; }
.verdict--flag { color: #b3261e; }

/* ── Toasts ────────────────────────────────────────────────── */
.toast-region { position: fixed; bottom: 84px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
@media (min-width: 880px) { .toast-region { bottom: 24px; } }
.toast {
  pointer-events: auto; background: var(--ib-navy); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500; box-shadow: 0 12px 32px -12px rgba(11,27,53,.5); max-width: 90vw;
  animation: toast-in .2s ease-out;
}
.toast--error { background: #b3261e; }
.toast--success { background: #1F8E8B; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── HTMX progress + misc ──────────────────────────────────── */
.htmx-progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: var(--ib-teal); z-index: 100; transition: width .2s; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-indicator { display: none; }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(11,27,53,.2); border-top-color: var(--ib-azure); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero-tile { background: var(--ib-grad-iridium); color: #fff; border-radius: 14px; padding: 22px 24px; }
.hero-tile .eyebrow { color: rgba(255,255,255,.7); }
.hero-tile h2 { color: #fff; font-size: 26px; margin: 4px 0 6px; }

.section-list { display: flex; flex-direction: column; gap: 14px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--ib-navy-60); }
.empty-state svg { width: 32px; height: 32px; margin: 0 auto 10px; opacity: .5; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--ib-navy-60); }
.split { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.divider { height: 1px; background: var(--ib-rule); margin: 16px 0; }
[x-cloak] { display: none !important; }

/* ============================================================
   v2 — studio: richness, per-slide redo, reel preview, autofix
   ============================================================ */
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* a softer accent button for "smart" actions (autofix, AI nudges) */
.btn--accent { background: rgba(43,179,176,.12); border-color: rgba(43,179,176,.4); color: #1F8E8B; }
.btn--accent:hover { background: rgba(43,179,176,.2); border-color: var(--ib-teal); }
.btn--xs { padding: 3px 8px; font-size: 11px; border-radius: 7px; gap: 4px; }
.btn--xs svg { width: 12px; height: 12px; }

/* carousel slide cell with a hover "redo this slide" control */
.carousel-viewer .slide-cell { position: relative; flex: 0 0 auto; }
.slide-cell img { width: 240px; height: 300px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--ib-rule); scroll-snap-align: center; }
.slide-cell__redo { position: absolute; top: 8px; right: 8px;
  background: rgba(11,27,53,.78); color: #fff; border: none; backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .15s; }
.slide-cell:hover .slide-cell__redo, .slide-cell:focus-within .slide-cell__redo { opacity: 1; }
.slide-cell__redo:hover { background: var(--ib-azure); }

/* reel: vertical 9:16 frame */
.reel-frame { position: relative; max-width: 300px; margin: 0 auto; background: var(--ib-navy);
  border-top: 1px solid var(--ib-rule); border-bottom: 1px solid var(--ib-rule); }
.reel-frame video, .reel-frame img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; }
.reel-frame__badge { position: absolute; left: 12px; bottom: 12px; display: inline-flex; gap: 6px;
  align-items: center; background: rgba(11,27,53,.8); color: #fff; padding: 5px 10px;
  border-radius: 999px; font-size: 12px; }
.li-preview__media video { width: 100%; border-top: 1px solid var(--ib-rule); }

/* calendar pills for the new channels */
.cal__ev--linkedin_single { background: var(--ib-azure); }
.cal__ev--reel { background: #7A3CC2; }

/* ── Mobile polish (grid views, settings tabs, tables) ─────────────────── */
@media (max-width: 640px) {
  /* settings tab bar + section pill navs scroll horizontally instead of wrapping forever */
  #settings-body > nav.btn-row { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
  #settings-body > nav.btn-row .btn { flex: 0 0 auto; }
  /* card grids tighten up */
  #board-cards > div[style*="grid-template-columns"],
  .content-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; gap: 10px !important; }
  /* wide tables scroll, never squash */
  .table--wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .field-row { flex-wrap: wrap; }
}
