/* =============================================================
   Old Mutual PF Carousel — Admin console
   ============================================================= */

body.admin {
  background: var(--surface-2);
  min-height: 100vh;
}

.layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: linear-gradient(180deg, var(--om-green-900), var(--om-green-800));
  color: #dbe9e2;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 12px;
}
.sidebar__brand img {
  height: 38px;
  width: 38px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.sidebar__brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.sidebar__brand-text strong {
  color: #fff;
  font-size: 14px;
}
.sidebar__brand-text span {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
}
.sidebar__brand .brand__logo-fallback {
  color: #fff;
}
.sidebar__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.5);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  color: #cfe3d9;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item[hidden] {
  display: none !important;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.sidebar__footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.sidebar__view-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cfe3d9;
  text-decoration: none;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}
.sidebar__view-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ---------- Main ---------- */
.main {
  padding: 26px 30px 60px;
  width: 100%;
  min-width: 0;
}
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.topbar h1 {
  font-size: 24px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.topbar p {
  margin: 0;
  color: var(--ink-500);
  font-size: 14px;
}
.topbar__actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.panel {
  display: none;
}
.panel.is-active {
  display: block;
}

.dash-body {
  position: relative;
  min-height: 420px;
}
.dash-loader {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 4;
  align-items: flex-start;
  justify-content: center;
  padding-top: 72px;
  background: rgba(245, 248, 246, 0.78);
  backdrop-filter: blur(3px);
  border-radius: var(--radius);
}
.dash-loader.is-visible {
  display: flex;
}
.dash-loader__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  padding: 28px 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.dash-loader__card strong {
  font-size: 15px;
  color: var(--ink-900);
}
.dash-spinner {
  width: 36px;
  height: 36px;
  margin-bottom: 4px;
  border: 3px solid var(--om-green-100);
  border-top-color: var(--om-green-600);
  border-radius: 50%;
  animation: dash-spin 0.7s linear infinite;
}
@keyframes dash-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.stat__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-500);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}
.stat__top > span:first-child {
  flex: 1;
  min-width: 0;
}
.stat__icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--om-green-100);
  color: var(--om-green-700);
}
.stat__value {
  font-size: 30px;
  font-weight: 800;
  margin: 12px 0 2px;
  letter-spacing: -0.02em;
}
.stat__delta {
  font-size: 12.5px;
  color: var(--om-green-600);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

/* ---------- Cards / charts ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}
.card-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-box__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.card-box__head h3 {
  margin: 0;
  font-size: 16px;
}
.card-box__head .muted {
  color: var(--ink-500);
  font-size: 13px;
}

/* line chart */
.linechart {
  width: 100%;
  height: 220px;
}
.linechart .grid-line {
  stroke: var(--line);
  stroke-width: 1;
}
.linechart .axis-label {
  fill: var(--ink-300);
  font-size: 10px;
}
.linechart .area {
  fill: url(#areaGrad);
}
.linechart .line {
  fill: none;
  stroke: var(--om-green-600);
  stroke-width: 2.5;
}
.linechart .dot {
  fill: #fff;
  stroke: var(--om-green-600);
  stroke-width: 2;
}

/* bar list */
.barlist {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.barrow__top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.barrow__title {
  color: var(--ink-700);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 75%;
}
.barrow__val {
  color: var(--ink-500);
  font-weight: 700;
}
.bartrack {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.barfill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--om-green-500), var(--om-green-700));
  transition: width 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* table */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: left;
  color: var(--ink-500);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td {
  border-bottom: none;
}
.table__title {
  font-weight: 600;
  color: var(--ink-900);
}
.table__sub {
  color: var(--ink-500);
  font-size: 12px;
}
.rate-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--om-green-100);
  color: var(--om-green-700);
}

/* ---------- Sortable table headers ---------- */
.table th.is-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.12s ease;
}
.table th.is-sortable:hover {
  color: var(--om-green-700);
}
.table th.is-sortable::after {
  content: "\2195"; /* up-down arrow */
  margin-left: 6px;
  font-size: 11px;
  opacity: 0.35;
}
.table th.is-sorted-asc::after {
  content: "\2191";
  opacity: 1;
  color: var(--om-green-700);
}
.table th.is-sorted-desc::after {
  content: "\2193";
  opacity: 1;
  color: var(--om-green-700);
}

/* ---------- Table pager ---------- */
.table-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.table-pager__size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.table-pager__size select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--ink-900);
  background: var(--surface);
  cursor: pointer;
}
.table-pager__info {
  font-size: 13px;
  margin-left: auto;
}
.table-pager__nav {
  display: inline-flex;
  gap: 8px;
}
.table-pager__nav .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Content manager ---------- */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.article-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}
.article-card:hover {
  box-shadow: var(--shadow);
}
.article-card__media {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--om-green-700), var(--om-green-400));
  position: relative;
  overflow: hidden;
}
.article-card__media img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.media-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(20px) saturate(1.1) brightness(0.85);
  transform: scale(1.18);
}
.article-card__badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}
.status-pill--live {
  background: #e4f4ec;
  color: var(--om-green-700);
}
.status-pill--draft {
  background: #fbf1e2;
  color: var(--warn);
}
.article-card__body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.article-card__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}
.article-card__meta {
  color: var(--ink-500);
  font-size: 12.5px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.article-card__meta span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.article-card__foot {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  gap: 6px;
  align-items: center;
  border-top: 1px solid var(--line);
}
.article-card__foot .spacer {
  flex: 1;
}
.iconbtn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-700);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.iconbtn:hover {
  background: var(--surface-2);
  color: var(--om-green-700);
}
.iconbtn--danger:hover {
  background: #fbf1f0;
  color: var(--danger);
}
.iconbtn[disabled] {
  opacity: 0.35;
  cursor: default;
}

/* ---------- Editor modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 30px 16px;
  overflow-y: auto;
  background: rgba(6, 24, 18, 0.45);
  backdrop-filter: blur(3px);
}
.modal.is-open {
  display: flex;
}
.modal__panel {
  background: var(--surface);
  width: 100%;
  max-width: 900px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  margin: auto;
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal__head h2 {
  margin: 0;
  font-size: 18px;
}
.modal__head-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.switch--head .switch__state {
  font-weight: 700;
  font-size: 13px;
  min-width: 74px;
}
.switch--head .switch__state.is-draft {
  color: var(--warn);
}
.switch--head .switch__state.is-live {
  color: var(--om-green-700);
}
.modal__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.modal__form {
  padding: 20px 22px;
  border-right: 1px solid var(--line);
  max-height: 70vh;
  overflow-y: auto;
}
.modal__preview {
  padding: 20px 22px;
  background: var(--surface-2);
  max-height: 70vh;
  overflow-y: auto;
}
.modal__foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 6px;
}
.field .hint {
  font-weight: 400;
  color: var(--ink-300);
  font-size: 12px;
}
.field input[type="text"],
.field input[type="url"],
.field input[type="number"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink-900);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--om-green-400);
  box-shadow: 0 0 0 3px rgba(53, 169, 123, 0.18);
}

/* Category combobox (input + click-to-open list) */
.combo {
  position: relative;
}
.combo input[type="text"] {
  width: 100%;
  padding-right: 38px;
}
.combo__toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ink-500);
  cursor: pointer;
  border-radius: 0 10px 10px 0;
}
.combo__toggle:hover {
  color: var(--om-green-700);
}
.combo__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 42, 32, 0.16);
}
.combo__option {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink-900);
  cursor: pointer;
}
.combo__option:hover,
.combo__option.is-selected {
  background: var(--om-green-100);
  color: var(--om-green-700);
}
.combo__empty {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--ink-500);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-700);
}
.switch input {
  display: none;
}
.switch__track {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #cdd8d1;
  position: relative;
  transition: background 0.2s ease;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}
.switch input:checked + .switch__track {
  background: var(--om-green-500);
}
.switch input:checked + .switch__track::after {
  transform: translateX(18px);
}

/* link editor rows */
.link-row {
  display: grid;
  grid-template-columns: 80px 1fr 1.5fr auto;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}
/* URL / PDF / Video rows: type + label + delete on the first line, and the
   actual target (URL input, or upload button + file name) on a second
   full-width line so the row never scrolls horizontally. */
.link-row--url,
.link-row--pdf,
.link-row--video {
  grid-template-columns: 88px 1fr auto;
  grid-template-areas:
    "type label del"
    "file file file";
  row-gap: 8px;
  align-items: center;
}
/* Keep the label input from collapsing when the upload control is wide. */
.link-row input[type="text"],
.link-row input[type="url"] {
  min-width: 0;
}
.link-row--url > .link-type-select,
.link-row--pdf > .link-type-select,
.link-row--video > .link-type-select {
  grid-area: type;
}
.link-row--url > input[data-link-label],
.link-row--pdf > input[data-link-label],
.link-row--video > input[data-link-label] {
  grid-area: label;
}
.link-row--url > input[data-link-url],
.link-row--pdf > .link-file-input,
.link-row--video > .link-file-input {
  grid-area: file;
}
.link-row--url > [data-link-del],
.link-row--pdf > [data-link-del],
.link-row--video > [data-link-del] {
  grid-area: del;
}
.link-type-select {
  padding: 8px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-size: 13px;
  background: var(--surface);
}
.link-file-input {
  display: flex;
  align-items: center;
  gap: 6px 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.link-file-input .btn {
  white-space: nowrap;
}
.link-file-hint {
  font-size: 11px;
  color: var(--ink-500);
  line-height: 1;
}
.link-file-name {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--om-green-700, #033d2c);
  background: rgba(3, 61, 44, 0.08);
  padding: 4px 10px;
  border-radius: 4px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-file-name .icon {
  flex-shrink: 0;
}
@media (max-width: 700px) {
  /* All CTA rows keep the compact two-row layout (type + label + delete, then
     the target underneath) rather than stacking every control. */
  .link-row--url,
  .link-row--pdf,
  .link-row--video {
    grid-template-columns: 72px 1fr auto;
    grid-template-areas:
      "type label del"
      "file file file";
  }
  .link-row--url > *,
  .link-row--pdf > *,
  .link-row--video > * {
    width: auto;
  }
  .link-row--url > input[data-link-label],
  .link-row--pdf > input[data-link-label],
  .link-row--video > input[data-link-label] {
    width: 100%;
  }
}

/* live preview mini card */
.preview-note {
  font-size: 12px;
  color: var(--ink-500);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mini-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.mini-card__media {
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, var(--om-green-700), var(--om-green-400));
  position: relative;
  overflow: hidden;
}
.mini-card__media img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.mini-card__chip {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
}
.mini-card__body {
  padding: 16px 18px 18px;
}
.mini-card__body h3 {
  margin: 0 0 8px;
  font-size: 19px;
  line-height: 1.25;
}
.mini-card__meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--ink-500);
  font-size: 12px;
  margin-bottom: 10px;
}
.mini-card__meta span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.mini-card__preview {
  color: var(--ink-700);
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
}

/* body content preview (mirrors reader styling) */
.body-preview {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--ink-700);
  font-size: 14.5px;
  line-height: 1.65;
}
.body-preview:empty::before {
  content: "Article content will appear here as you type.";
  color: var(--ink-300);
  font-size: 13px;
}
.body-preview h2 {
  font-size: 19px;
  color: var(--om-green-700);
  margin: 4px 0 8px;
}
.body-preview h3 {
  font-size: 16px;
  color: var(--ink-900);
  margin: 16px 0 6px;
}
.body-preview p {
  margin: 0 0 10px;
}
.body-preview ul,
.body-preview ol {
  margin: 0 0 12px;
  padding-left: 20px;
}
.body-preview li {
  margin-bottom: 6px;
}
.body-preview a {
  color: var(--om-green-600);
  text-decoration: underline;
}
.body-preview blockquote {
  margin: 12px 0;
  padding: 8px 14px;
  border-left: 4px solid var(--om-green-500);
  background: var(--om-green-100);
  border-radius: 0 10px 10px 0;
  color: var(--om-green-900);
  font-style: italic;
}
.body-preview img {
  max-width: 100%;
  border-radius: 10px;
  margin: 6px 0;
}

.empty-block {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-500);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
}
.empty-block .icon {
  width: 40px;
  height: 40px;
  color: var(--om-green-400);
  margin-bottom: 10px;
}

/* toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink-900);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 100;
}
.toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast .icon {
  color: var(--om-green-300);
}
.toast.is-error .icon {
  color: #f5b7b1;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 960px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .modal__grid {
    grid-template-columns: 1fr;
  }
  .modal__form {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}
@media (max-width: 720px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }
  .sidebar__brand {
    border: none;
    margin: 0;
    padding: 0 8px;
    flex: 1;
  }
  .sidebar__label {
    display: none;
  }
  .nav-item {
    width: auto;
  }
  .sidebar__footer {
    border: none;
    margin: 0;
    padding: 0;
  }
  .main {
    padding: 20px 16px 50px;
  }
}

/* =============================================================
   Image uploader
   ============================================================= */
.uploader {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.uploader__preview {
  width: 120px;
  height: 78px;
  border-radius: 10px;
  background: var(--surface-3);
  border: 1px dashed var(--line);
  flex: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-300);
}
.uploader__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.uploader__controls {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.uploader__or {
  font-size: 12px;
  color: var(--ink-300);
  margin-top: 2px;
}

/* =============================================================
   Rich text editor
   ============================================================= */
.rte {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.rte__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.rte__btn {
  border: none;
  background: transparent;
  color: var(--ink-700);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.12s ease, color 0.12s ease;
}
.rte__btn:hover {
  background: var(--surface-3);
  color: var(--om-green-700);
}
.rte__btn.is-active {
  background: var(--om-green-100);
  color: var(--om-green-700);
}
.rte__sep {
  width: 1px;
  align-self: stretch;
  background: var(--line);
  margin: 4px 3px;
}
.rte__color {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.12s ease;
}
.rte__color:hover {
  background: var(--surface-3);
}
.rte__color-a {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-700);
  pointer-events: none;
  line-height: 1;
  border-bottom: 3px solid currentColor;
  padding-bottom: 1px;
}
.rte__color-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: none;
  padding: 0;
  cursor: pointer;
}
.rte__editor {
  padding: 14px 16px;
  min-height: 200px;
  max-height: 340px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-800, var(--ink-700));
  outline: none;
}
.rte__editor:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-300);
}
.rte__editor:focus {
  box-shadow: inset 0 0 0 2px rgba(53, 169, 123, 0.25);
}
.rte__editor h2 {
  font-size: 20px;
  margin: 6px 0 8px;
  color: var(--om-green-700);
}
.rte__editor h3 {
  font-size: 17px;
  margin: 14px 0 6px;
  color: var(--ink-900);
}
.rte__editor p {
  margin: 0 0 10px;
}
.rte__editor ul,
.rte__editor ol {
  margin: 0 0 12px;
  padding-left: 22px;
}
.rte__editor li {
  margin-bottom: 6px;
}
.rte__editor a {
  color: var(--om-green-600);
  text-decoration: underline;
}
.rte__editor blockquote {
  margin: 12px 0;
  padding: 8px 14px;
  border-left: 4px solid var(--om-green-500);
  background: var(--om-green-100);
  border-radius: 0 10px 10px 0;
  color: var(--om-green-900);
}
.rte__editor img {
  max-width: 100%;
  border-radius: 10px;
  margin: 6px 0;
}

/* link popover */
.link-popover {
  position: fixed;
  z-index: 80;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 10px;
  display: none;
  flex-direction: column;
  gap: 8px;
}
.link-popover.is-open {
  display: flex;
}
.link-popover input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
}
.link-popover input:focus {
  outline: none;
  border-color: var(--om-green-400);
}
.link-popover__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* =============================================================
   Drag & drop reordering
   ============================================================= */
.drag-handle {
  cursor: grab;
  color: var(--ink-300);
}
.drag-handle:active {
  cursor: grabbing;
}
.article-card.is-dragging {
  opacity: 0.4;
}
.article-card.drop-before {
  box-shadow: -4px 0 0 0 var(--om-green-500), var(--shadow);
}
.article-card.drop-after {
  box-shadow: 4px 0 0 0 var(--om-green-500), var(--shadow);
}
.order-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--om-green-100);
  color: var(--om-green-700);
  font-size: 12px;
  font-weight: 800;
}

/* =============================================================
   Advisor views manager
   ============================================================= */
.dash-view-select {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin-right: 4px;
}
.dash-view-select select,
.dash-field input[type="date"] {
  min-width: 160px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0 10px;
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-900);
}
.dash-field {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}
.dash-field .muted,
.dash-view-select .muted {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.dash-field input[type="date"] {
  min-width: 150px;
}
#btn-export-excel {
  height: 36px;
}
.views-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  align-items: start;
}
.views-list-box {
  position: sticky;
  top: 16px;
}
#views-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.view-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  text-align: left;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.view-item.is-active {
  border-color: var(--om-green-400);
  background: #eef8f2;
}
.view-item__title {
  font-weight: 700;
  font-size: 14px;
  grid-column: 1;
}
.view-item__meta {
  font-size: 12px;
  color: var(--ink-500);
  grid-column: 1;
}
.view-item__actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  display: flex;
  gap: 4px;
}
.views-list-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.view-item__copy,
.view-item__archive,
.view-item__del {
  color: var(--ink-500);
  padding: 4px;
  border-radius: 8px;
  cursor: pointer;
}
.view-item__copy:hover,
.view-item__archive:hover {
  color: var(--om-green-700);
  background: #e6f4ea;
}
.view-item__del:hover {
  color: #b42318;
  background: #fee4e2;
}
.title-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.title-row input {
  flex: 1 1 auto;
  min-width: 0;
}
.title-row .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}
.share-row input {
  flex: 1 1 180px;
  min-width: 0;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
}
.field-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ink-500);
  line-height: 1.45;
}
#banner-uploader {
  flex-direction: column;
  gap: 10px;
}
#banner-uploader .uploader__controls {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}
#banner-preview {
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #007749;
  margin-bottom: 0;
  /* Match WhatsApp / viewer bulletin strip (default header is 375×95) */
  aspect-ratio: 375 / 95;
}
#banner-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

@media (max-width: 960px) {
  .views-layout {
    grid-template-columns: 1fr;
  }
  .views-list-box {
    position: static;
  }
}

/* =============================================================
   WhatsApp Teaser Studio
   ============================================================= */
.wa-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  align-items: start;
}
.wa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  align-items: center;
}
.wa-note {
  font-size: 12.5px;
  color: var(--ink-500);
  margin: 12px 0 0;
  line-height: 1.5;
}
.wa-stage {
  position: sticky;
  top: 20px;
}
.wa-preview {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #033d2c;
  box-shadow: var(--shadow);
}
.wa-preview canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #033d2c;
}
.wa-count {
  font-size: 13.5px;
  color: var(--ink-500);
  line-height: 1.5;
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--line);
}
.wa-section {
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.wa-section__title {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.wa-section__title--opp {
  color: #6f9e2e;
}
.wa-section__title--need {
  color: #e07a2f;
}
.wa-upload {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.wa-upload__thumb {
  width: 88px;
  height: 66px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: var(--surface-3) center/cover no-repeat;
  color: var(--ink-300);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  overflow: hidden;
}
.wa-upload__thumb.has-image {
  border-style: solid;
  color: transparent;
}
.wa-upload__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.wa-upload__actions label.btn {
  cursor: pointer;
  margin: 0;
}
#panel-whatsapp .field + .field {
  margin-top: 12px;
}
#panel-whatsapp textarea {
  resize: vertical;
  min-height: 72px;
}

.modal__panel--narrow {
  max-width: 440px;
}
.modal__panel--narrow .modal__form {
  border-right: 0;
  max-height: none;
}
.modal__actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.confirm-modal__body {
  padding: 24px 22px;
  text-align: center;
}
.confirm-modal__icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 119, 73, 0.1);
  color: var(--om-green-700);
}
.confirm-modal__icon.is-warn {
  background: rgba(180, 83, 9, 0.1);
  color: var(--warn, #b45309);
}
.confirm-modal__icon .icon {
  width: 24px;
  height: 24px;
}
.confirm-modal__message {
  margin: 0 0 24px;
  color: var(--ink-600, #3d4f48);
  line-height: 1.55;
  font-size: 14px;
  text-align: left;
}
.confirm-modal__actions {
  justify-content: flex-end;
}
.role-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}
.role-checks .check,
.field .check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  margin: 0;
}
.users-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.badge--ok {
  background: rgba(3, 61, 44, 0.1);
  color: var(--om-green-700, #033d2c);
}
.badge--warn {
  background: rgba(180, 120, 20, 0.12);
  color: var(--warn, #9a6b00);
}

@media (max-width: 960px) {
  .wa-layout {
    grid-template-columns: 1fr;
  }
  .wa-stage {
    position: static;
  }
}
