:root {
  --tblr-primary: #2fb344;
  --tblr-primary-rgb: 47, 179, 68;
  --brand-ink: #1f2a24;
  --brand-muted: #6b7c72;
}

body {
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(47, 179, 68, 0.08), transparent 60%),
    radial-gradient(900px 360px at 100% 0%, rgba(32, 107, 196, 0.06), transparent 55%),
    #f6f8f7;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-link:hover {
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  height: 40px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand-logo-lg {
  height: 56px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand-ink);
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--brand-muted);
  font-weight: 500;
}

.card-title {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.card-title-icon,
.stat-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.5rem;
  flex-shrink: 0;
}

.stat-card-icon {
  width: 2.1rem;
  height: 2.1rem;
  margin-bottom: 0.4rem;
}

.icon-svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
  stroke: currentColor;
}

.stat-card-icon .icon-svg {
  width: 1.2rem;
  height: 1.2rem;
}

.btn .icon-svg {
  width: 1rem;
  height: 1rem;
  display: inline-block;
  vertical-align: -0.15em;
  margin-right: 0.25rem;
}

.page-title .icon-svg {
  width: 1.35rem;
  height: 1.35rem;
  display: inline-block;
  vertical-align: -0.2em;
  margin-right: 0.35rem;
}

.media-dropzone {
  border: 2px dashed #c8d0d8;
  border-radius: 8px;
  padding: 1.25rem 1rem;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  outline: none;
}

.media-dropzone:hover,
.media-dropzone:focus {
  border-color: var(--tblr-primary);
  background: #f0faf2;
}

.media-dropzone.is-dragover {
  border-color: var(--tblr-primary);
  background: #e6f7ea;
  box-shadow: inset 0 0 0 2px rgba(47, 179, 68, 0.15);
}

.media-dropzone-label {
  pointer-events: none;
}

.media-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.media-item {
  position: relative;
  width: 112px;
  border: 1px solid #e6e7e9;
  border-radius: 6px;
  overflow: hidden;
  cursor: grab;
  background: #fff;
}

.media-item .media-locale {
  font-size: 11px;
  padding: 2px 4px;
  border: 0;
  border-top: 1px solid #e6e7e9;
  border-radius: 0;
  cursor: pointer;
}

.media-item img {
  width: 100%;
  height: 72px;
  object-fit: cover;
  display: block;
}

.media-item .media-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  padding: 0 4px;
  line-height: 1.2;
}

.media-item .media-name {
  font-size: 10px;
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-preview {
  border: 1px solid #e6e7e9;
  border-radius: 8px;
  padding: 12px 12px 0;
  background: #fff;
  overflow: hidden;
}

.fb-preview-header {
  padding-bottom: 4px;
}

.fb-preview-body {
  white-space: pre-wrap;
  margin: 8px 0 12px;
  font-size: 14px;
  line-height: 1.4;
}

.fb-preview-media {
  display: grid;
  gap: 2px;
  margin: 0 -12px;
  background: #f0f2f5;
}

.fb-preview-media.count-0 {
  display: none;
}

.fb-preview-media-cell {
  position: relative;
  min-height: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.fb-preview-media-cell img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  background: #000;
}

/* 1 image — full width, whole photo visible */
.fb-preview-media.count-1 {
  grid-template-columns: 1fr;
}

.fb-preview-media.count-1 .fb-preview-media-cell img {
  max-height: 480px;
}

/* 2 images — side by side, contain */
.fb-preview-media.count-2 {
  grid-template-columns: 1fr 1fr;
}

.fb-preview-media.count-2 .fb-preview-media-cell {
  aspect-ratio: 1 / 1;
}

.fb-preview-media.count-2 .fb-preview-media-cell img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

/* 3 images — one large + two stacked */
.fb-preview-media.count-3 {
  grid-template-columns: 1.4fr 1fr;
  grid-template-rows: 1fr 1fr;
  min-height: 280px;
}

.fb-preview-media.count-3 .fb-preview-media-cell:first-child {
  grid-row: 1 / span 2;
}

.fb-preview-media.count-3 .fb-preview-media-cell img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  position: absolute;
  inset: 0;
}

.fb-preview-media.count-3 .fb-preview-media-cell {
  position: relative;
  min-height: 140px;
}

/* 4+ — 2-column mosaic, full photo in each cell */
.fb-preview-media.count-many {
  grid-template-columns: 1fr 1fr;
}

.fb-preview-media.count-many .fb-preview-media-cell {
  aspect-ratio: 4 / 3;
}

.fb-preview-media.count-many .fb-preview-media-cell img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  position: absolute;
  inset: 0;
}

.fb-preview-media.count-many .fb-preview-media-cell {
  position: relative;
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.cal-nav-title {
  font-weight: 700;
  text-align: center;
  flex: 1;
  text-transform: capitalize;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-size: 12px;
}
.cal-weekdays {
  font-size: 11px;
}
.cal-cell {
  min-height: 36px;
  border-radius: 4px;
  padding: 4px;
  background: #f1f5f9;
  text-align: center;
}
.cal-day {
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  color: inherit;
  font: inherit;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.cal-day:hover {
  border-color: rgba(47, 179, 68, 0.35);
  background: rgba(47, 179, 68, 0.08);
}
.cal-day.outside {
  opacity: 0.45;
  background: #f8faf9;
}
.cal-day.is-today {
  box-shadow: inset 0 0 0 1.5px rgba(47, 179, 68, 0.55);
}
.cal-day.is-selected {
  border-color: var(--tblr-primary);
  box-shadow: 0 0 0 2px rgba(47, 179, 68, 0.2);
}
.cal-day-num {
  line-height: 1.1;
  font-weight: 600;
}
.cal-day-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2fb344;
}
.cal-day.has-failed .cal-day-dot { background: #d63939; }
.cal-day.has-published .cal-day-dot { background: #2b8a3e; }
.cal-cell.has-scheduled { background: #d3f3d8; }
.cal-cell.has-published { background: #c8e6c9; }
.cal-cell.has-failed { background: #ffe0e0; }
.cal-cell.muted { opacity: 0.4; }
.cal-day-detail {
  border-top: 1px solid rgba(31, 42, 36, 0.08);
  padding-top: 0.75rem;
}
.cal-day-posts .list-group-item {
  border-left: 0;
  border-right: 0;
}

.stat-progress {
  height: 6px;
  border-radius: 3px;
  background: #e9ecef;
  overflow: hidden;
}

#stats-row > [class*="col"] {
  display: flex;
}

#stats-row .stats-card {
  width: 100%;
  display: flex;
  flex-direction: column;
}

#stats-row .stats-card .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#stats-row .stats-card-footer {
  margin-top: auto;
  min-height: 2.25rem;
}

.list-group-item-post {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.list-group-item-post .post-main {
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.list-group-item-post .post-main:hover {
  color: inherit;
}

.list-group-item-post .btn-delete-post {
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.card.is-ai-busy {
  border-color: rgba(47, 179, 68, 0.35);
}

.card.is-ai-busy .card-header {
  background: rgba(47, 179, 68, 0.06);
  border-left: 3px solid var(--tblr-primary);
}

.ai-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tblr-primary);
  white-space: nowrap;
}

.ai-status-chip .spinner-border {
  width: 0.85rem;
  height: 0.85rem;
  border-width: 0.12em;
}

.publishing-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tblr-primary);
  white-space: nowrap;
}

.publishing-chip .spinner-border {
  width: 0.85rem;
  height: 0.85rem;
  border-width: 0.12em;
}

.btn .spinner-border {
  width: 0.9rem;
  height: 0.9rem;
  border-width: 0.12em;
  vertical-align: -0.1em;
}

.slot-grid-wrap {
  overflow: auto;
  max-height: 28rem;
  border: 1px solid #e6e7e9;
  border-radius: 0.5rem;
  background: #fff;
}

.slot-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.75rem;
}

.slot-grid th,
.slot-grid td {
  padding: 0.15rem;
  text-align: center;
  vertical-align: middle;
}

.slot-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8faf9;
  font-weight: 600;
  color: var(--brand-muted);
  border-bottom: 1px solid #e6e7e9;
  padding: 0.45rem 0.25rem;
}

.slot-grid .slot-hour-label {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  text-align: right;
  padding-right: 0.5rem;
  color: var(--brand-muted);
  font-weight: 500;
  white-space: nowrap;
  min-width: 3.25rem;
}

.slot-grid thead .slot-hour-label {
  z-index: 3;
  background: #f8faf9;
}

.slot-cell {
  width: 2rem;
  height: 1.65rem;
  margin: 0 auto;
  display: block;
  border: 1px solid #dde3df;
  border-radius: 0.35rem;
  background: #f6f8f7;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.slot-cell:hover {
  border-color: var(--tblr-primary);
  background: rgba(47, 179, 68, 0.08);
}

.slot-cell.is-active {
  background: var(--tblr-primary);
  border-color: var(--tblr-primary);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.slot-cell.is-active::after {
  content: '';
  display: block;
  width: 0.4rem;
  height: 0.4rem;
  margin: 0 auto;
  border-radius: 50%;
  background: #fff;
}

.form-range-ticks {
  display: flex;
  justify-content: space-between;
  padding: 0 0.15rem;
  margin-top: -0.15rem;
}


/* Campaign creator */
.campaign-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.5rem;
}
.campaign-media-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 0.4rem;
  overflow: hidden;
  background: #eef1ef;
  border: 1px solid rgba(31, 42, 36, 0.08);
}
.campaign-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.campaign-media-del {
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
  line-height: 1;
  padding: 0.05rem 0.3rem;
  z-index: 2;
}
.campaign-assign-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 0.35rem;
  flex-shrink: 0;
}
.campaign-assign-matrix {
  margin-bottom: 0;
  width: max-content;
  min-width: 100%;
}
.campaign-assign-matrix th,
.campaign-assign-matrix td {
  vertical-align: middle;
  padding: 0.45rem 0.4rem;
}
.campaign-assign-corner {
  min-width: 10rem;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 3;
}
.campaign-assign-row-label {
  min-width: 10rem;
  max-width: 14rem;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
  font-weight: 600;
}
.campaign-assign-col {
  text-align: center;
  min-width: 5.5rem;
  max-width: 6.5rem;
}
.campaign-assign-col-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.campaign-assign-thumb-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 0.4rem;
  overflow: hidden;
  background: #eef1ef;
  border: 1px solid rgba(31, 42, 36, 0.08);
}
.campaign-assign-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.campaign-assign-col-name {
  font-size: 0.65rem;
  color: var(--brand-muted);
  max-width: 5.5rem;
}
.campaign-assign-cell {
  text-align: center;
}
.campaign-assign-toggle {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.45rem;
  border: 1.5px solid rgba(31, 42, 36, 0.18);
  background: #f6f8f7;
  color: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.campaign-assign-toggle:hover:not(:disabled) {
  border-color: var(--tblr-primary);
  background: rgba(47, 179, 68, 0.12);
}
.campaign-assign-toggle.is-on {
  background: var(--tblr-primary);
  border-color: var(--tblr-primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(47, 179, 68, 0.25);
}
.campaign-assign-toggle.is-on:hover:not(:disabled) {
  background: #26963a;
  border-color: #218a34;
  color: #fff;
}
.campaign-assign-toggle:disabled {
  opacity: 0.7;
  cursor: default;
}
.campaign-assign-check {
  display: inline-flex;
  line-height: 0;
}
.campaign-assign-check .icon-svg {
  width: 1rem;
  height: 1rem;
  stroke: #fff;
}
.list-group-item-action.active {
  background: rgba(47, 179, 68, 0.1);
  color: inherit;
  border-color: rgba(47, 179, 68, 0.25);
}
