:root {
  --bg: #f6f7fa;
  --surface: #ffffff;
  --line: #e4e7ed;
  --ink: #202331;
  --ink-2: #373b4a;
  --muted: #707486;
  --blue: #12a879;
  --blue-hover: #0d9067;
  --blue-soft: #e8f8f2;
  --teal: #22aeca;
  --teal-soft: #e7f8fb;
  --amber: #d97b08;
  --amber-soft: #fdf0d8;
  --green: #16794c;
  --green-soft: #dcf3e6;
  --coral: #c1292e;
  --coral-soft: #fce8e6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(32, 35, 49, .04), 0 6px 18px rgba(32, 35, 49, .04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { height: 100%; }
body {
  font-family: Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; transform: translateY(-150%); background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 7px; }
.skip-link:focus { transform: none; }
button { font: inherit; letter-spacing: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
svg { display: block; width: 1em; height: 1em; flex: none; }
.muted { color: var(--muted); }
.workspace-boot { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--bg); }
.workspace-boot[hidden] { display: none; }
.workspace-boot > div { display: flex; align-items: center; gap: 11px; color: var(--ink-2); font-size: 13px; }
.workspace-boot span { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: upload-spin .8s linear infinite; }

/* Layout */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 248px; z-index: 40;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px;
  transition: width .2s ease, padding .2s ease;
}
.main { margin-left: 248px; min-height: 100vh; padding: 0 32px 96px; transition: margin-left .2s ease; }
.brand { display: flex; gap: 11px; align-items: center; padding: 2px 8px 28px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #22c55e, #22b8cf); color: #fff; flex: none;
  box-shadow: 0 5px 14px rgba(18, 168, 121, .2);
}
.brand-mark > span { font-size: 13px; font-weight: 800; letter-spacing: -.4px; }
.brand strong { display: block; font-size: 15px; line-height: 1.2; letter-spacing: -.2px; }
.brand small { color: var(--muted); font-size: 10.5px; }

.nav-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: 0 10px 7px;
}
.nav { display: flex; flex-direction: column; gap: 20px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--ink-2); font-weight: 600; font-size: 14px;
  text-align: left; transition: background .15s, color .15s;
}
.nav-item:hover { background: #f0f1f4; color: var(--ink); }
.nav-item.active { background: var(--blue-soft); color: var(--blue); }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-badge {
  margin-left: auto; background: var(--blue); color: #fff; font-size: 11px;
  font-weight: 700; border-radius: 99px; padding: 1px 7px; min-width: 22px; text-align: center;
}
.nav-badge.teal { background: var(--teal); color: #fff; }

.sidebar-foot { border-top: 1px solid var(--line); padding-top: 9px; }
.nav-secondary { padding-bottom: 8px; }
.nav-secondary .nav-item { color: var(--muted); }
.nav-secondary .nav-item.active { color: var(--blue); }
.account-row { display: flex; gap: 10px; align-items: center; padding: 6px 8px; }
.account-copy { flex: 1; min-width: 0; }
.avatar {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--blue-soft); color: var(--blue); font-weight: 700; flex: none;
}
.account-row strong { display: block; font-size: 13px; line-height: 1.25; }
.account-row small { color: var(--muted); font-size: 11px; }
.logout-btn { width: 30px; height: 30px; border: 0; border-radius: 7px; display: grid; place-items: center; color: var(--muted); background: transparent; cursor: pointer; }
.logout-btn:hover { color: var(--coral); background: var(--coral-soft); }
.logout-btn svg { width: 16px; height: 16px; }

body.sidebar-collapsed .sidebar { width: 78px; padding-inline: 11px; }
body.sidebar-collapsed .main { margin-left: 78px; }
body.sidebar-collapsed .brand { justify-content: center; padding-inline: 0; }
body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-item > span:not(.nav-badge),
body.sidebar-collapsed .account-copy { display: none; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 11px; position: relative; }
body.sidebar-collapsed .nav { gap: 12px; }
body.sidebar-collapsed .nav-item:hover::after {
  content: attr(data-tooltip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  z-index: 60; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap;
  box-shadow: var(--shadow); pointer-events: none;
}
body.sidebar-collapsed .nav-badge { position: absolute; top: 5px; right: 5px; min-width: 15px; padding: 0 4px; font-size: 9px; }
body.sidebar-collapsed .account-row { flex-direction: column; padding-inline: 0; }
body.sidebar-collapsed .avatar { width: 32px; height: 32px; font-size: 10px; }
body.sidebar-collapsed .menu-btn svg { transform: scaleX(-1); }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 24px 0 20px; position: sticky; top: 0; z-index: 30;
  background: var(--bg);
}
.topbar h1 { font-size: 21px; line-height: 1.2; font-weight: 700; letter-spacing: -.35px; }
.topbar p { font-size: 13px; margin-top: 2px; }
.icon-btn.menu-btn { display: grid; }
.menu-btn svg { transition: transform .2s ease; }
.top-cta { margin-left: auto; }

.section-tabs {
  display: inline-flex; align-items: center; gap: 3px; margin: 0 0 18px; padding: 3px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
}
.section-tabs button {
  border: 0; border-radius: 6px; padding: 7px 12px; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 12.5px; font-weight: 600; transition: background .15s, color .15s;
}
.section-tabs button:hover { color: var(--ink); background: #f0f1f4; }
.section-tabs button.active { color: var(--blue); background: var(--blue-soft); }

.mobile-nav-menu { display: grid; gap: 5px; }
.mobile-nav-menu > button {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) 18px; align-items: center; gap: 11px;
  width: 100%; padding: 12px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); text-align: left; cursor: pointer;
}
.mobile-nav-menu > button:hover { background: #f0f1f4; }
.mobile-nav-menu > button > svg { width: 20px; height: 20px; color: var(--blue); }
.mobile-nav-menu span { min-width: 0; }
.mobile-nav-menu strong,.mobile-nav-menu small { display: block; }
.mobile-nav-menu small { margin-top: 2px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; border-radius: 8px; padding: 9px 15px; cursor: pointer;
  font-weight: 600; font-size: 13.5px; line-height: 1.2; transition: background .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(100deg, #18b969, #22aeca); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #45474f; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f0f1f4; }
.btn-teal { background: var(--teal); color: #fff; }
.btn-sm { padding: 8px 13px; font-size: 12.5px; }
.btn-teal:hover { background: #108c78; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: #f0f1f4; }

/* Page */
.page { display: none; }
.page.active { display: block; animation: rise .18s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3-2 { grid-template-columns: 3fr 2fr; }
.cols-2-1 { grid-template-columns: 2fr 1fr; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title h3 { font-size: 14.5px; font-weight: 700; }
.card-title .spacer { flex: 1; }
.link-btn {
  background: none; border: 0; color: var(--blue); font-weight: 600; font-size: 13px; cursor: pointer; padding: 2px;
}
.link-btn:hover { text-decoration: underline; }

/* Home */
.home-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 6px 0 22px; }
.eyebrow, .section-label { display: block; color: var(--muted); font-size: 10px; line-height: 1.2; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.home-intro h2 { font-size: 28px; line-height: 1.15; letter-spacing: -.7px; margin-top: 7px; }
.home-intro p { color: var(--muted); font-size: 13.5px; margin-top: 7px; }
.home-actions, .workspace-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.account-strip { display: flex; align-items: center; gap: 18px; padding: 15px 18px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.account-identity { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
.account-logo { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 700; object-fit: cover; }
.account-identity strong { display: block; font-size: 13.5px; }
.account-identity small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.connection-dot { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; background: #f1f8f4; border-radius: 7px; color: var(--green); font-size: 11.5px; font-weight: 600; }
.connection-dot i { width: 7px; height: 7px; border-radius: 50%; background: #28a36a; box-shadow: 0 0 0 3px #dff3e8; }
.connection-dot.offline { background: #f0f1f4; color: var(--muted); }
.connection-dot.offline i { background: #9a9da8; box-shadow: 0 0 0 3px #e2e4e9; }
.connection-actions { display: flex; align-items: center; gap: 7px; }
.btn.danger { color: var(--coral); }
.account-owner { color: var(--muted); font-size: 11.5px; }
.account-owner strong { color: var(--ink); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 8px; min-height: 150px; }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; }
.kpi-label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.kpi-icon {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none;
}
.kpi-icon svg { width: 16px; height: 16px; }
.kpi-value { font-size: 29px; font-weight: 700; line-height: 1; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.kpi-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.up { background: var(--green-soft); color: var(--green); }
.down { background: var(--coral-soft); color: var(--coral); }
.flat { background: #e9eaf0; color: var(--muted); }
.kpi-note { font-size: 12px; color: var(--muted); }
.home-grid { display: grid; gap: 12px; margin-top: 12px; }
.home-grid > .card { min-width: 0; }
.home-grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(320px, .85fr); }
.home-grid-secondary { grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); }
.section-label + h3 { margin-top: 4px; }
.performance-card .card-title, .queue-card .card-title { margin-bottom: 10px; }
.queue-card .row { cursor: pointer; }
.empty-copy { color: var(--muted); font-size: 12.5px; padding: 24px 0; text-align: center; }
.tiktok-card { margin-top: 12px; }
.tiktok-row { display: grid; grid-template-columns: 44px minmax(220px, 1fr) repeat(4, minmax(58px, 86px)); gap: 14px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.tiktok-row > img, .tiktok-cover { width: 44px; height: 56px; border-radius: 7px; object-fit: cover; background: #e9eaf0; display: grid; place-items: center; color: var(--muted); }
.tiktok-cover svg { width: 18px; height: 18px; }
.tiktok-row > span:not(.tiktok-cover) { text-align: right; }
.tiktok-row > span b, .tiktok-row > span small { display: block; }
.tiktok-row > span b { font-size: 13px; }
.tiktok-row > span small { color: var(--muted); font-size: 10px; }
.tiktok-row .row-main a { color: var(--blue); text-decoration: none; }
.tiktok-row .row-main a:hover { text-decoration: underline; }

/* Chart */
.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: 176px; }
.chart-labels { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); align-items: center; margin-bottom: 10px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }

/* Status chip */
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 99px; white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-inbox { background: #edeef1; color: #656979; }
.st-process { background: var(--amber-soft); color: var(--amber); }
.st-scheduled { background: var(--blue-soft); color: var(--blue); }
.st-published { background: var(--green-soft); color: var(--green); }
.st-archived { background: #ececf0; color: #858897; }

/* List rows */
.row-list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row:first-child { padding-top: 0; }
.thumb {
  width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex: none;
  background: #e9eaf0; display: grid; place-items: center; color: var(--muted);
}
.thumb svg { width: 20px; height: 20px; }
.thumb > img, .thumb > video { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.row-main { flex: 1; min-width: 0; }
.row-main strong { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main small { color: var(--muted); font-size: 12px; }
.row .chip { flex: none; }
.row-actions { display: flex; gap: 8px; flex: none; }

/* Progress */
.progress { height: 7px; border-radius: 99px; background: #e9eaf0; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 99px; background: var(--blue); }
.prog-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.prog-row .progress { flex: 1; }
.prog-row b { font-size: 12px; min-width: 34px; text-align: right; }

/* Activity feed */
.feed { display: flex; flex-direction: column; gap: 14px; }
.feed-item { display: flex; gap: 12px; align-items: flex-start; }
.feed-dot {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--teal-soft); color: var(--teal);
}
.feed-dot.coral { background: var(--coral-soft); color: var(--coral); }
.feed-dot.amber { background: var(--amber-soft); color: var(--amber); }
.feed-dot svg { width: 14px; height: 14px; }
.feed-item p { font-size: 13px; line-height: 1.4; }
.feed-item small { color: var(--muted); font-size: 11.5px; }

/* Calendar (month grid) */
.cal-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-legend { display: flex; align-items: center; gap: 13px; color: var(--muted); font-size: 11px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.cal-legend i { width: 8px; height: 8px; border-radius: 3px; }
.cal-legend .planned { background: var(--blue); }
.cal-legend .live { background: var(--ink); box-shadow: inset 2px 0 #25f4ee; }
.cal-arrow {
  width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 8px; transition: background .15s, box-shadow .15s;
}
.cal-arrow:hover { background: #f0f1f4; box-shadow: var(--shadow); }
.cal-arrow svg { width: 17px; height: 17px; }
.cal-title { font-size: 17px; font-weight: 700; min-width: 128px; text-align: center; }
.cal-wrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; box-shadow: var(--shadow);
}
.cal-head {
  display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.cal-head div {
  text-align: center; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; padding: 10px 4px;
}
.cal-body { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell {
  min-height: 112px; padding: 6px; border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px;
  overflow: hidden; transition: background .15s, box-shadow .15s;
}
.cal-cell.is-over { background: var(--blue-soft); box-shadow: inset 0 0 0 2px var(--blue); }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.out { background: #fafbfc; }
.cal-cell.out .cal-num { color: #b5b7c0; }
.cal-num {
  align-self: flex-end; width: 26px; height: 26px; border: 0; background: none; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2); border-radius: 50%;
  display: grid; place-items: center; transition: background .15s;
}
.cal-num:hover { background: #f0f1f4; }
.cal-cell.today .cal-num { background: var(--blue); color: #fff; }
.cal-event {
  display: block; width: 100%; text-align: left; border: 0; border-radius: 4px;
  padding: 4px 6px; font-size: 11.5px; font-weight: 600; cursor: pointer; line-height: 1.3;
  color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-event:hover { filter: brightness(.96); }
.cal-event[draggable="true"] { cursor: grab; }
.cal-event[draggable="true"]:active { cursor: grabbing; }
.cal-event.dragging { opacity: .4; }
.cal-event.inbox { background: #edeef1; color: #656979; }
.cal-event.process { background: var(--amber-soft); color: var(--amber); }
.cal-event.scheduled { background: var(--blue-soft); color: var(--blue); }
.cal-event.published { background: var(--green-soft); color: var(--green); }
.cal-event.tiktok-live { border-left: 3px solid #25f4ee; background: var(--ink); color: #fff; text-decoration: none; }
.cal-more { font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 1px 6px; }

/* Campaigns */
.camp-card { display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; }
.camp-card:hover { transform: translateY(-1px); border-color: #c9ccef; box-shadow: 0 8px 22px rgba(32,35,49,.08); }
.camp-head { display: flex; gap: 12px; align-items: center; }
.campaign-icon { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--blue); background: var(--blue-soft); }
.campaign-icon svg { width: 18px; height: 18px; }
.campaign-gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.campaign-media { aspect-ratio: 4 / 3; border-radius: 7px; background: #eceef3; overflow: hidden; position: relative; }
.campaign-media img, .campaign-media video { width: 100%; height: 100%; object-fit: cover; }
.campaign-media > span { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(32, 35, 49, .66); color: #fff; font-size: 12px; font-weight: 700; }
.campaign-media-empty { min-height: 74px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 11.5px; }
.camp-head strong { display: block; font-size: 15px; font-weight: 700; }
.camp-head small { color: var(--muted); font-size: 12px; }
.camp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.camp-stat { background: var(--bg); border-radius: 8px; padding: 9px; }
.camp-stat b { display: block; font-size: 14px; font-weight: 700; }
.camp-stat span { font-size: 11px; color: var(--muted); }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { background: #e9eaf0; color: var(--muted); font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px; }
.tag.coral { background: var(--coral-soft); color: var(--coral); }
.tag.teal { background: var(--teal-soft); color: #0e7d68; }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.camp-foot { display: flex; align-items: center; gap: 10px; }
.camp-foot small { color: var(--muted); font-size: 11.5px; }
.camp-foot .spacer { flex: 1; }
.campaign-detail-head { display: flex; align-items: center; gap: 24px; padding: 4px 0 18px; }
.campaign-detail-head > div:first-child { flex: 1; }
.campaign-detail-head h3 { margin-top: 5px; font-size: 22px; letter-spacing: -.4px; }
.campaign-detail-head p { margin-top: 5px; color: var(--muted); font-size: 12.5px; }
.campaign-progress-ring { --progress: 0deg; width: 82px; height: 82px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--blue) var(--progress), #e9eaf0 0); flex: none; }
.campaign-progress-ring::before { content: ""; width: 64px; height: 64px; border-radius: 50%; background: var(--surface); grid-area: 1 / 1; }
.campaign-progress-ring span { position: relative; grid-area: 1 / 1; text-align: center; }
.campaign-progress-ring b, .campaign-progress-ring small { display: block; }
.campaign-progress-ring b { font-size: 16px; }
.campaign-progress-ring small { color: var(--muted); font-size: 9.5px; }
.campaign-detail-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; }
.campaign-detail-metrics > div { padding: 13px; border-radius: 8px; background: var(--bg); }
.campaign-detail-metrics b, .campaign-detail-metrics span { display: block; }
.campaign-detail-metrics b { font-size: 15px; }
.campaign-detail-metrics span { margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.campaign-detail-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.campaign-detail-title strong { font-size: 13px; }
.campaign-detail-title small { color: var(--muted); font-size: 10.5px; }
.campaign-post-list { border-top: 1px solid var(--line); }
.campaign-post-row { width: 100%; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.campaign-post-row > span:nth-child(2) { min-width: 0; }
.campaign-post-row strong, .campaign-post-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campaign-post-row strong { font-size: 12.5px; }
.campaign-post-row small { margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.campaign-detail-empty { padding: 28px 10px; color: var(--muted); font-size: 12px; text-align: center; }

/* Workspace */
.kanban-intro { display: flex; align-items: flex-end; gap: 20px; margin: 5px 0 18px; }
.kanban-intro > div:first-child { flex: 1; }
.kanban-intro h3 { font-size: 19px; letter-spacing: -.3px; margin-top: 4px; }
.kanban-intro p { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kanban-shell { overflow-x: auto; padding-bottom: 12px; scrollbar-color: #c8ccd7 transparent; scrollbar-width: thin; }
.kanban-board { display: grid; grid-template-columns: repeat(5, minmax(238px, 1fr)); gap: 12px; min-width: 1240px; align-items: start; }
.kanban-column { background: #f0f2f6; border: 1px solid var(--line); border-radius: 11px; min-height: 560px; overflow: hidden; }
.kanban-column-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.kanban-column-head span { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; }
.kanban-column-head small { display: block; margin: 3px 0 0 15px; color: var(--muted); font-size: 10.5px; font-weight: 500; }
.kanban-column-head i { width: 8px; height: 8px; border-radius: 50%; background: #8b8e9b; }
.kanban-column.st-process .kanban-column-head i { background: var(--amber); }
.kanban-column.st-scheduled .kanban-column-head i { background: var(--blue); }
.kanban-column.st-published .kanban-column-head i { background: var(--green); }
.kanban-column.st-archived .kanban-column-head i { background: #9a9ca8; }
.kanban-column-head b { min-width: 24px; padding: 3px 7px; border-radius: 6px; color: var(--muted); background: #f0f1f4; font-size: 10.5px; text-align: center; }
.kanban-list { display: flex; flex-direction: column; gap: 9px; min-height: 500px; padding: 9px; transition: background .15s; }
.kanban-list.is-over { background: #e7eafe; outline: 2px dashed #aab2f3; outline-offset: -5px; }
.kanban-card { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px; box-shadow: var(--shadow); cursor: grab; transition: transform .15s, opacity .15s, border-color .15s, box-shadow .15s; }
.kanban-card:active { cursor: grabbing; }
.kanban-card:hover { border-color: #c7ccef; box-shadow: 0 6px 18px rgba(32, 35, 49, .09); transform: translateY(-1px); }
.kanban-card.dragging { opacity: .45; transform: rotate(1deg) scale(.98); }
.kanban-card > strong { font-size: 12.5px; line-height: 1.35; }
.kanban-card > small { color: var(--muted); font-size: 10.8px; line-height: 1.35; }
.kanban-card.is-overdue { border-color: #e7aaa7; }
.kanban-date { display: flex; align-items: center; gap: 5px; }
.kanban-date b { margin-left: auto; padding: 2px 5px; border-radius: 5px; background: var(--coral-soft); color: var(--coral); font-size: 9px; }
.workspace-actions { flex-wrap: wrap; justify-content: flex-end; }
.workspace-range { display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: #eceef3; }
.workspace-range button { border: 0; border-radius: 6px; padding: 6px 9px; background: transparent; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
.workspace-range button:hover { color: var(--ink); }
.workspace-range button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(32,35,49,.12); }
.kanban-media { height: 118px; border-radius: 7px; background: #e8eaf0; display: grid; place-items: center; overflow: hidden; color: var(--muted); pointer-events: none; }
.kanban-media img, .kanban-media video { width: 100%; height: 100%; object-fit: cover; }
.kanban-status { display: none; width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); padding: 7px; font: inherit; font-size: 11px; cursor: pointer; }
.kanban-empty { color: #9699a7; font-size: 11.5px; text-align: center; padding: 28px 8px; border: 1px dashed #d6d9e1; border-radius: 8px; }

/* Analysis */
.analysis-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 5px 0 16px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow); }
.analysis-profile { display: flex; align-items: center; gap: 13px; min-width: 0; }
.analysis-profile > img, .analysis-profile > span { width: 48px; height: 48px; border-radius: 10px; display: grid; place-items: center; object-fit: cover; background: var(--ink); color: #fff; font-weight: 700; flex: none; }
.analysis-profile h2 { margin-top: 3px; font-size: 19px; letter-spacing: -.3px; }
.analysis-profile p { margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.analysis-sync-actions { display: flex; align-items: center; gap: 11px; flex: none; }
.analysis-auto-sync { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.analysis-auto-sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.analysis-kpis { margin-bottom: 12px; }
.analysis-kpis .kpi { min-height: 112px; padding: 14px 16px; gap: 6px; }
.analysis-kpis .kpi-icon { width: 27px; height: 27px; }
.analysis-kpis .kpi-icon svg { width: 14px; height: 14px; }
.analysis-kpis .kpi-value { font-size: 23px; letter-spacing: -.35px; }
.analysis-kpis .kpi-label, .analysis-kpis .kpi-note { font-size: 10.5px; }
.analysis-kpis .kpi-delta { font-size: 9.5px; }
.analysis-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.analysis-history { min-width: 0; }
.analysis-history-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.analysis-history-head h3 { margin-top: 3px; font-size: 14px; letter-spacing: -.1px; }
.analysis-history-head p { margin-top: 4px; color: var(--muted); font-size: 10.5px; }
.analysis-history-head p strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.analysis-history-head p .positive { color: var(--green); }
.analysis-history-head p .negative { color: var(--coral); }
.analysis-chart-controls { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.analysis-segment { display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: #eceef3; }
.analysis-segment button { border: 0; border-radius: 5px; padding: 5px 8px; background: transparent; color: var(--muted); font: inherit; font-size: 9.5px; font-weight: 600; cursor: pointer; transition: color .15s, background .15s, box-shadow .15s; }
.analysis-segment button:hover { color: var(--ink); }
.analysis-segment button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.analysis-segment button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(32,35,49,.12); }
.analysis-metric-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 14px 0 10px; border-block: 1px solid var(--line); }
.analysis-metric-strip > div { min-width: 0; padding: 10px 12px; border-right: 1px solid var(--line); }
.analysis-metric-strip > div:first-child { padding-left: 0; }
.analysis-metric-strip > div:last-child { padding-right: 0; border-right: 0; }
.analysis-metric-strip span, .analysis-metric-strip small { display: block; overflow: hidden; color: var(--muted); font-size: 9px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.analysis-metric-strip b { display: block; margin: 3px 0 2px; font-size: 16px; letter-spacing: -.2px; font-variant-numeric: tabular-nums; }
.analysis-insight { display: flex; align-items: baseline; gap: 9px; margin-bottom: 4px; padding: 8px 10px; border-radius: 7px; background: #f2f7f5; }
.analysis-insight > span { color: var(--green); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.analysis-insight p { min-width: 0; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.analysis-insight strong { color: var(--ink); }
.analysis-chart { position: relative; overflow-x: auto; }
.analysis-chart-legend { display: flex; justify-content: flex-end; gap: 13px; min-width: 720px; padding: 8px 5px 0; color: var(--muted); font-size: 9px; }
.analysis-chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.analysis-chart-legend i { display: inline-block; width: 11px; height: 7px; }
.analysis-chart-legend .line { height: 0; border-top: 2px solid var(--blue); }
.analysis-chart-legend .bar { border-radius: 2px; background: var(--blue-soft); }
.analysis-chart-legend .post { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.analysis-chart svg { display: block; width: 100%; min-width: 720px; height: auto; overflow: visible; }
.analysis-gridline { fill: none; stroke: #e8eaf0; stroke-width: 1; }
.analysis-axis { stroke: #cfd2dc; stroke-width: 1; }
.analysis-axis-label { fill: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.analysis-axis-time { fill: #a0a3ae; font-size: 7.5px; font-variant-numeric: tabular-nums; }
.analysis-gain-bar { fill: var(--blue-soft); transition: fill .15s; }
.analysis-gain-bar:hover { fill: #cbd1f9; }
.analysis-post-line { stroke: #a8aaaf; stroke-width: 1; stroke-dasharray: 3 4; opacity: .55; pointer-events: none; }
.analysis-post-marker { fill: var(--ink) !important; stroke: var(--surface) !important; stroke-width: 2 !important; }
.analysis-line { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.analysis-chart circle { fill: var(--surface); stroke: var(--blue); stroke-width: 2.5; }
.analysis-chart circle[data-chart-tooltip], .analysis-gain-bar { cursor: crosshair; }
.analysis-chart-tooltip { position: fixed; z-index: 90; max-width: 280px; padding: 7px 9px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 10px; line-height: 1.4; opacity: 0; pointer-events: none; transform: translate(-50%, calc(-100% - 10px)); transition: opacity .1s; }
.analysis-chart-tooltip.show { opacity: 1; }
.analysis-chart-empty { min-height: 170px; display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; }
.analysis-compare { margin-top: 12px; }
.analysis-table-wrap { overflow-x: auto; }
.analysis-table { width: 100%; min-width: 880px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.analysis-table th { padding: 9px 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-align: right; text-transform: uppercase; white-space: nowrap; }
.analysis-table th:first-child, .analysis-table td:first-child { padding-left: 0; text-align: left; }
.analysis-table th:last-child, .analysis-table td:last-child { padding-right: 0; }
.analysis-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 600; text-align: right; white-space: nowrap; }
.analysis-table tbody tr:last-child td { border-bottom: 0; }
.analysis-account { display: flex; align-items: center; gap: 9px; min-width: 180px; }
.analysis-account > img, .analysis-account > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; object-fit: cover; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-weight: 800; flex: none; }
.analysis-account strong, .analysis-account a { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.analysis-account strong { font-size: 11.5px; }
.analysis-account a { margin-top: 1px; color: var(--muted); font-size: 10px; font-weight: 500; text-decoration: none; }
.analysis-delta { display: inline-flex; padding: 3px 6px; border-radius: 5px; font-size: 10.5px; }
.analysis-delta.positive { background: var(--green-soft); color: var(--green); }
.analysis-delta.negative { background: var(--coral-soft); color: var(--coral); }
.analysis-delta.neutral { background: #eceef2; color: var(--muted); }
.analysis-live { color: var(--green); font-size: 10.5px; }
.analysis-remove { width: 28px; height: 28px; display: inline-grid; place-items: center; margin-left: 4px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; vertical-align: middle; }
.analysis-remove:hover { background: var(--coral-soft); color: var(--coral); }
.analysis-remove svg { width: 13px; height: 13px; }
.analysis-content { margin-top: 28px; }
.analysis-content-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.analysis-content-head h3 { margin-top: 4px; font-size: 18px; letter-spacing: -.2px; }
.analysis-content-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.analysis-video-list { display: grid; gap: 8px; }
.analysis-video-card { display: grid; grid-template-columns: 64px minmax(220px, 1fr) minmax(420px, .9fr); gap: 14px; align-items: center; padding: 10px 14px 10px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); transition: border-color .15s, transform .15s; }
.analysis-video-card:hover { border-color: #c9ccef; transform: translateY(-1px); }
.analysis-video-cover { width: 64px; height: 80px; position: relative; display: grid; place-items: center; overflow: hidden; border-radius: 7px; background: #e9eaf0; color: var(--muted); }
.analysis-video-cover img { width: 100%; height: 100%; object-fit: cover; }
.analysis-video-cover svg { width: 20px; height: 20px; }
.analysis-video-cover span { position: absolute; right: 5px; bottom: 5px; padding: 2px 5px; border-radius: 4px; background: rgba(32,35,49,.78); color: #fff; font-size: 8.5px; font-weight: 700; }
.analysis-video-copy { min-width: 0; }
.analysis-video-copy strong { display: -webkit-box; overflow: hidden; font-size: 12.5px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.analysis-video-copy small { display: block; margin-top: 5px; color: var(--muted); font-size: 10.5px; }
.analysis-video-metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.analysis-video-metrics span { color: var(--muted); font-size: 9.5px; }
.analysis-video-metrics b { display: block; margin-bottom: 2px; color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Library */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.lib-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.library-head { display: flex; align-items: center; gap: 12px; margin: 8px 0 12px; }
.library-head h3 { font-size: 14.5px; }
.references-head { margin-top: 30px; }
.filter-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600;
  padding: 7px 13px; border-radius: 99px; cursor: pointer; font-size: 12.5px;
}
.filter-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.search-box {
  display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; color: var(--muted);
}
.search-box svg { width: 15px; height: 15px; }
.search-box input { border: 0; outline: 0; font: inherit; font-size: 12.5px; width: 180px; background: transparent; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.asset-card { overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.asset-card:hover { border-color: #c9cce8; box-shadow: 0 4px 16px rgba(50, 51, 56, .1); transform: translateY(-1px); }
.asset-media {
  aspect-ratio: 4 / 5; width: 100%; object-fit: cover; background: #e9eaf0; border-radius: 8px;
  display: grid; place-items: center; color: var(--muted); position: relative;
}
.asset-media img, .asset-media video { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.asset-missing-cover { width: 100%; height: 100%; display: grid; place-content: center; justify-items: center; gap: 9px; text-align: center; color: var(--coral); background: var(--coral-soft); }
.asset-missing-cover svg { width: 25px; height: 25px; }
.asset-missing-cover b { font-size: 12px; line-height: 1.45; }
.media-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: #9a9dab; }
.media-placeholder svg { width: 28px; height: 28px; }
.asset-badge {
  position: absolute; top: 8px; left: 8px; background: rgba(50, 51, 56, .82); color: #fff;
  font-size: 10.5px; font-weight: 600; padding: 3px 8px; border-radius: 99px; display: flex; gap: 5px; align-items: center;
}
.asset-badge svg { width: 11px; height: 11px; }
.asset-body { padding: 12px 2px 2px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.asset-body strong { font-size: 13.5px; font-weight: 700; }
.asset-file-summary { color: var(--blue); font-size: 11px; font-weight: 600; }
.asset-file-error { display: flex; align-items: center; gap: 5px; color: var(--coral); font-size: 10.5px; font-weight: 650; }
.asset-file-error svg { width: 12px; height: 12px; flex: none; }
.asset-body p { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.asset-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.asset-foot small { font-size: 11px; color: var(--muted); }
.asset-foot .spacer { flex: 1; }
.copy-btn { flex: none; }

.template-grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 1fr; }
.template-card { display: flex; flex-direction: column; gap: 10px; }
.template-head { display: flex; gap: 12px; align-items: center; }
.template-head h4 { font-size: 13.5px; font-weight: 700; line-height: 1.3; }
.template-head small { font-size: 11.5px; }
.template-card h4 { font-size: 14px; font-weight: 700; }
.template-card p { font-size: 12.5px; color: var(--muted); flex: 1; }
.template-link {
  display: inline-flex; align-items: center; gap: 6px; color: var(--teal);
  font-weight: 700; font-size: 12.5px; text-decoration: none; margin-top: auto;
}
.template-link:hover { text-decoration: underline; }
.template-link svg { width: 13px; height: 13px; }

/* Modal */
dialog {
  border: 0; border-radius: 10px; padding: 0; width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px); box-shadow: 0 24px 64px rgba(50, 51, 56, .22);
  overflow: hidden; position: fixed; inset: 0; margin: auto;
}
dialog.modal-wide { width: min(940px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(50, 51, 56, .45); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 18px 20px 22px; max-height: 68vh; overflow-y: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 13.5px;
  background: var(--surface); color: var(--ink); width: 100%;
}
.field textarea { min-height: 86px; resize: vertical; }
.field small { color: var(--muted); font-size: 11px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: transparent; }
.modal-wide .modal-body { max-height: calc(100dvh - 104px); }
.asset-editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
.asset-media-pane, .asset-details-pane { min-width: 0; }
.asset-details-pane { min-height: 500px; padding-left: 22px; border-left: 1px solid var(--line); }
.asset-details-pane .form-grid { grid-template-columns: 1fr; }
.asset-details-pane #a-desc { min-height: 300px; line-height: 1.55; }
.asset-editor-tabs { display: flex; gap: 4px; padding: 3px; margin-bottom: 14px; border-radius: 8px; background: var(--bg); }
.asset-editor-tabs button { flex: 1; border: 0; border-radius: 6px; padding: 8px 10px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; transition: background .15s, color .15s, box-shadow .15s; }
.asset-editor-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(32,35,49,.1); }
.asset-editor-pane:not(.active) { display: none; }
.script-field textarea { min-height: 430px; line-height: 1.65; resize: vertical; }
.script-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.script-tip { margin-top: 12px; padding: 10px 11px; border-radius: 7px; background: var(--blue-soft); color: var(--muted); font-size: 11.5px; }
.asset-files-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.asset-files-head strong, .asset-files-head small { display: block; }
.asset-files-head strong { font-size: 13px; }
.asset-files-head small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.asset-carousel { height: min(52vh, 500px); min-height: 340px; position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #eef0f4; touch-action: pan-y; user-select: none; }
.asset-carousel-track { display: flex; width: 100%; height: 100%; transition: transform .3s cubic-bezier(.22,.7,.25,1); }
.asset-carousel-slide { flex: 0 0 100%; width: 100%; height: 100%; position: relative; overflow: hidden; }
.asset-carousel-slide img, .asset-carousel-slide video { display: block; width: calc(100% - 32px); height: calc(100% - 32px); position: absolute; inset: 16px; object-fit: contain; border-radius: 6px; -webkit-user-drag: none; }
.asset-carousel-nav { width: 34px; height: 34px; position: absolute; top: 50%; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(16,18,25,.72); color: #fff; cursor: pointer; transform: translateY(-50%); backdrop-filter: blur(6px); }
.asset-carousel-nav:hover { background: rgba(16,18,25,.9); }
.asset-carousel-nav.prev { left: 12px; }
.asset-carousel-nav.next { right: 12px; }
.asset-carousel-nav.next svg { transform: rotate(180deg); }
.asset-carousel-nav svg { width: 18px; height: 18px; }
.asset-carousel-count { position: absolute; top: 12px; right: 12px; padding: 4px 8px; border-radius: 99px; background: rgba(16,18,25,.72); color: #fff; font-size: 10.5px; font-weight: 700; backdrop-filter: blur(6px); }
.asset-carousel-dots { height: 20px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.asset-carousel-dots i { width: 5px; height: 5px; border-radius: 50%; background: #c8cbd4; transition: width .2s, background .2s; }
.asset-carousel-dots i.active { width: 16px; border-radius: 4px; background: var(--blue); }
.asset-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 5px; scrollbar-width: thin; }
.asset-strip-item { flex: 0 0 78px; padding: 3px; border: 1px solid transparent; border-radius: 9px; background: var(--surface); transition: border-color .15s, opacity .15s, transform .15s; cursor: grab; }
.asset-strip-item.active { border-color: var(--blue); }
.asset-strip-item.dragging { opacity: .4; transform: scale(.96); }
.asset-strip-item.is-over { border-color: var(--teal); }
.asset-strip-select { width: 70px; height: 84px; display: block; position: relative; overflow: hidden; border: 0; border-radius: 6px; padding: 0; background: #e9ebf0; cursor: pointer; }
.asset-strip-select img, .asset-strip-select video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.asset-strip-select span { position: absolute; top: 5px; left: 5px; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 99px; background: rgba(16,18,25,.72); color: #fff; font-size: 9px; font-weight: 700; }
.asset-strip-actions { display: flex; justify-content: center; gap: 1px; padding-top: 2px; }
.asset-strip-actions button { width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; }
.asset-strip-actions button:nth-child(2) svg { transform: rotate(180deg); }
.asset-strip-actions button:hover:not(:disabled) { background: var(--bg); color: var(--ink); }
.asset-strip-actions button.remove:hover { color: var(--coral); }
.asset-strip-actions button:disabled { opacity: .2; cursor: default; }
.asset-strip-actions svg { width: 13px; height: 13px; }
.asset-sort-hint { margin-top: 4px; color: var(--muted); font-size: 10.5px; }
.asset-file-empty { min-height: 320px; display: grid; place-items: center; padding: 28px; border: 1px dashed var(--line); border-radius: 9px; color: var(--muted); text-align: center; }
.asset-uploading { min-height: 92px; display: flex; align-items: center; gap: 13px; margin-bottom: 10px; padding: 16px; border: 1px solid #cfd5fa; border-radius: 10px; background: var(--blue-soft); color: var(--ink-2); }
.asset-uploading i { width: 22px; height: 22px; flex: none; border: 3px solid #cfd5fa; border-top-color: var(--blue); border-radius: 50%; animation: upload-spin .8s linear infinite; }
.asset-uploading strong,.asset-uploading small { display: block; }
.asset-uploading strong { font-size: 12.5px; overflow-wrap: anywhere; }
.asset-uploading small { margin-top: 3px; color: var(--muted); font-size: 10.5px; }
@keyframes upload-spin { to { transform: rotate(360deg); } }

/* Trends and TikTok drafts */
.trends-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 32px; margin-bottom: 20px; padding: 28px 30px 30px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.trends-hero h2 { max-width: 640px; margin: 7px 0 10px; font-size: clamp(25px, 3vw, 38px); line-height: 1.04; letter-spacing: -.04em; text-wrap: balance; }
.trends-hero p { max-width: 68ch; margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.65; }
.trends-official-links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.trends-official-links .btn svg { width: 14px; height: 14px; }
.trends-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.trend-panel { padding: 20px; }
.trend-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) 30px 30px; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.trend-item:first-of-type { margin-top: 9px; }
.trend-item-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: var(--blue-soft); color: var(--blue); }
.trend-item-icon.video { background: #edf0f2; color: var(--ink-2); }
.trend-item-icon svg { width: 17px; height: 17px; }
.trend-item strong,.trend-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trend-item strong { font-size: 12px; }
.trend-item small { margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.trend-item .icon-btn { width: 30px; height: 30px; color: var(--muted); }
.trend-empty { min-height: 118px; display: grid; place-items: center; padding: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; text-align: center; line-height: 1.55; }
.tiktok-draft-state { display: flex; align-items: center; gap: 11px; margin: 14px 0; padding: 12px 14px; border: 1px solid #c7e7d9; border-radius: 9px; background: var(--green-soft); }
.tiktok-draft-state > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; background: #fff; color: var(--green); }
.tiktok-draft-state svg { width: 16px; height: 16px; }
.tiktok-draft-state strong,.tiktok-draft-state small { display: block; }
.tiktok-draft-state strong { font-size: 12px; }
.tiktok-draft-state small { margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.autopost-state { border-color: #cfd5fa; background: var(--blue-soft); }
.autopost-state > span { color: var(--blue); }
.autopost-state.is-error { border-color: #f3c8c8; background: #fff4f3; }
.autopost-state.is-error > span { color: var(--coral); }
.autopost-account { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.autopost-account img,.autopost-account > span { width: 42px; height: 42px; flex: none; border-radius: 50%; object-fit: cover; }
.autopost-account > span { display: grid; place-items: center; background: var(--ink); color: #fff; font-size: 11px; font-weight: 800; }
.autopost-account small,.autopost-account strong,.autopost-account p { display: block; }
.autopost-account small,.autopost-account p { color: var(--muted); font-size: 10.5px; }
.autopost-account strong { margin: 1px 0; font-size: 13px; }
.autopost-form { margin-top: 14px; }
.autopost-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; }
.autopost-checks label,.autopost-consent { display: flex; align-items: flex-start; gap: 7px; color: var(--ink-2); font-size: 12px; line-height: 1.4; cursor: pointer; }
.autopost-checks input,.autopost-consent input { width: 15px; height: 15px; flex: none; margin: 1px 0 0; accent-color: var(--blue); }
.autopost-checks input:disabled + * { color: var(--muted); }
.autopost-consent.full { grid-column: 1 / -1; padding: 11px 12px; border-radius: 8px; background: var(--bg); }
.autopost-note { margin: 14px 0 0; }
.tiktok-send-progress { min-height: 130px; margin: 0; }
.setup-note { padding: 12px; margin-bottom: 14px; border-radius: 8px; background: var(--blue-soft); color: var(--ink-2); }
.setup-note strong { display: block; font-size: 13px; margin-bottom: 3px; }
.setup-note p { font-size: 12px; color: var(--muted); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.post-detail-actions { position: relative; flex-wrap: wrap; align-items: center; }
.action-menu { position: relative; }
.action-menu summary { list-style: none; }
.action-menu summary::-webkit-details-marker { display: none; }
.action-menu summary span { font-size: 14px; line-height: 1; }
.action-menu[open] summary { background: #f0f1f4; }
.action-menu-panel { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 5; min-width: 210px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 12px 30px rgba(50, 51, 56, .16); }
.action-menu-panel button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.action-menu-panel button:hover { background: var(--bg); color: var(--ink); }
.action-menu-panel button svg { width: 14px; height: 14px; flex: none; }
.action-menu-panel .menu-danger { color: var(--coral); }
.preview-box { display: flex; gap: 12px; align-items: center; background: var(--bg); border-radius: 8px; padding: 10px; margin-top: 12px; }
.preview-box img, .preview-box video { width: 64px; height: 80px; object-fit: cover; border-radius: 6px; flex: none; background: #e2e4e9; }
.preview-box p { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); }
.detail-line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.detail-line:last-child { border-bottom: 0; }
.detail-line span { color: var(--muted); }
.detail-caption { background: var(--bg); border-radius: 8px; padding: 12px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }

/* Connected channels */
.channels-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: end; margin: 8px 0 20px; padding: 26px 28px 29px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.channels-hero h2 { max-width: 620px; margin-top: 7px; font-size: clamp(25px, 3vw, 38px); line-height: 1.05; letter-spacing: -1.1px; text-wrap: balance; }
.channels-hero p { max-width: 650px; margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.65; text-wrap: pretty; }
.channels-summary { min-width: 130px; padding-left: 26px; border-left: 1px solid var(--line); text-align: right; }
.channels-summary strong,.channels-summary small { display: block; }
.channels-summary strong { font-size: 38px; line-height: 1; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; }
.channels-summary strong span { color: #a4a8b3; font-size: 20px; }
.channels-summary small { margin-top: 7px; color: var(--muted); font-size: 10.5px; }
.channel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.channel-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); transition: transform .18s ease, border-color .18s ease; }
.channel-card:hover { transform: translateY(-2px); border-color: #cfd3dc; }
.channel-card-head { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 11px; align-items: center; }
.channel-card-head h3 { margin-top: 3px; font-size: 16px; letter-spacing: -.25px; }
.channel-logo { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: #eff1f4; color: var(--ink); font-size: 10px; font-weight: 800; letter-spacing: -.2px; }
.channel-logo svg { width: 19px; height: 19px; fill: currentColor; }
.channel-logo.tiktok { background: #202124; color: #fff; }
.channel-logo.instagram { background: #f7ebf1; color: #a53b73; }
.channel-logo.threads { background: #ececef; color: #1f2025; font-size: 18px; }
.channel-logo.mini { width: 28px; height: 28px; border-radius: 7px; }
.channel-logo.mini svg { width: 14px; height: 14px; }
.channel-state { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9.5px; font-weight: 700; white-space: nowrap; }
.channel-state i { width: 6px; height: 6px; border-radius: 50%; background: #a7aab3; }
.channel-state.online { color: var(--green); }
.channel-state.online i { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.channel-profile { display: flex; align-items: center; gap: 10px; min-height: 54px; margin: 17px 0 14px; padding: 11px; border-radius: 9px; background: var(--bg); }
.channel-profile img,.channel-profile > span { width: 34px; height: 34px; flex: none; border-radius: 8px; object-fit: cover; }
.channel-profile > span { display: grid; place-items: center; background: var(--surface); color: var(--muted); font-size: 9px; font-weight: 800; }
.channel-profile > span svg,.autopost-account > span svg { width: 16px; height: 16px; fill: currentColor; }
.channel-profile strong,.channel-profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-profile strong { font-size: 12px; }
.channel-profile small { margin-top: 2px; color: var(--muted); font-size: 9.5px; }
.channel-copy { min-height: 68px; margin: 17px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.55; text-wrap: pretty; }
.channel-capabilities { display: flex; flex-wrap: wrap; gap: 5px; min-height: 46px; padding-top: 12px; border-top: 1px solid var(--line); }
.channel-capabilities span { height: fit-content; padding: 4px 7px; border-radius: 5px; background: var(--bg); color: var(--ink-2); font-size: 9px; font-weight: 600; }
.channel-actions { display: flex; align-items: center; gap: 7px; min-height: 32px; margin-top: 14px; }
.channel-actions small { margin-left: auto; color: var(--muted); font-size: 9px; }
.channel-actions .btn:disabled { cursor: not-allowed; opacity: .55; }
.channel-queue { margin-top: 12px; }
.channel-job { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.channel-job strong,.channel-job small { display: block; }
.channel-job strong { font-size: 12px; }
.channel-job small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.channel-empty { padding: 26px 0 20px; text-align: center; }
.channel-empty strong { font-size: 13px; }
.channel-empty p { margin-top: 4px; color: var(--muted); font-size: 11px; }
.channel-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.channel-picker.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.channel-option { position: relative; display: grid; grid-template-columns: 27px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.channel-option:hover { border-color: #bdc2cc; }
.channel-option:has(input:checked) { border-color: #8ecfb8; background: var(--blue-soft); }
.channel-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.channel-option > span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; background: #eceef2; color: var(--ink); font-size: 8px; font-weight: 800; }
.channel-option > span svg { width: 14px; height: 14px; fill: currentColor; }
.channel-option.instagram > span { background: #f7ebf1; color: #a53b73; }
.channel-option.threads > span { background: #e9e9ec; font-size: 14px; }
.channel-option strong { font-size: 11px; }
.channel-marks { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.channel-mark { width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 5px; background: #e9ebef; color: var(--ink-2); font-size: 6.5px; font-style: normal; font-weight: 800; line-height: 1; }
.channel-mark svg { width: 10px; height: 10px; fill: currentColor; }
.channel-mark.tiktok { background: #292a2e; color: #fff; }
.channel-mark.instagram { background: #f7e8f0; color: #a53b73; }
.channel-mark.threads { font-size: 10px; }
.detail-channels { display: inline-flex; align-items: center; gap: 7px; }
.detail-line .detail-channels .channel-marks { color: inherit; }
.kanban-channel-line { display: flex; align-items: center; gap: 5px; }
.social-publish-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.social-publish-head h3 { margin-top: 4px; font-size: 18px; }
.social-publish-head p { margin-top: 4px; color: var(--muted); font-size: 11px; }
.social-publish-form { margin-top: 14px; }
.cal-event .channel-marks { margin: 0 2px; }
.cal-event .channel-mark { width: 13px; height: 13px; border-radius: 3px; font-size: 5px; }
.cal-event .channel-mark svg { width: 7px; height: 7px; }
.cal-event .channel-mark.threads { font-size: 8px; }

/* Unified inbox */
.inbox-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: end; margin: 8px 0 14px; padding: 26px 28px 29px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.inbox-hero h2 { max-width: 650px; margin-top: 7px; font-size: clamp(25px, 3vw, 38px); line-height: 1.05; letter-spacing: -1.1px; text-wrap: balance; }
.inbox-hero p { max-width: 660px; margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.65; text-wrap: pretty; }
.inbox-total { min-width: 126px; padding-left: 26px; border-left: 1px solid var(--line); text-align: right; }
.inbox-total strong,.inbox-total small { display: block; }
.inbox-total strong { font-size: 38px; line-height: 1; letter-spacing: -1.4px; font-variant-numeric: tabular-nums; }
.inbox-total small { margin-top: 7px; color: var(--muted); font-size: 10px; }
.inbox-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.inbox-toolbar-actions { display: flex; gap: 8px; }
.inbox-alert { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 11px; align-items: center; margin-bottom: 9px; padding: 12px 14px; border: 1px solid #e7c9c5; border-radius: 10px; background: #fff7f5; }
.inbox-alert > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: var(--surface); color: var(--coral); }
.inbox-alert > span svg { width: 17px; height: 17px; fill: currentColor; }
.inbox-alert strong,.inbox-alert p { display: block; }
.inbox-alert strong { font-size: 11.5px; }
.inbox-alert p { margin-top: 2px; color: var(--muted); font-size: 10px; }
.inbox-list { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.inbox-item { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 13px; padding: 18px 20px 19px; border-bottom: 1px solid var(--line); transition: background .18s ease, box-shadow .18s ease; }
.inbox-item:last-child { border-bottom: 0; }
.inbox-item.is-owned { background: #fbfcfc; }
.inbox-item.is-unread { background: #f6fcf9; box-shadow: inset 3px 0 0 var(--green); }
.inbox-item.is-replying { background: var(--surface); }
.inbox-avatar { position: relative; width: 42px; height: 42px; }
.inbox-avatar > img,.inbox-avatar > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: var(--bg); object-fit: cover; color: var(--ink-2); font-size: 10px; font-weight: 750; }
.inbox-avatar .channel-mark { position: absolute; right: -4px; bottom: -4px; border: 2px solid var(--surface); }
.inbox-content { min-width: 0; }
.inbox-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.inbox-meta > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.inbox-meta strong { font-size: 12.5px; }
.inbox-meta span { color: var(--muted); font-size: 9.5px; white-space: nowrap; }
.inbox-state { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; }
.inbox-state i { width: 6px; height: 6px; border-radius: 50%; background: #b5bac3; }
.inbox-state.unread { color: #147a5c; }
.inbox-state.unread i { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.inbox-state.sent { color: var(--green); }
.inbox-state.sent i { background: var(--green); }
.inbox-message { max-width: 720px; margin-top: 6px; color: var(--ink-2); font-size: 13px; line-height: 1.58; white-space: pre-wrap; overflow-wrap: anywhere; }
.inbox-post-context { display: grid; grid-template-columns: 30px minmax(0, 1fr) 24px; gap: 9px; align-items: center; max-width: 760px; margin-top: 11px; padding: 7px 9px; border-radius: 8px; background: var(--bg); }
.inbox-post-context > img,.inbox-post-context > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; background: var(--surface); object-fit: cover; color: var(--muted); }
.inbox-post-context > span svg { width: 14px; height: 14px; fill: currentColor; }
.inbox-post-context p { overflow: hidden; color: var(--muted); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.inbox-post-context a { display: grid; place-items: center; color: var(--muted); }
.inbox-post-context a:hover { color: var(--ink); }
.inbox-post-context a svg { width: 14px; height: 14px; }
.inbox-actions { display: flex; gap: 12px; margin-top: 11px; }
.inbox-action { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 10px; font-weight: 650; cursor: pointer; transition: color .18s ease; }
.inbox-action:hover,.inbox-action.primary { color: var(--green); }
.inbox-action:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 2px; }
.inbox-reply { display: grid; gap: 9px; max-width: 760px; margin-top: 12px; padding: 12px; border: 1px solid #dfe8e4; border-radius: 10px; background: #f8faf9; }
.inbox-reply-head,.inbox-reply-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.inbox-reply-head strong { font-size: 10.5px; }
.inbox-reply-head button { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 9.5px; cursor: pointer; }
.inbox-reply textarea { width: 100%; min-height: 78px; resize: vertical; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 11.5px; line-height: 1.5; transition: border-color .18s, box-shadow .18s; }
.inbox-reply textarea:focus { outline: none; border-color: #8ccbb5; box-shadow: 0 0 0 3px var(--green-soft); }
.inbox-reply-foot small { color: var(--muted); font-size: 9px; }
.inbox-reply .btn { min-width: 94px; min-height: 36px; }
.inbox-empty { padding: 54px 20px 58px; }
.inbox-empty .btn { margin-top: 14px; }
.inbox-skeleton { position: relative; display: grid; gap: 10px; padding: 24px; }
.inbox-skeleton i { display: block; width: min(720px, 88%); height: 14px; border-radius: 4px; background: #eceef1; animation: pulse 1.2s ease-in-out infinite alternate; }
.inbox-skeleton i:nth-child(2) { width: min(560px, 70%); }
.inbox-skeleton i:nth-child(3) { width: min(650px, 80%); }
.inbox-skeleton span { margin-top: 4px; color: var(--muted); font-size: 10px; }

.inbox-view-tabs { display: inline-flex; gap: 3px; margin: 4px 0 14px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.inbox-view-tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 650; font-size: 12px; cursor: pointer; }
.inbox-view-tabs button:hover { color: var(--ink); background: #f0f1f4; }
.inbox-view-tabs button.active { color: var(--blue); background: var(--blue-soft); }
.inbox-view-tabs button span { min-width: 17px; padding: 0 5px; border-radius: 99px; background: var(--blue); color: #fff; font-size: 9px; line-height: 17px; text-align: center; }
.threads-discovery-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 12px; padding: 24px 26px 27px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.threads-discovery-hero h2 { margin-top: 6px; font-size: clamp(24px, 3vw, 36px); line-height: 1.05; letter-spacing: -1px; }
.threads-discovery-hero p { max-width: 660px; margin-top: 9px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.threads-review-note { flex: none; padding: 7px 9px; border-radius: 7px; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-weight: 700; }
.threads-search-panel { margin-bottom: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.threads-search-fields { display: grid; grid-template-columns: minmax(240px, 1.5fr) repeat(2, minmax(132px, .65fr)) minmax(112px, .55fr) auto; gap: 9px; align-items: end; }
.threads-search-fields label { display: grid; gap: 5px; color: var(--muted); font-size: 9.5px; font-weight: 650; }
.threads-search-fields input,.threads-search-fields select { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 11.5px; }
.threads-search-fields input:focus,.threads-search-fields select:focus { outline: none; border-color: #8ccbb5; box-shadow: 0 0 0 3px var(--green-soft); }
.threads-search-fields .btn { height: 38px; white-space: nowrap; }
.threads-search-help { margin-top: 9px; color: var(--muted); font-size: 9.5px; }
.threads-search-help code { color: var(--ink-2); font-size: 9px; }
.threads-results-head { display: flex; align-items: center; justify-content: space-between; margin: 15px 2px 8px; }
.threads-results-head strong,.threads-results-head small { display: block; }
.threads-results-head strong { font-size: 12px; }
.threads-results-head small { margin-top: 2px; color: var(--muted); font-size: 9.5px; }
.thread-lead-list { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.thread-lead { padding: 17px 19px 18px; border-bottom: 1px solid var(--line); transition: background .18s ease; }
.thread-lead:last-child { border-bottom: 0; }
.thread-lead:hover,.thread-lead.is-replying { background: #fbfcfc; }
.thread-lead.is-replied { background: #f7fbf9; }
.thread-lead-head,.thread-lead-head > div { display: flex; align-items: center; gap: 8px; }
.thread-lead-head { justify-content: space-between; }
.thread-lead-head .channel-mark { width: 24px; height: 24px; }
.thread-lead-head strong { font-size: 12px; }
.thread-lead-head time { color: var(--muted); font-size: 9.5px; }
.thread-lead-state { padding: 2px 6px; border-radius: 5px; background: var(--green-soft); color: var(--green); font-size: 8.5px; font-weight: 700; }
.thread-lead > p { max-width: 780px; margin: 10px 0 0 32px; color: var(--ink-2); font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.thread-lead-actions { display: flex; gap: 14px; margin: 11px 0 0 32px; }
.thread-lead-actions a,.thread-lead-actions button { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 9.5px; font-weight: 650; text-decoration: none; cursor: pointer; }
.thread-lead-actions a:hover,.thread-lead-actions button:hover { color: var(--blue); }
.thread-lead-actions svg { width: 12px; height: 12px; }
.thread-lead-reply { display: grid; gap: 9px; max-width: 780px; margin: 13px 0 0 32px; padding: 12px; border: 1px solid #dfe8e4; border-radius: 10px; background: #f8faf9; }
.thread-lead-reply > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.thread-lead-reply strong { font-size: 10.5px; }
.thread-lead-reply span,.thread-lead-reply small { color: var(--muted); font-size: 9px; }
.thread-lead-reply textarea { width: 100%; min-height: 88px; resize: vertical; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 11.5px; line-height: 1.5; }
.thread-lead-reply textarea:focus { outline: none; border-color: #8ccbb5; box-shadow: 0 0 0 3px var(--green-soft); }
@keyframes pulse { to { opacity: .45; } }

/* Toast */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--ink); color: #fff; border-radius: 8px; padding: 10px 16px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(50, 51, 56, .25); animation: rise .2s ease; max-width: 320px;
}
.toast.ok { background: var(--green); }
.logout-copy { color: var(--muted); font-size: 13px; }
.logout-screen { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 24px; background: #f5f8f7; }
.logout-panel { width: min(390px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 20px 60px rgba(32, 35, 49, .12); text-align: center; }
.logout-panel .brand-mark { margin: 0 auto 22px; }
.logout-panel h2 { font-size: 22px; letter-spacing: -.4px; }
.logout-panel p { color: var(--muted); font-size: 13px; margin: 8px 0 22px; }
.logout-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

/* Tab bar mobile */
.tabbar { display: none; }

@media (max-width: 1080px) {
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .home-grid-main, .home-grid-secondary { grid-template-columns: 1fr; }
  .template-grid { grid-template-columns: repeat(2, 1fr); }
  .cols-3 { grid-template-columns: repeat(2, 1fr); }
  .cols-3-2, .cols-2-1 { grid-template-columns: 1fr; }
  .analysis-grid { grid-template-columns: 1fr; }
  .analysis-metric-strip { grid-template-columns: repeat(3, 1fr); }
  .analysis-metric-strip > div:nth-child(3) { border-right: 0; }
  .analysis-metric-strip > div:nth-child(n+4) { border-top: 1px solid var(--line); }
  .analysis-video-card { grid-template-columns: 64px minmax(180px, 1fr); }
  .analysis-video-metrics { grid-column: 2; }
  .channel-grid { grid-template-columns: 1fr; }
  .channel-copy { min-height: 0; }
}

@media (max-width: 900px) {
  .trends-hero { grid-template-columns: 1fr; align-items: start; }
  .trends-official-links { justify-content: flex-start; }
  .trends-grid { grid-template-columns: 1fr; }
  .asset-editor-layout { grid-template-columns: 1fr; }
  .asset-details-pane { min-height: 0; padding: 20px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .asset-carousel { height: min(52vh, 460px); }
}

@media (max-width: 760px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 0 14px 86px; }
  body.sidebar-collapsed .main { margin-left: 0; }
  .icon-btn.menu-btn { display: none; }
  .topbar { padding: 14px 0 12px; }
  .topbar h1 { font-size: 18px; }
  .channels-hero { grid-template-columns: 1fr; padding: 21px 18px 23px; }
  .channels-summary { display: flex; align-items: baseline; gap: 8px; padding: 16px 0 0; border-top: 1px solid var(--line); border-left: 0; text-align: left; }
  .channels-summary strong { font-size: 30px; }
  .inbox-hero { grid-template-columns: 1fr; padding: 21px 18px 23px; }
  .inbox-total { display: flex; align-items: baseline; gap: 8px; padding: 16px 0 0; border-top: 1px solid var(--line); border-left: 0; text-align: left; }
  .inbox-total strong { font-size: 30px; }
  .inbox-toolbar { align-items: stretch; flex-direction: column; }
  .inbox-toolbar .workspace-range { overflow-x: auto; }
  .inbox-toolbar-actions { justify-content: flex-end; }
  .inbox-item { grid-template-columns: 36px minmax(0, 1fr); padding: 15px 13px 17px; }
  .inbox-avatar,.inbox-avatar > img,.inbox-avatar > span { width: 36px; height: 36px; }
  .inbox-meta { align-items: flex-start; flex-direction: column; gap: 2px; }
  .inbox-reply-foot { align-items: flex-end; }
  .inbox-alert { grid-template-columns: 30px minmax(0, 1fr); }
  .inbox-alert .btn { grid-column: 2; justify-self: start; }
  .threads-discovery-hero { align-items: flex-start; flex-direction: column; padding: 21px 18px 23px; }
  .threads-search-fields { grid-template-columns: 1fr 1fr; }
  .threads-keyword-field,.threads-search-fields .btn { grid-column: 1 / -1; }
  .thread-lead { padding: 15px 13px 17px; }
  .thread-lead > p,.thread-lead-actions,.thread-lead-reply { margin-left: 0; }
  .thread-lead-reply > div:last-child { align-items: flex-end; }
  .channel-card-head { grid-template-columns: 38px minmax(0, 1fr); }
  .channel-state { grid-column: 2; }
  .channel-actions { flex-wrap: wrap; }
  .channel-actions small { width: 100%; margin-left: 0; }
  .channel-picker { grid-template-columns: 1fr; }
  .library-head { flex-wrap: wrap; }
  .library-head .search-box { width: 100%; }
  .library-head .search-box input { flex: 1; width: auto; }
  .kanban-intro { align-items: flex-start; }
  .kanban-intro .btn { flex: none; }
  .home-intro { align-items: flex-start; flex-direction: column; }
  .home-intro h2 { font-size: 24px; }
  .home-actions { width: 100%; }
  .home-actions .btn { flex: 1; }
  .account-strip { align-items: flex-start; flex-wrap: wrap; }
  .connection-dot { margin-left: auto; }
  .connection-actions { width: 100%; padding-left: 49px; }
  .account-owner { width: 100%; padding-left: 49px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .kpi { min-height: 140px; padding: 16px; }
  .kpi-value { font-size: 25px; }
  .analysis-kpis .kpi { min-height: 108px; padding: 12px; }
  .analysis-kpis .kpi-note { display: none; }
  .analysis-history { padding: 15px 12px; }
  .analysis-history-head { flex-direction: column; }
  .analysis-chart-controls { width: 100%; justify-content: flex-start; }
  .analysis-segment:first-child { overflow-x: auto; }
  .analysis-metric-strip { grid-template-columns: repeat(2, 1fr); }
  .analysis-metric-strip > div { padding: 9px 8px; border-top: 1px solid var(--line); }
  .analysis-metric-strip > div:nth-child(-n+2) { border-top: 0; }
  .analysis-metric-strip > div:nth-child(2n) { border-right: 0; }
  .analysis-metric-strip > div:nth-child(3) { border-right: 1px solid var(--line); }
  .analysis-insight { align-items: flex-start; }
  .kanban-intro { align-items: flex-start; flex-direction: column; }
  .workspace-actions { width: 100%; }
  .workspace-actions .btn { flex: 1; }
  .workspace-range { width: 100%; }
  .workspace-range button { flex: 1; padding-inline: 5px; }
  .kanban-column { min-height: 500px; }
  .kanban-status { display: block; }
  .cal-toolbar { flex-wrap: wrap; }
  .cal-legend { width: 100%; order: 3; }
  .cal-title { min-width: 0; font-size: 15px; }
  .cal-cell { min-height: 76px; padding: 4px; }
  .cal-num { width: 22px; height: 22px; font-size: 11px; }
  .cal-event {
    font-size: 10px; padding: 3px 4px; white-space: normal;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  }
  .cal-more { font-size: 9.5px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .tab-item {
    border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--muted); font-size: 10px; font-weight: 600; padding: 6px 2px; border-radius: 8px; cursor: pointer;
  }
  .tab-item svg { width: 20px; height: 20px; }
  .tab-item.active { color: var(--blue); }
  .tab-badge { background: var(--blue); color: #fff; border-radius: 99px; font-size: 9px; font-weight: 800; padding: 0 5px; min-width: 15px; }
  .top-cta { font-size: 12px; padding: 8px 11px; }
  .cols-4, .cols-3, .cols-2, .template-grid { grid-template-columns: 1fr; }
  .tiktok-card { overflow-x: auto; }
  .tiktok-row { min-width: 720px; }
  .form-grid { grid-template-columns: 1fr; }
  .asset-carousel { height: 46vh; min-height: 280px; }
  .asset-carousel-slide img, .asset-carousel-slide video { width: calc(100% - 20px); height: calc(100% - 20px); inset: 10px; }
  .asset-details-pane #a-desc { min-height: 240px; }
  .script-field textarea { min-height: 320px; }
  .asset-sort-hint { text-align: center; }
  .analysis-hero { align-items: stretch; flex-direction: column; }
  .analysis-sync-actions { align-items: stretch; flex-direction: column; gap: 8px; }
  .analysis-auto-sync { justify-content: center; }
  .analysis-hero .btn { width: 100%; justify-content: center; padding: 8px 10px; font-size: 11px; }
  .analysis-profile > img, .analysis-profile > span { width: 40px; height: 40px; }
  .analysis-profile h2 { max-width: 250px; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
  .analysis-content-head { align-items: flex-start; flex-direction: column; }
  .analysis-content-tools, .analysis-content-tools .search-box { width: 100%; }
  .analysis-content-tools .search-box input { flex: 1; width: auto; }
  .analysis-video-card { grid-template-columns: 58px minmax(0, 1fr); padding: 9px; }
  .analysis-video-cover { width: 58px; height: 72px; }
  .analysis-video-metrics { grid-column: 1 / -1; grid-template-columns: repeat(5, 1fr); padding-top: 8px; border-top: 1px solid var(--line); }
  .analysis-video-metrics span { font-size: 8.5px; }
  .analysis-video-metrics b { font-size: 10.5px; }
  .campaign-detail-metrics { grid-template-columns: 1fr; }
  .campaign-detail-title { align-items: flex-start; flex-direction: column; gap: 3px; }
  .toast-wrap { right: 14px; bottom: 78px; left: 14px; }
  .toast { max-width: none; }
}

@media (hover: none) {
  .kanban-status { display: block; }
  .kanban-card { cursor: default; }
}
