/* =====================================================================
   SocialPost - application theme
   Blue + white SaaS dashboard, layered on top of Bootstrap 5.
   Palette mirrors app/config/brand.php.
   ===================================================================== */

:root {
  --sp-primary: #1769D2;
  --sp-primary-dark: #1257B0;
  --sp-primary-light: #E8F1FD;
  --sp-dark: #172B4D;
  --sp-white: #FFFFFF;
  --sp-light-blue: #F0F6FF;
  --sp-muted: #64748B;
  --sp-border: #E2E8F0;
  --sp-success: #16A34A;
  --sp-success-bg: #E8F7EE;
  --sp-danger: #DC2626;
  --sp-danger-bg: #FDECEC;
  --sp-warning: #D97706;
  --sp-warning-bg: #FEF3E2;
  --sp-info-bg: #E8F1FD;

  --sp-radius: 12px;
  --sp-radius-sm: 8px;
  --sp-radius-lg: 18px;
  --sp-shadow: 0 1px 2px rgba(23, 43, 77, .06), 0 4px 16px rgba(23, 43, 77, .05);
  --sp-shadow-lg: 0 8px 32px rgba(23, 43, 77, .12);
  --sp-sidebar-width: 256px;
  --sp-header-height: 68px;

  --bs-body-font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* ------------------------------------------------------------------ base */

* { -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--bs-body-font-family);
  background: var(--sp-light-blue);
  color: var(--sp-dark);
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; color: var(--sp-dark); letter-spacing: -0.015em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }

a { color: var(--sp-primary); text-decoration: none; }
a:hover { color: var(--sp-primary-dark); text-decoration: underline; }

.text-muted-soft { color: var(--sp-muted) !important; }
.fw-600 { font-weight: 600; }

::selection { background: #CFE2FB; }

/* scrollbars inside panels */
.sp-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.sp-scroll::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 8px; }
.sp-scroll::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------- app shell */

.sp-shell { min-height: 100vh; }

.sp-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sp-sidebar-width);
  background: var(--sp-white);
  border-right: 1px solid var(--sp-border);
  display: flex;
  flex-direction: column;
  z-index: 1045;
  transition: transform .25s ease;
}

.sp-sidebar__brand {
  height: var(--sp-header-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--sp-border);
  flex-shrink: 0;
}
.sp-sidebar__brand img { height: 34px; width: auto; }

.sp-sidebar__nav {
  padding: 16px 12px;
  overflow-y: auto;
  flex: 1;
}

.sp-nav-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--sp-muted);
  font-weight: 700;
  padding: 14px 12px 6px;
}

.sp-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: var(--sp-radius-sm);
  color: #41526E;
  font-weight: 500;
  font-size: .94rem;
  transition: background .15s, color .15s;
}
.sp-nav-link:hover { background: var(--sp-light-blue); color: var(--sp-primary); text-decoration: none; }
.sp-nav-link.active { background: var(--sp-primary); color: #fff; font-weight: 600; }
.sp-nav-link.active:hover { background: var(--sp-primary-dark); color: #fff; }
.sp-nav-link svg { width: 19px; height: 19px; flex-shrink: 0; }
.sp-nav-link .sp-nav-badge {
  margin-left: auto;
  background: var(--sp-danger-bg);
  color: var(--sp-danger);
  font-size: .72rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
}
.sp-nav-link.active .sp-nav-badge { background: rgba(255,255,255,.22); color: #fff; }

.sp-sidebar__footer {
  border-top: 1px solid var(--sp-border);
  padding: 14px;
  font-size: .78rem;
  color: var(--sp-muted);
  flex-shrink: 0;
}

/* main column */
.sp-main {
  margin-left: var(--sp-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sp-header {
  height: var(--sp-header-height);
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--sp-border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.sp-header__title { font-size: 1.12rem; font-weight: 700; margin: 0; line-height: 1.2; }
.sp-header__subtitle { font-size: .82rem; color: var(--sp-muted); margin: 0; }

.sp-burger {
  display: none;
  border: 1px solid var(--sp-border);
  background: #fff;
  border-radius: var(--sp-radius-sm);
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  color: var(--sp-dark);
}

.sp-content { padding: 26px 24px 48px; flex: 1; }

.sp-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--sp-primary);
  color: #fff;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  object-fit: cover;
  flex-shrink: 0;
}
.sp-avatar--sm { width: 28px; height: 28px; font-size: .72rem; }
.sp-avatar--lg { width: 56px; height: 56px; font-size: 1.1rem; }

.sp-overlay {
  position: fixed; inset: 0;
  background: rgba(23,43,77,.45);
  z-index: 1040;
  display: none;
}
.sp-overlay.show { display: block; }

/* ----------------------------------------------------------- components */

.sp-card {
  background: var(--sp-white);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  box-shadow: var(--sp-shadow);
}
.sp-card__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--sp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sp-card__header h2, .sp-card__header h3 { margin: 0; font-size: 1rem; }
.sp-card__body { padding: 20px; }
.sp-card__footer { padding: 14px 20px; border-top: 1px solid var(--sp-border); background: #FBFDFF; border-radius: 0 0 var(--sp-radius) var(--sp-radius); }

/* stat tiles */
.sp-stat {
  background: var(--sp-white);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  padding: 18px;
  box-shadow: var(--sp-shadow);
  height: 100%;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.sp-stat__icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--sp-primary-light);
  color: var(--sp-primary);
  flex-shrink: 0;
}
.sp-stat__icon svg { width: 21px; height: 21px; }
.sp-stat__icon--success { background: var(--sp-success-bg); color: var(--sp-success); }
.sp-stat__icon--danger  { background: var(--sp-danger-bg); color: var(--sp-danger); }
.sp-stat__icon--warning { background: var(--sp-warning-bg); color: var(--sp-warning); }
.sp-stat__value { font-size: 1.65rem; font-weight: 700; line-height: 1.1; color: var(--sp-dark); }
.sp-stat__label { font-size: .82rem; color: var(--sp-muted); font-weight: 500; }

/* buttons */
.btn { border-radius: var(--sp-radius-sm); font-weight: 600; font-size: .92rem; padding: .55rem 1.1rem; }
.btn-primary {
  background: var(--sp-primary);
  border-color: var(--sp-primary);
  box-shadow: 0 1px 2px rgba(23,105,210,.25);
}
.btn-primary:hover, .btn-primary:focus { background: var(--sp-primary-dark); border-color: var(--sp-primary-dark); }
.btn-outline-primary { color: var(--sp-primary); border-color: #BFD6F4; }
.btn-outline-primary:hover { background: var(--sp-primary); border-color: var(--sp-primary); }
.btn-light-blue { background: var(--sp-primary-light); color: var(--sp-primary); border: 1px solid transparent; }
.btn-light-blue:hover { background: #D7E7FB; color: var(--sp-primary-dark); }
.btn-soft { background: #F1F5F9; color: #41526E; border: 1px solid transparent; }
.btn-soft:hover { background: #E2E8F0; color: var(--sp-dark); }
.btn-sm { font-size: .82rem; padding: .35rem .75rem; }
.btn svg { width: 16px; height: 16px; vertical-align: -3px; }

/* forms */
.form-label { font-weight: 600; font-size: .86rem; color: #334155; margin-bottom: .35rem; }
.form-control, .form-select {
  border-radius: var(--sp-radius-sm);
  border-color: var(--sp-border);
  padding: .6rem .8rem;
  font-size: .93rem;
  color: var(--sp-dark);
}
.form-control:focus, .form-select:focus {
  border-color: var(--sp-primary);
  box-shadow: 0 0 0 3px rgba(23,105,210,.14);
}
.form-select {
  padding-right: 2.3rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .8rem center;
  background-size: 15px 15px;
}
.form-control::placeholder { color: #94A3B8; }
.form-text { font-size: .78rem; color: var(--sp-muted); }
textarea.form-control { line-height: 1.6; }

.sp-input-group { position: relative; }
.sp-input-group .sp-input-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: #94A3B8; pointer-events: none;
}
.sp-input-group .sp-input-icon + .form-control { padding-left: 40px; }

/* badges */
.sp-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .74rem; font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.sp-badge--success { background: var(--sp-success-bg); color: var(--sp-success); }
.sp-badge--danger  { background: var(--sp-danger-bg); color: var(--sp-danger); }
.sp-badge--warning { background: var(--sp-warning-bg); color: var(--sp-warning); }
.sp-badge--info    { background: var(--sp-info-bg); color: var(--sp-primary); }
.sp-badge--primary { background: var(--sp-primary); color: #FFFFFF; }
.sp-badge--muted   { background: #F1F5F9; color: var(--sp-muted); }
.sp-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* empty states */
.sp-empty { text-align: center; padding: 44px 20px; }
.sp-empty__icon {
  width: 68px; height: 68px;
  margin: 0 auto 16px;
  border-radius: 20px;
  background: var(--sp-light-blue);
  display: flex; align-items: center; justify-content: center;
  color: var(--sp-primary);
}
.sp-empty__icon svg { width: 30px; height: 30px; }
.sp-empty h3 { font-size: 1.02rem; margin-bottom: 6px; }
.sp-empty p { color: var(--sp-muted); font-size: .9rem; max-width: 420px; margin: 0 auto 18px; }

/* loading */
.sp-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sp-spin .7s linear infinite;
  vertical-align: -3px;
}
.sp-spinner--dark { border-color: rgba(23,105,210,.25); border-top-color: var(--sp-primary); }
@keyframes sp-spin { to { transform: rotate(360deg); } }

.sp-skeleton {
  background: linear-gradient(90deg, #EEF2F7 25%, #F8FAFC 37%, #EEF2F7 63%);
  background-size: 400% 100%;
  animation: sp-shimmer 1.3s ease infinite;
  border-radius: var(--sp-radius-sm);
}
@keyframes sp-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.sp-loading-overlay {
  position: fixed; inset: 0;
  background: rgba(240,246,255,.82);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 14px;
  z-index: 2000;
}
.sp-loading-overlay img { height: 44px; animation: sp-pulse 1.6s ease-in-out infinite; }
@keyframes sp-pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

/* toasts */
.sp-toasts {
  position: fixed; top: 18px; right: 18px;
  z-index: 2100;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(380px, calc(100vw - 36px));
}
.sp-toast {
  background: #fff;
  border: 1px solid var(--sp-border);
  border-left: 4px solid var(--sp-primary);
  border-radius: var(--sp-radius-sm);
  box-shadow: var(--sp-shadow-lg);
  padding: 12px 14px;
  display: flex; gap: 10px; align-items: flex-start;
  font-size: .89rem;
  animation: sp-slide-in .25s ease;
}
.sp-toast--success { border-left-color: var(--sp-success); }
.sp-toast--error   { border-left-color: var(--sp-danger); }
.sp-toast--warning { border-left-color: var(--sp-warning); }
.sp-toast__icon { flex-shrink: 0; margin-top: 1px; }
.sp-toast--success .sp-toast__icon { color: var(--sp-success); }
.sp-toast--error .sp-toast__icon { color: var(--sp-danger); }
.sp-toast--warning .sp-toast__icon { color: var(--sp-warning); }
.sp-toast--info .sp-toast__icon { color: var(--sp-primary); }
.sp-toast__close { background: none; border: 0; color: var(--sp-muted); padding: 0 2px; line-height: 1; margin-left: auto; }
@keyframes sp-slide-in { from { opacity: 0; transform: translateX(20px); } }

/* ------------------------------------------------------- platform chips */

.sp-platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
}

.sp-platform-chip {
  position: relative;
  border: 2px solid var(--sp-border);
  border-radius: var(--sp-radius);
  background: #fff;
  padding: 14px;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, box-shadow .15s, background .15s;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
}
.sp-platform-chip:hover { border-color: #BFD6F4; box-shadow: var(--sp-shadow); }
.sp-platform-chip.selected { border-color: var(--sp-primary); background: var(--sp-primary-light); }
.sp-platform-chip.disabled { opacity: .62; cursor: not-allowed; background: #FAFBFC; }
.sp-platform-chip__icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.sp-platform-chip__icon svg { width: 19px; height: 19px; }
.sp-platform-chip__name { font-weight: 600; font-size: .9rem; line-height: 1.2; }
.sp-platform-chip__meta { font-size: .74rem; color: var(--sp-muted); }
.sp-platform-chip__check {
  position: absolute; top: 9px; right: 9px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--sp-primary);
  color: #fff;
  display: none;
  align-items: center; justify-content: center;
}
.sp-platform-chip.selected .sp-platform-chip__check { display: flex; }
.sp-platform-chip__check svg { width: 11px; height: 11px; }

/* platform account cards (Connected Accounts page) */
.sp-account-card { height: 100%; display: flex; flex-direction: column; }
.sp-account-card__head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 18px 14px;
}
.sp-account-card__icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.sp-account-card__icon svg { width: 23px; height: 23px; }
.sp-account-list { border-top: 1px solid var(--sp-border); padding: 6px 0; flex: 1; }
.sp-account-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 18px;
}
.sp-account-row + .sp-account-row { border-top: 1px dashed var(--sp-border); }
.sp-account-row__name { font-weight: 600; font-size: .89rem; line-height: 1.25; }
.sp-account-row__meta { font-size: .76rem; color: var(--sp-muted); }

/* -------------------------------------------------------- create post UI */

.sp-composer { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
@media (max-width: 1200px) { .sp-composer { grid-template-columns: minmax(0, 1fr); } }

.sp-preview-sticky { position: sticky; top: calc(var(--sp-header-height) + 20px); }

/* editor tabs */
.sp-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--sp-border); padding: 0 6px; }
.sp-tab {
  border: 0; background: none;
  padding: 11px 14px;
  font-size: .88rem; font-weight: 600;
  color: var(--sp-muted);
  border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 7px;
  margin-bottom: -1px;
}
.sp-tab:hover { color: var(--sp-primary); }
.sp-tab.active { color: var(--sp-primary); border-bottom-color: var(--sp-primary); }
.sp-tab__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sp-tab__edited {
  font-size: .62rem; background: var(--sp-primary-light); color: var(--sp-primary);
  padding: 1px 6px; border-radius: 10px; font-weight: 700;
}

/* char counter */
.sp-counter { font-size: .76rem; color: var(--sp-muted); font-variant-numeric: tabular-nums; }
.sp-counter.warn { color: var(--sp-warning); font-weight: 600; }
.sp-counter.over { color: var(--sp-danger); font-weight: 700; }

/* caption toolbar: bold / italic / emoji above a caption textarea */
.sp-editor {
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-sm);
  background: var(--sp-white);
  transition: border-color .15s, box-shadow .15s;
}
.sp-editor:focus-within {
  border-color: var(--sp-primary);
  box-shadow: 0 0 0 3px rgba(23,105,210,.14);
}
.sp-editor .form-control {
  border: 0;
  border-radius: 0 0 var(--sp-radius-sm) var(--sp-radius-sm);
  background: transparent;
}
.sp-editor .form-control:focus { box-shadow: none; }

.sp-editor__bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 7px;
  border-bottom: 1px solid var(--sp-border);
}
.sp-editor__btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #41526E;
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.sp-editor__btn:hover { background: #F1F5F9; color: var(--sp-dark); }
.sp-editor__btn[aria-expanded="true"] { background: var(--sp-primary-light); color: var(--sp-primary); }
.sp-editor__b { font-weight: 800; }
.sp-editor__i { font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-weight: 600; }
.sp-editor__sep { width: 1px; height: 18px; margin: 0 5px; background: var(--sp-border); }

/* emoji picker */
.sp-emoji {
  position: absolute;
  top: calc(100% + 6px);
  left: 6px;
  z-index: 20;
  width: 318px;
  max-width: calc(100vw - 32px);
  padding: 8px;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  background: var(--sp-white);
  box-shadow: var(--sp-shadow-lg);
}
.sp-emoji[hidden] { display: none; }
.sp-emoji__tabs {
  display: flex;
  gap: 2px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--sp-border);
  overflow-x: auto;
}
.sp-emoji__tab {
  flex: 0 0 auto;
  width: 30px; height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.sp-emoji__tab:hover { background: #F1F5F9; }
.sp-emoji__tab.is-active { background: var(--sp-primary-light); }
.sp-emoji__search { padding: 7px 0 5px; }
.sp-emoji__grid { max-height: 232px; overflow-y: auto; }
.sp-emoji__heading {
  margin: 2px 0 4px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--sp-muted);
}
.sp-emoji__list { display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px; }
.sp-emoji__item {
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.sp-emoji__item:hover { background: var(--sp-primary-light); }
.sp-emoji__empty { margin: 14px 4px; font-size: .82rem; color: var(--sp-muted); }

/* dropzone */
.sp-dropzone {
  border: 2px dashed #C7D7EC;
  border-radius: var(--sp-radius);
  background: #FBFDFF;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.sp-dropzone:hover, .sp-dropzone.dragover { border-color: var(--sp-primary); background: var(--sp-primary-light); }
.sp-dropzone__icon { color: var(--sp-primary); margin-bottom: 8px; }
.sp-dropzone__icon svg { width: 30px; height: 30px; }

/* media thumbs in composer */
.sp-media-strip { display: flex; flex-wrap: wrap; gap: 10px; }
.sp-media-thumb {
  position: relative;
  width: 96px; height: 96px;
  border-radius: var(--sp-radius-sm);
  overflow: hidden;
  border: 1px solid var(--sp-border);
  background: #F1F5F9;
  flex-shrink: 0;
}
.sp-media-thumb img, .sp-media-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-media-thumb__remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(23,43,77,.78);
  color: #fff; border: 0;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.sp-media-thumb__remove svg { width: 11px; height: 11px; }
.sp-media-thumb__badge {
  position: absolute; bottom: 4px; left: 4px;
  background: rgba(23,43,77,.78); color: #fff;
  font-size: .62rem; font-weight: 600;
  padding: 1px 6px; border-radius: 4px;
}
.sp-media-thumb__progress {
  position: absolute; inset: auto 0 0 0;
  height: 3px; background: rgba(255,255,255,.4);
}
.sp-media-thumb__progress i { display: block; height: 100%; background: var(--sp-primary); width: 0; transition: width .2s; }

/* media library grid */
.sp-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 14px;
}
.sp-media-card {
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  overflow: hidden;
  background: #fff;
  transition: box-shadow .15s, border-color .15s;
  position: relative;
}
.sp-media-card:hover { box-shadow: var(--sp-shadow); border-color: #BFD6F4; }
.sp-media-card.selected { border-color: var(--sp-primary); box-shadow: 0 0 0 3px rgba(23,105,210,.14); }
.sp-media-card__preview {
  aspect-ratio: 1;
  background: #F1F5F9;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
}
.sp-media-card__preview img { width: 100%; height: 100%; object-fit: cover; }
.sp-media-card__preview .sp-video-mark {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(23,43,77,.3); color: #fff;
}
.sp-media-card__info { padding: 9px 11px; }
.sp-media-card__name {
  font-size: .78rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-media-card__meta { font-size: .7rem; color: var(--sp-muted); }
.sp-media-card__pick {
  position: absolute; top: 8px; left: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,.9);
  border: 2px solid var(--sp-border);
  display: flex; align-items: center; justify-content: center;
  color: transparent;
}
.sp-media-card.selected .sp-media-card__pick { background: var(--sp-primary); border-color: var(--sp-primary); color: #fff; }
.sp-media-card__pick svg { width: 12px; height: 12px; }

/* -------------------------------------------------------------- preview */

.sp-preview {
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  background: #fff;
  overflow: hidden;
}
.sp-preview__head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--sp-border);
}
.sp-preview__account { font-weight: 600; font-size: .86rem; line-height: 1.2; }
.sp-preview__handle { font-size: .74rem; color: var(--sp-muted); }
.sp-preview__body { padding: 13px 14px; }
.sp-preview__text { font-size: .88rem; white-space: pre-wrap; word-break: break-word; margin: 0; }
.sp-preview__media { background: #0F172A; }
.sp-preview__media img, .sp-preview__media video { width: 100%; display: block; max-height: 340px; object-fit: contain; }
.sp-preview__meta {
  padding: 9px 14px;
  border-top: 1px solid var(--sp-border);
  font-size: .74rem; color: var(--sp-muted);
  display: flex; justify-content: space-between; gap: 10px;
}

/* publish results */
.sp-result-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-sm);
  margin-bottom: 9px;
  background: #fff;
}
.sp-result-row--published { border-color: #BBE5CC; background: #F7FDF9; }
.sp-result-row--failed { border-color: #F5C6C6; background: #FFFAFA; }
.sp-result-row--needs_reconnect { border-color: #F3D9B0; background: #FFFCF6; }
.sp-result-row__icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.sp-result-row__msg { font-size: .8rem; color: var(--sp-muted); word-break: break-word; }

/* ---------------------------------------------------------- posts & list */

.sp-post-row {
  display: flex; gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--sp-border);
  transition: background .12s;
}
.sp-post-row:last-child { border-bottom: 0; }
.sp-post-row:hover { background: #FBFDFF; }
.sp-post-row__thumb {
  width: 76px; height: 76px;
  border-radius: var(--sp-radius-sm);
  background: var(--sp-light-blue);
  overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #A5BEDC;
}
.sp-post-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.sp-post-row__caption { font-size: .92rem; font-weight: 500; color: var(--sp-dark); margin-bottom: 5px; }

.sp-platform-dots { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.sp-platform-dot {
  width: 22px; height: 22px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
}
.sp-platform-dot svg { width: 12px; height: 12px; }

/* the accounts a post targets, as overlapping avatars */
.sp-account-stack { display: inline-flex; align-items: center; }
.sp-account-stack__item {
  position: relative;
  display: inline-flex;
  margin-right: -9px;
  transition: transform .12s;
}
.sp-account-stack__item:hover { transform: translateY(-2px); z-index: 3; }
.sp-account-stack__avatar {
  width: 30px; height: 30px;
  font-size: .72rem;
  border: 2px solid var(--sp-white);
  background: #CBD5E1;
  color: #41526E;
}
.sp-account-stack__badge {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid var(--sp-white);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
}
/* platform_icon() renders a Font Awesome <i>, so size it by font-size. */
.sp-account-stack__badge i { font-size: 7px; line-height: 1; }

/* an account that needs reconnecting, or one removed after the post was made */
.sp-account-stack__item.is-broken .sp-account-stack__avatar { border-color: var(--sp-warning); }
.sp-account-stack__item.is-missing .sp-account-stack__avatar { opacity: .5; }

.sp-account-stack__more {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px;
  margin-left: 12px;
  padding: 0 7px;
  border-radius: 20px;
  background: #F1F5F9;
  color: #41526E;
  font-size: .74rem; font-weight: 700;
}

.sp-filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.sp-filter-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .84rem; font-weight: 600;
  background: #fff;
  border: 1px solid var(--sp-border);
  color: var(--sp-muted);
}
.sp-filter-tab:hover { border-color: #BFD6F4; color: var(--sp-primary); text-decoration: none; }
.sp-filter-tab.active { background: var(--sp-primary); border-color: var(--sp-primary); color: #fff; }

/* tables */
.sp-table { width: 100%; font-size: .88rem; }
.sp-table th {
  text-align: left;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--sp-muted); font-weight: 700;
  padding: 11px 16px;
  background: #FBFDFF;
  border-bottom: 1px solid var(--sp-border);
  white-space: nowrap;
}
.sp-table td { padding: 13px 16px; border-bottom: 1px solid var(--sp-border); vertical-align: middle; }
.sp-table tr:last-child td { border-bottom: 0; }
.sp-table tbody tr:hover { background: #FBFDFF; }

/* ----------------------------------------------------------------- auth */
/* Sign in, register and password pages: one centred card, form on the left,
   brand panel with the connected-channels illustration on the right.       */

.sp-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background: #DCE2E9;
}

.sp-auth__card {
  width: 100%;
  max-width: 1080px;
  min-height: 648px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--sp-white);
  border-radius: 18px;
  box-shadow: 0 2px 6px rgba(23, 43, 77, .06), 0 28px 70px rgba(23, 43, 77, .18);
  overflow: hidden;
}

/* --- left: the form ------------------------------------------------- */

.sp-auth__main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 52px 48px;
}

.sp-auth__form { width: 100%; max-width: 342px; }

.sp-auth__logo { margin-bottom: 28px; }
.sp-auth__logo img { height: 38px; width: auto; }

.sp-auth__title { font-size: 1.62rem; letter-spacing: -0.02em; margin-bottom: 6px; }
.sp-auth__lead { font-size: .88rem; color: var(--sp-muted); margin-bottom: 26px; }

.sp-auth__divider {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--sp-muted);
  font-size: .76rem;
  margin: 22px 0;
}
.sp-auth__divider::before,
.sp-auth__divider::after { content: ''; flex: 1; height: 1px; background: var(--sp-border); }

/* Social sign-in button */
.sp-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--sp-border);
  background: #fff;
  border-radius: var(--sp-radius-sm);
  padding: .68rem 1rem;
  font-weight: 600;
  font-size: .9rem;
  color: #334155;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.sp-google-btn:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
  color: #1E293B;
  text-decoration: none;
  box-shadow: var(--sp-shadow);
}
.sp-google-btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* Fields: muted fill with a leading icon, like the reference */
.sp-field { position: relative; margin-bottom: 12px; }
.sp-field .form-control {
  background: #F7F9FC;
  border-color: #EDF1F6;
  padding: .72rem .8rem .72rem 42px;
}
.sp-field .form-control:focus { background: #fff; border-color: var(--sp-primary); }
.sp-field__icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #94A3B8;
  pointer-events: none;
  line-height: 0;
}
.sp-field__toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  color: #94A3B8;
  padding: 6px 8px;
  line-height: 0;
  border-radius: 6px;
}
.sp-field__toggle:hover { color: var(--sp-dark); background: #EEF2F7; }
/* Two glyphs live in the toggle; the "reveal" one is swapped in by script. */
.sp-field__toggle svg + svg { display: none; }

/* Same toggle on an ordinary dashboard field, keeping the default styling. */
.sp-field--plain { margin-bottom: 0; }
.sp-field--plain .form-control {
  background: #fff;
  border-color: var(--sp-border);
  padding: .6rem .8rem;
}
.sp-field--plain.sp-field--has-toggle .form-control { padding-right: 44px; }
.sp-field--has-toggle .form-control { padding-right: 44px; }

.sp-auth__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 20px;
  font-size: .82rem;
}

.sp-auth__submit { width: 100%; padding: .72rem 1rem; }

.sp-auth__foot {
  text-align: center;
  margin: 22px 0 0;
  font-size: .85rem;
  color: var(--sp-muted);
}

/* --- right: brand panel --------------------------------------------- */

.sp-auth__aside {
  background: linear-gradient(162deg, #2A7CE6 0%, var(--sp-primary) 46%, #0F4FA8 100%);
  color: #fff;
  padding: 44px 38px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Illustration: platform nodes -> SocialPost hub -> dashboard.
   Nodes are positioned in the same coordinate space as the SVG connectors
   (a 480 x 400 box), so the lines always meet them.                       */

.sp-art {
  position: relative;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  aspect-ratio: 480 / 400;
}

.sp-art__halo {
  position: absolute;
  left: 4%;
  top: 50%;
  transform: translateY(-50%);
  width: 76%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, .10);
}
.sp-art__halo::after {
  content: '';
  position: absolute;
  inset: 15%;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}

.sp-art__lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.sp-art__node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 13%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(8, 35, 75, .28);
  font-size: clamp(14px, 2.1vw, 21px);
}
.sp-art__node--hub {
  width: 16.5%;
  background: #fff;
  box-shadow: 0 0 0 7px rgba(255, 255, 255, .20), 0 12px 28px rgba(8, 35, 75, .32);
}
.sp-art__node--hub img { width: 62%; height: auto; display: block; border-radius: 7px; }

.sp-art__dash {
  position: absolute;
  left: 57%;
  top: 50%;
  transform: translateY(-50%);
  width: 42%;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 16px 38px rgba(8, 35, 75, .3);
  overflow: hidden;
}
.sp-art__dash-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 9px;
  border-bottom: 1px solid #EEF2F7;
}
.sp-art__dot { width: 6px; height: 6px; border-radius: 50%; }
.sp-art__dash-body { padding: 9px; display: grid; gap: 6px; }
.sp-art__bar { height: 7px; border-radius: 4px; background: #E4EAF2; }
.sp-art__row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px;
  border-radius: 7px;
  background: #F6F9FD;
}
.sp-art__avatar { width: 17px; height: 17px; border-radius: 50%; flex-shrink: 0; }

/* --- rotating message carousel -------------------------------------- */

.sp-slides {
  position: relative;
  text-align: center;
  margin-top: 34px;
  min-height: 92px;
}
.sp-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .4s ease, transform .4s ease, visibility .4s;
}
.sp-slide.active { opacity: 1; visibility: visible; transform: none; }
.sp-slide h2 { color: #fff; font-size: 1.28rem; margin-bottom: 8px; letter-spacing: -0.015em; }
.sp-slide p { color: rgba(255, 255, 255, .84); font-size: .88rem; margin: 0 auto; max-width: 350px; }

.sp-dots { display: flex; gap: 7px; justify-content: center; margin-top: 16px; }
.sp-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .4);
  transition: width .25s, background .25s, border-radius .25s;
}
.sp-dot:hover { background: rgba(255, 255, 255, .65); }
.sp-dot.active { background: #fff; width: 20px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  .sp-slide { transition: none; }
}

/* ------------------------------------------------------------ utilities */

/* Composer: the "publish later" block in the action card. */
.sp-schedule {
  border: 1px solid var(--sp-border);
  border-radius: calc(var(--sp-radius) - 4px);
  background: var(--sp-light-blue);
  padding: 12px 14px 14px;
}
.sp-schedule .form-label { font-size: .82rem; margin-bottom: 6px; }
.sp-schedule .form-text { font-size: .74rem; margin-top: 4px; }
.sp-schedule--active { border-color: var(--sp-primary); }

/* ------------------------------------------------- public pages ---
   The signed-out home page and the legal documents. Deliberately plain:
   these are read, and read by reviewers, not operated. */
.sp-public { background: #FFFFFF; }
.sp-public__inner { width: 100%; max-width: 940px; margin: 0 auto; padding: 0 20px; }
.sp-public__bar {
  border-bottom: 1px solid var(--sp-border);
  padding: 14px 0;
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(6px);
}
.sp-public__logo img { height: 34px; display: block; }
.sp-public__link {
  color: var(--sp-muted); font-weight: 500; font-size: .88rem;
  padding: 6px 8px; border-radius: 8px; text-decoration: none;
}
.sp-public__link:hover { color: var(--sp-primary); background: var(--sp-light-blue); }
.sp-public__link.active { color: var(--sp-primary); }
.sp-public__main { padding-top: 34px; padding-bottom: 56px; }
.sp-public__foot {
  border-top: 1px solid var(--sp-border);
  padding: 20px 0;
  font-size: .8rem; color: var(--sp-muted);
}

.sp-hero { text-align: center; padding: 26px 0 40px; }
.sp-hero h1 { font-size: 2.4rem; font-weight: 700; color: var(--sp-dark); margin-bottom: 10px; }
.sp-hero__lead {
  font-size: 1.05rem; color: var(--sp-muted);
  max-width: 620px; margin: 0 auto 22px;
}
.sp-hero__chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; margin-top: 30px;
}
.sp-hero__chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--sp-border); border-radius: 20px;
  padding: 5px 13px 5px 6px;
  font-size: .82rem; font-weight: 500; color: var(--sp-dark);
}
.sp-hero__chip-icon {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #FFFFFF;
}
.sp-hero__chip-icon svg { width: 12px; height: 12px; }

.sp-doc { max-width: 760px; color: #334155; line-height: 1.7; }
.sp-doc__title { font-size: 1.9rem; font-weight: 700; color: var(--sp-dark); margin-bottom: 4px; }
.sp-doc__meta { font-size: .82rem; color: var(--sp-muted); margin-bottom: 26px; }
.sp-doc h2 {
  font-size: 1.18rem; font-weight: 700; color: var(--sp-dark);
  margin: 34px 0 10px; padding-top: 14px;
  border-top: 1px solid var(--sp-border);
}
.sp-doc h3 { font-size: .98rem; font-weight: 600; color: var(--sp-dark); margin: 20px 0 8px; }
.sp-doc p, .sp-doc ul { margin-bottom: 14px; }
.sp-doc ul { padding-left: 22px; }
.sp-doc li { margin-bottom: 6px; }
.sp-doc a { color: var(--sp-primary); }
.sp-doc .sp-table { margin: 6px 0 18px; border: 1px solid var(--sp-border); border-radius: var(--sp-radius); }

.sp-auth__legal { margin-top: 22px; font-size: .78rem; color: var(--sp-muted); text-align: center; }
.sp-auth__legal a { color: var(--sp-muted); }
.sp-auth__legal a:hover { color: var(--sp-primary); }

@media (max-width: 575.98px) {
  .sp-hero h1 { font-size: 1.85rem; }
  .sp-public__logo img { height: 28px; }
}

.sp-divider { height: 1px; background: var(--sp-border); margin: 18px 0; }
.sp-link-muted { color: var(--sp-muted); font-weight: 500; }
.sp-link-muted:hover { color: var(--sp-primary); }
.sp-truncate-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.sp-code {
  background: #F1F5F9;
  border-radius: 5px;
  padding: 1px 6px;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: .82em;
  color: #334155;
}
.sp-alert {
  border-radius: var(--sp-radius-sm);
  padding: 12px 15px;
  font-size: .87rem;
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid transparent;
}
.sp-alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; }
.sp-alert--info { background: var(--sp-info-bg); border-color: #C7DEFA; color: #11447F; }
.sp-alert--warning { background: var(--sp-warning-bg); border-color: #F5DCB4; color: #8A4B06; }
.sp-alert--danger { background: var(--sp-danger-bg); border-color: #F6C9C9; color: #9B1C1C; }
.sp-alert--success { background: var(--sp-success-bg); border-color: #BFE7CE; color: #15663A; }

/* modal tweaks */
.modal-content { border: 0; border-radius: var(--sp-radius); box-shadow: var(--sp-shadow-lg); }
.modal-header { border-bottom-color: var(--sp-border); padding: 16px 20px; }
.modal-title { font-size: 1.02rem; }
.modal-body { padding: 20px; }
.modal-footer { border-top-color: var(--sp-border); padding: 14px 20px; }

/* dropdown */
.dropdown-menu {
  border-color: var(--sp-border);
  border-radius: var(--sp-radius);
  box-shadow: var(--sp-shadow-lg);
  padding: 6px;
  font-size: .9rem;
}
.dropdown-item { border-radius: var(--sp-radius-sm); padding: .5rem .7rem; font-weight: 500; }
.dropdown-item:hover { background: var(--sp-light-blue); color: var(--sp-primary); }
.dropdown-item svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 8px; opacity: .75; }
.dropdown-item.text-danger:hover { background: var(--sp-danger-bg); color: var(--sp-danger); }

/* ---------------------------------------------------------- responsive */

@media (max-width: 991.98px) {
  .sp-sidebar { transform: translateX(-100%); box-shadow: var(--sp-shadow-lg); }
  .sp-sidebar.open { transform: translateX(0); }
  .sp-main { margin-left: 0; }
  .sp-burger { display: flex; }
  .sp-content { padding: 20px 16px 40px; }
  .sp-header { padding: 0 16px; }
  .sp-auth { padding: 0; background: #fff; }
  .sp-auth__card {
    grid-template-columns: 1fr;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    max-width: none;
  }
  .sp-auth__aside { display: none; }
  .sp-auth__main { padding: 40px 24px; }
}

@media (max-width: 575.98px) {
  body { font-size: 14.5px; }
  .sp-header__subtitle { display: none; }
  .sp-platform-grid { grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); }
  .sp-media-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .sp-post-row { flex-direction: column; }
  .sp-post-row__thumb { width: 100%; height: 160px; }
  .sp-stat { padding: 14px; }
  .sp-stat__value { font-size: 1.4rem; }
  .sp-toasts { left: 12px; right: 12px; max-width: none; }
  .sp-auth__main { padding: 32px 18px; }
  .sp-auth__title { font-size: 1.42rem; }
}

@media print {
  .sp-sidebar, .sp-header, .sp-toasts { display: none !important; }
  .sp-main { margin-left: 0; }
}
