:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f1f4f6;
  --line: #d9dee5;
  --text: #17202a;
  --muted: #647182;
  --muted-2: #8b96a6;
  --accent: #1b6f70;
  --accent-soft: #dff1ef;
  --blue: #315c99;
  --pink: #b24a74;
  --lime: #7a8b24;
  --orange: #b4652a;
  --red: #b33a3a;
  --shadow: 0 10px 30px rgba(24, 34, 48, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 18px 14px;
  background: #18222b;
  color: #f8fbfc;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #dfe8e3;
  color: #17202a;
  font-weight: 800;
}

.brand-title {
  font-weight: 750;
}

.brand-subtitle,
.sidebar-label {
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 4px;
  margin: 18px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

.source-panel {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.sidebar-settings {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-item {
  margin-bottom: 10px;
}

.sidebar-settings + .source-panel {
  margin-top: 0;
}

.source-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.source-row strong {
  color: #ffffff;
  font-weight: 650;
}

.main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 15px;
  line-height: 1.35;
}

h3 {
  font-size: 13px;
  line-height: 1.35;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.api-notice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  margin: -6px 0 14px;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 650;
}

.api-notice.loading {
  background: #e8eef7;
  color: var(--blue);
}

.api-notice.fallback {
  background: #fbecd8;
  color: #74410d;
}

.api-notice.live {
  background: #dff1ef;
  color: #126164;
}

.api-notice span {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(49, 92, 153, 0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
}

select,
input,
textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 7px 9px;
}

.top-actions select {
  width: auto;
  min-width: 132px;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 34px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 7px 12px;
  font-weight: 650;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.secondary-button {
  background: #ffffff;
  border-color: var(--line);
  color: var(--text);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  padding: 0;
  background: #ffffff;
  border-color: var(--line);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kpi,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi {
  display: grid;
  gap: 6px;
  min-height: 108px;
  padding: 13px;
}

.kpi span,
.kpi small,
.panel-heading p,
.rank-main small,
.data-table small,
.field span,
.note-field span,
.detail-list span,
.metric span,
.drawer-header p {
  color: var(--muted);
}

.kpi strong {
  font-size: 24px;
  line-height: 1.1;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 14px;
}

.overview-grid .wide {
  grid-column: span 2;
}

.panel {
  min-width: 0;
  padding: 14px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.legend,
.row-meta,
.row-title,
.tag-list,
.drawer-actions,
.segmented {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.legend {
  color: var(--muted);
  font-size: 12px;
}

.legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-radius: 2px;
}

.legend-x,
.bar-x {
  background: var(--blue);
}

.legend-ig,
.bar-ig {
  background: var(--pink);
}

.legend-tt,
.bar-tt {
  background: var(--lime);
}

.chart {
  display: grid;
  grid-template-columns: repeat(8, minmax(42px, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 220px;
  padding-top: 8px;
}

.chart-compact {
  min-height: 230px;
}

.chart-large {
  min-height: 340px;
}

.empty-chart {
  display: grid;
  place-items: center;
  min-height: 240px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
}

.chart-day {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  height: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.chart-day small {
  font-size: 11px;
}

.chart-day.active small,
.chart-day:hover small {
  color: var(--text);
  font-weight: 700;
}

.bar {
  align-self: end;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  width: 100%;
  min-height: 8px;
  border-radius: 5px 5px 2px 2px;
  background: var(--surface-soft);
}

.bar i {
  display: block;
  width: 100%;
}

.chart-day.highlight .bar {
  outline: 2px solid rgba(180, 101, 42, 0.22);
  outline-offset: 2px;
}

.chart-day.active .bar {
  box-shadow: 0 0 0 3px rgba(27, 111, 112, 0.18);
}

.split-list,
.rank-list,
.day-stack,
.evidence-list,
.product-posts {
  display: grid;
  gap: 8px;
}

.split-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
}

.meter {
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-soft);
}

.meter span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.rank-row,
.day-post,
.evidence-post {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
  padding: 9px;
}

.rank-row:hover,
.day-post:hover,
.evidence-post:hover {
  border-color: #b9c3ce;
}

.rank-row.static {
  cursor: default;
}

.rank-number {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.rank-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.rank-main strong,
.post-cell strong,
.product-name strong,
.evidence-post strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-value {
  margin-left: auto;
  font-weight: 750;
}

.platform-chip,
.status,
.type-pill,
.source-badge,
.decision,
.tag-list span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.platform-x {
  background: #e8eef7;
  color: var(--blue);
}

.platform-instagram {
  background: #f7e8ef;
  color: var(--pink);
}

.platform-tiktok {
  background: #edf1d9;
  color: #65751d;
}

.status-synced {
  background: #dff1ef;
  color: #126164;
}

.status-partial,
.status-stale {
  background: #fbecd8;
  color: var(--orange);
}

.status-manual {
  background: #e9eef5;
  color: var(--blue);
}

.status-queued {
  background: #edf1d9;
  color: #65751d;
}

.status-failed {
  background: #f7dddd;
  color: var(--red);
}

.type-pill.gifting {
  background: #e6f0ee;
  color: var(--accent);
}

.type-pill.organic {
  background: #f2eadf;
  color: #865126;
}

.source-badge,
.tag-list span {
  background: var(--surface-soft);
  color: var(--muted);
}

.insight-mini {
  display: grid;
  gap: 7px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.insight-mini:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.insight-mini p,
.insight-card p,
.drawer-section p {
  color: var(--muted);
  line-height: 1.55;
}

.decision {
  width: fit-content;
}

.decision.scale {
  background: #dff1ef;
  color: #126164;
}

.decision.watch {
  background: #fbecd8;
  color: var(--orange);
}

.decision.learn {
  background: #e8eef7;
  color: var(--blue);
}

.decision.stop {
  background: #f7dddd;
  color: var(--red);
}

.daily-layout,
.posts-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: start;
}

.daily-main {
  min-width: 0;
}

.segmented {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.segmented button {
  min-height: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 5px 9px;
}

.segmented button.active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(24, 34, 48, 0.08);
}

.daily-table-wrap {
  margin-top: 16px;
}

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

.post-visual {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 800;
}

.post-visual.instagram,
.post-preview.instagram {
  background:
    linear-gradient(135deg, rgba(178, 74, 116, 0.92), rgba(27, 111, 112, 0.78)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.2) 0 8px, transparent 8px 16px);
}

.post-visual.tiktok,
.post-preview.tiktok {
  background:
    linear-gradient(135deg, rgba(122, 139, 36, 0.96), rgba(49, 92, 153, 0.75)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 7px, transparent 7px 14px);
}

.post-visual.x,
.post-preview.x {
  background:
    linear-gradient(135deg, rgba(49, 92, 153, 0.96), rgba(24, 34, 43, 0.82)),
    radial-gradient(circle at 65% 25%, rgba(255, 255, 255, 0.28), transparent 32%);
}

.day-post > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.day-post p {
  overflow: hidden;
  margin: 6px 0;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.posts-layout {
  grid-template-columns: 230px minmax(0, 1fr);
}

.filters {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

.field,
.note-field {
  display: grid;
  gap: 6px;
}

.field span,
.note-field span {
  font-size: 12px;
  font-weight: 650;
}

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.compact-table {
  min-width: 720px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.data-table tbody tr {
  background: #ffffff;
}

.data-table tbody tr:hover,
.data-table tbody tr.selected {
  background: #f7faf9;
}

.data-table tbody tr[data-post-id] {
  cursor: pointer;
}

.post-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 190px;
}

.post-cell div,
.product-name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.tag-list {
  gap: 5px;
}

.product-table td:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 230px;
}

.expand-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 800;
}

.product-detail-row td {
  background: #fafbfc;
  padding: 12px;
}

.product-posts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.insights-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.insight-card {
  display: grid;
  gap: 14px;
}

.insight-head {
  display: grid;
  gap: 9px;
}

.evidence-post {
  justify-content: flex-start;
}

.evidence-post span:last-child {
  margin-left: auto;
  color: var(--muted);
}

.note-field textarea {
  min-height: 76px;
  resize: vertical;
}

.integration-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.integration-intro {
  margin-bottom: 14px;
}

.integration-checkline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.integration-checkline span {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 650;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.brand-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.brand-summary-card {
  display: grid;
  gap: 13px;
}

.brand-health {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.brand-health div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 9px;
}

.brand-health span,
.brand-source-list span {
  color: var(--muted);
  font-size: 12px;
}

.brand-health strong {
  font-size: 18px;
}

.brand-source-list {
  display: grid;
  gap: 7px;
}

.brand-source-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 7px;
}

.brand-source-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.integration-card {
  display: grid;
  gap: 13px;
}

.integration-card p {
  color: var(--muted);
  line-height: 1.55;
}

.integration-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.integration-category {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.integration-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.integration-connected {
  background: #dff1ef;
  color: #126164;
}

.integration-not-connected {
  background: #e9eef5;
  color: var(--blue);
}

.integration-needs-action,
.integration-syncing,
.integration-setup-required {
  background: #fbecd8;
  color: var(--orange);
}

.integration-failed {
  background: #f7dddd;
  color: var(--red);
}

.integration-meta {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 10px;
}

.integration-meta span,
.sync-run span,
.sync-run small {
  color: var(--muted);
}

.integration-block {
  display: grid;
  gap: 8px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.setting-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 9px;
}

.setting-item.wide {
  grid-column: 1 / -1;
}

.setting-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.setting-item strong {
  overflow-wrap: anywhere;
}

.missing-value {
  color: var(--orange);
}

.requirement-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.requirement-list li {
  position: relative;
  padding-left: 18px;
  color: var(--text);
  font-size: 13px;
}

.requirement-list li::before {
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.requirement-list li.missing::before {
  background: var(--orange);
}

.missing-box,
.ready-box,
.mcp-note,
.complete-box {
  border-radius: 6px;
  padding: 10px;
  line-height: 1.5;
}

.missing-box.compact,
.ready-box.compact {
  grid-column: 1 / -1;
  padding: 8px 9px;
  font-size: 12px;
}

.missing-box,
.mcp-note {
  background: #fbecd8;
  color: #74410d;
}

.ready-box,
.complete-box {
  background: #dff1ef;
  color: #126164;
}

.sync-run {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.integration-actions {
  display: grid;
  grid-template-columns: 1.05fr 1fr 1fr;
  gap: 8px;
}

.action-box,
.real-sync-note,
.real-sync-confirm {
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.45;
}

.action-box.running {
  background: #fbecd8;
  color: #74410d;
}

.action-box.failed {
  background: #f7dddd;
  color: var(--red);
}

.action-box.success {
  background: #dff1ef;
  color: #126164;
}

.real-sync-note {
  background: #fbfcfd;
  color: var(--muted);
}

.real-sync-confirm {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(176, 67, 50, 0.28);
  background: #fff7f5;
  color: var(--red);
}

.danger-button {
  min-height: 36px;
  border: 1px solid #b04332;
  border-radius: 6px;
  background: #b04332;
  color: #ffffff;
  padding: 8px 12px;
  font-weight: 800;
}

.full-width-button {
  width: 100%;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 32, 0.28);
}

.wizard-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 50;
  width: min(820px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  overflow: auto;
  transform: translate(-50%, -50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(24, 34, 48, 0.22);
}

.wizard-header,
.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.wizard-header {
  border-bottom: 1px solid var(--line);
}

.wizard-footer {
  border-top: 1px solid var(--line);
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.wizard-steps button {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
  padding: 7px;
  font-size: 12px;
  font-weight: 700;
}

.wizard-steps button.active {
  border-color: rgba(27, 111, 112, 0.45);
  background: var(--accent-soft);
  color: var(--accent);
}

.wizard-steps span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: currentColor;
  color: #ffffff;
  font-size: 11px;
}

.wizard-body {
  display: grid;
  gap: 14px;
  min-height: 280px;
  padding: 16px;
}

.wizard-source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.wizard-source-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 11px;
  text-align: left;
}

.wizard-source-list button.selected {
  border-color: rgba(27, 111, 112, 0.45);
  background: #f7fbfa;
}

.wizard-columns,
.auth-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.auth-box {
  align-items: start;
}

.auth-box .field:last-child {
  grid-column: 1 / -1;
}

.self-serve-form .wide-field {
  grid-column: 1 / -1;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 7px 9px;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.check-grid input {
  accent-color: var(--accent);
}

.test-sync-box {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
}

.test-sync-box p {
  color: var(--muted);
  line-height: 1.5;
}

.test-spinner {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 4px solid #d7e8e6;
  border-top-color: var(--accent);
  border-radius: 50%;
}

.sync-preview {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.sync-preview span {
  color: var(--muted);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(15, 23, 32, 0.24);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(520px, 100vw);
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #ffffff;
  box-shadow: -16px 0 32px rgba(24, 34, 48, 0.12);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-header h2 {
  margin-top: 8px;
  font-size: 18px;
}

.post-preview {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 230px;
  margin: 18px;
  border-radius: 8px;
  color: #ffffff;
  padding: 18px;
}

.post-preview div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
}

.post-preview p {
  max-width: 38ch;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.55;
}

.drawer-actions,
.drawer-section {
  margin: 18px;
}

.drawer-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.drawer-section {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  display: grid;
  gap: 4px;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
}

.metric strong {
  font-size: 17px;
}

.detail-list {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 9px;
  align-items: center;
}

.drawer-tags {
  margin-top: 2px;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .content-grid,
  .insights-layout,
  .product-posts,
  .integration-grid,
  .brand-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .overview-grid .wide {
    grid-column: span 2;
  }

  .daily-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .source-panel {
    display: none;
  }

  .main {
    padding: 14px;
  }

  .topbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .top-actions select,
  .top-actions .primary-button {
    flex: 1 1 150px;
  }

  .kpi-grid,
  .integration-summary,
  .content-grid,
  .insights-layout,
  .posts-layout,
  .product-posts,
  .integration-grid,
  .brand-summary-grid,
  .settings-grid,
  .integration-checkline,
  .wizard-source-list,
  .wizard-columns,
  .auth-box {
    grid-template-columns: 1fr;
  }

  .wizard-steps {
    grid-template-columns: 1fr;
  }

  .integration-actions {
    grid-template-columns: 1fr;
  }

  .overview-grid .wide {
    grid-column: auto;
  }

  .chart {
    grid-template-columns: repeat(4, minmax(52px, 1fr));
    min-height: 260px;
  }

  .filters {
    position: static;
  }
}

@media (max-width: 560px) {
  .nav {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    gap: 8px;
  }

  .drawer-actions,
  .metric-grid,
  .integration-meta {
    grid-template-columns: 1fr 1fr;
  }

  .detail-list {
    grid-template-columns: 1fr;
  }

  .post-preview {
    min-height: 190px;
  }
}
