:root,
[data-theme="light"] {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --panel-hover: #f8fafc;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-sec: #475569;
  --muted: #94a3b8;
  --accent: #0284c7;
  --accent-h: #0369a1;
  --accent-l: #e0f2fe;
  --accent-t: #0284c7;
  --danger: #dc2626;
  --danger-l: #fef2f2;
  --danger-b: #fecaca;
  --ok: #16a34a;
  --ok-l: #f0fdf4;
  --ok-b: #bbf7d0;
  --warn: #d97706;
  --warn-l: #fffbeb;
  --warn-b: #fde68a;
  --sh-sm: 0 1px 3px rgba(0, 0, 0, .07), 0 1px 2px rgba(0, 0, 0, .05);
  --sh-md: 0 4px 12px rgba(0, 0, 0, .08), 0 2px 4px rgba(0, 0, 0, .06);
  --sh-lg: 0 10px 25px rgba(0, 0, 0, .1), 0 4px 10px rgba(0, 0, 0, .06);
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --ease: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --hh: 60px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-hover: #253248;
  --border: #334155;
  --border-light: #1e293b;
  --text: #f1f5f9;
  --text-sec: #94a3b8;
  --muted: #64748b;
  --accent: #38bdf8;
  --accent-h: #7dd3fc;
  --accent-l: rgba(56, 189, 248, .12);
  --accent-t: #38bdf8;
  --danger: #f87171;
  --danger-l: rgba(248, 113, 113, .1);
  --danger-b: rgba(248, 113, 113, .3);
  --ok: #4ade80;
  --ok-l: rgba(74, 222, 128, .1);
  --ok-b: rgba(74, 222, 128, .3);
  --warn: #fbbf24;
  --warn-l: rgba(251, 191, 36, .1);
  --warn-b: rgba(251, 191, 36, .3);
  --sh-sm: 0 1px 3px rgba(0, 0, 0, .3);
  --sh-md: 0 4px 12px rgba(0, 0, 0, .35);
  --sh-lg: 0 10px 25px rgba(0, 0, 0, .4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

/* ── HEADER ── */
.a-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--hh);
  padding: 0 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  gap: 1rem;
}

.a-header__left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.a-brand {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.a-brand span {
  color: var(--muted);
  font-weight: 500;
}

.a-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.a-nav__link {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.7rem;
  border-radius: var(--r-sm);
  color: var(--text-sec);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--ease), color var(--ease);
}

.a-nav__link:hover {
  background: var(--bg);
  color: var(--text);
}

.a-nav__link.active {
  background: var(--accent-l);
  color: var(--accent-t);
}

.a-header__right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.a-user-email {
  font-size: 0.78rem;
  color: var(--muted);
  display: none;
}

/* hamburger */
.a-burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  background: none;
  color: var(--text-sec);
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: background var(--ease), color var(--ease);
  flex-shrink: 0;
}

.a-burger:hover {
  background: var(--bg);
  color: var(--text);
}

/* theme toggle */
.a-theme {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-sec);
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: all var(--ease);
}

.a-theme:hover {
  background: var(--bg);
  color: var(--text);
}

[data-theme="dark"] .t-sun {
  display: block;
}

[data-theme="dark"] .t-moon {
  display: none;
}

[data-theme="light"] .t-sun {
  display: none;
}

[data-theme="light"] .t-moon {
  display: block;
}

/* ── MOBILE NAV OVERLAY ── */
.mob-nav {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
}

.mob-nav.open {
  display: block;
}

.mob-nav__bd {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(2px);
}

.mob-nav__panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 272px;
  background: var(--panel);
  box-shadow: var(--sh-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mob-nav.open .mob-nav__panel {
  transform: translateX(0);
}

.mob-nav__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.mob-nav__close {
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  color: var(--text-sec);
  cursor: pointer;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease);
}

.mob-nav__close:hover {
  background: var(--bg);
}

.mob-nav__links {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mob-nav__link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--r-sm);
  color: var(--text-sec);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--ease), color var(--ease);
}

.mob-nav__link:hover {
  background: var(--bg);
  color: var(--text);
}

.mob-nav__link.active {
  background: var(--accent-l);
  color: var(--accent-t);
}

.mob-nav__footer {
  margin-top: auto;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.mob-nav__email {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

/* ── MAIN ── */
main.admin {
  max-width: 1140px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── FLASH ── */
.flash-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.flash {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-radius: var(--r-md);
  border-left: 4px solid;
  box-shadow: var(--sh-sm);
  animation: slideDown 0.22s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.flash.notice {
  background: var(--ok-l);
  border-color: var(--ok);
  color: var(--ok);
}

.flash.alert {
  background: var(--danger-l);
  border-color: var(--danger);
  color: var(--danger);
}

.flash__msg {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
}

.flash__x {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--ease);
}

.flash__x:hover {
  opacity: 1;
}

/* ── PAGE HEADER ── */
.page-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.page-hd h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-hd__sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

/* breadcrumb */
.crumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 1.1rem;
}

.crumb a {
  color: var(--accent-t);
  text-decoration: none;
}

.crumb a:hover {
  text-decoration: underline;
}

.crumb__sep {
  color: var(--border);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.95rem;
  border-radius: var(--r-sm);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--ease);
  line-height: 1.4;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px) !important;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
}

.btn-primary:hover {
  background: var(--accent-h);
  box-shadow: var(--sh-sm);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
  border-color: var(--text-sec);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.28rem 0.6rem;
  font-size: 0.78rem;
}

/* ── CARD ── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.card-body {
  padding: 1.25rem;
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  box-shadow: var(--sh-sm);
  transition: box-shadow var(--ease), transform var(--ease);
}

.stat-card:hover {
  box-shadow: var(--sh-md);
  transform: translateY(-2px);
}

.stat-card__icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.stat-card__n {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 0.2rem;
}

.stat-card__l {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}

/* ── TABLE ── */
.tbl-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.tbl-wrap {
  overflow-x: auto;
}

table.a-tbl {
  width: 100%;
  border-collapse: collapse;
}

.a-tbl th {
  padding: 0.6rem 1rem;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.a-tbl td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
  vertical-align: middle;
}

.a-tbl tbody tr:last-child td {
  border-bottom: none;
}

.a-tbl tbody tr {
  transition: background var(--ease);
}

.a-tbl tbody tr:hover {
  background: var(--panel-hover);
}

.a-tbl .td-actions {
  display: flex;
  gap: 0.3rem;
  justify-content: flex-end;
}

/* mobile cards (shown only on mobile) */
.mob-list {
  display: none;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.75rem;
}

.mob-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.9rem;
}

.mob-card__hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.mob-card__title {
  font-weight: 600;
  font-size: 0.88rem;
}

.mob-card__meta {
  font-size: 0.78rem;
  color: var(--text-sec);
  margin-bottom: 0.65rem;
}

.mob-card__actions {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-green {
  background: var(--ok-l);
  color: var(--ok);
}

.badge-red {
  background: var(--danger-l);
  color: var(--danger);
}

.badge-blue {
  background: var(--accent-l);
  color: var(--accent-t);
}

.badge-gray {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge-gold {
  background: #fffbeb;
  color: #92400e;
}

.badge-silver {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid var(--border);
}

.badge-bronze {
  background: #fff7ed;
  color: #92400e;
}

/* ── FORMS ── */
.a-form {
  max-width: 700px;
}

.a-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.25rem;
}

.a-form__grid .f-full {
  grid-column: 1 / -1;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.field input[type=text],
.field input[type=url],
.field input[type=number],
.field input[type=email],
.field input[type=password],
.field input[type=datetime-local],
.field input[type=date],
.field input[type=color],
.field textarea,
.field select {
  width: 100%;
  padding: 0.58rem 0.85rem;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color var(--ease), box-shadow var(--ease);
  appearance: none;
  -webkit-appearance: none;
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2394a3b8' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-l);
  background: var(--panel);
}

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

.field input[type=file] {
  padding: 0.38rem 0.85rem;
  cursor: pointer;
  font-size: 0.86rem;
}

.field input[type=color] {
  height: 42px;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
}

.field .hint {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 0.28rem;
}

.a-form__fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem 1.2rem;
  display: grid;
  gap: 1rem;
}

.a-form__fieldset legend {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 0.4rem;
}

.char-count {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.char-count--over {
  color: var(--warn);
  font-weight: 600;
}

.a-form__checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
}

.field-cb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding-top: 0.25rem;
}

.field-cb input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.field-cb span {
  font-size: 0.875rem;
  font-weight: 500;
}

.form-errors {
  background: var(--danger-l);
  border: 1.5px solid var(--danger-b);
  border-radius: var(--r-md);
  padding: 0.8rem 1rem;
  margin-bottom: 1.25rem;
  color: var(--danger);
  font-size: 0.875rem;
}

.form-errors strong {
  display: block;
  margin-bottom: 0.35rem;
}

.form-errors ul {
  margin: 0 0 0 1rem;
  padding: 0;
}

.form-errors li {
  margin-bottom: 0.18rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.img-preview {
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.img-preview img {
  height: 72px;
  width: 72px;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

/* rich text */
trix-toolbar {
  border: 1.5px solid var(--border);
  border-bottom: none;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  padding: 0.25rem 0.5rem;
  background: var(--bg);
}

trix-editor {
  border: 1.5px solid var(--border) !important;
  border-radius: 0 0 var(--r-sm) var(--r-sm) !important;
  background: var(--panel) !important;
  color: var(--text) !important;
  min-height: 600px !important;
  font-size: 0.95rem !important;
  line-height: 1.7 !important;
  padding: 0.875rem 1rem !important;
  resize: vertical !important;
  overflow: auto !important;
}

trix-editor:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-l);
}

.trix-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* ── EMPTY STATE ── */
.empty {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--muted);
}

.empty p {
  margin: 0.4rem 0 1.25rem;
  font-size: 0.88rem;
}

/* ── TOAST ── */
#toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 340px;
  width: calc(100vw - 2.5rem);
}

/* ── RESPONSIVE ── */
@media (max-width: 767px) {
  .a-nav {
    display: none;
  }

  .a-burger {
    display: flex;
  }

  .a-user-email {
    display: none !important;
  }

  main.admin {
    padding: 1.25rem 1rem;
  }

  .a-tbl,
  .tbl-wrap>table {
    display: none;
  }

  .mob-list {
    display: flex;
  }

  .a-form__grid {
    grid-template-columns: 1fr;
  }

  .a-form {
    max-width: 100%;
  }

  .page-hd h1 {
    font-size: 1.2rem;
  }
}

@media (min-width: 768px) {
  .a-user-email {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── ANALYTICS SECTION ── */
.analytics-section {
  margin-bottom: 1.75rem;
  margin-top: 1.75rem;
}

.analytics-section__title {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.analytics-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.analytics-chart-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.analytics-chart-card__hd {
  padding: 0.85rem 1.25rem 0;
}

.analytics-chart-card__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.analytics-chart-card__body {
  padding: 0.75rem 1.25rem 1.25rem;
  position: relative;
  height: 260px;
}

.analytics-chart-card--donut .analytics-chart-card__body {
  height: 280px;
}

.analytics-top-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.analytics-top-card__hd {
  padding: 0.85rem 1.25rem 0.25rem;
}

.analytics-top-tbl td:first-child,
.analytics-top-tbl th:first-child {
  width: 2rem;
}

/* ── ANUNCIO SUMMARY ROW ── */
.anuncio-summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.anuncio-summary-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.9rem 1.1rem;
  box-shadow: var(--sh-sm);
}

.anuncio-summary-card__val {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.anuncio-summary-card__lbl {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

@media (max-width: 767px) {
  .analytics-charts-row {
    grid-template-columns: 1fr;
  }

  .anuncio-summary-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── TABLE FILTERS ── */
.tbl-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.tbl-filters form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
}

.filter-select {
  padding: 0.33rem 1.75rem 0.33rem 0.65rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2394a3b8' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  transition: border-color var(--ease);
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── SORTABLE TABLE HEADERS ── */
.th-sort-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.th-sort-link:hover {
  color: var(--text);
}

.th-sorted {
  color: var(--text) !important;
}

.th-sorted .th-sort-link::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.2rem;
  vertical-align: middle;
}

.th-sorted--asc .th-sort-link::after {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid currentColor;
}

.th-sorted--desc .th-sort-link::after {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}

/* ── FILE UPLOAD ── */
.field-file {
  display: block;
  width: 100%;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
}

.field-file::file-selector-button {
  padding: 0.35rem 0.75rem;
  margin-right: 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
}

.field-file::file-selector-button:hover {
  border-color: var(--accent);
  background: var(--hover);
}

.field-hint {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── UPLOAD PREVIEW ── */
.upload-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem;
  margin-bottom: 0.6rem;
  background: var(--hover);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
}

.upload-preview__img {
  display: block;
  object-fit: contain;
  border-radius: var(--r-sm);
  background: var(--panel);
}

.upload-preview__img--logo {
  width: 80px;
  height: 48px;
}

.upload-preview__img--thumb {
  width: 96px;
  height: 54px;
  object-fit: cover;
}

.upload-preview__video {
  display: block;
  width: 160px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--panel);
}

.upload-preview__remove {
  margin-left: auto;
  color: var(--danger);
  font-size: 0.82rem;
}

/* ── TABLE THUMBNAILS ── */
.tbl-thumb {
  display: block;
  border-radius: var(--r-sm);
  object-fit: cover;
}

.tbl-thumb--logo {
  width: 56px;
  height: 32px;
  object-fit: contain;
  background: var(--hover);
}

.tbl-thumb--thumb {
  width: 72px;
  height: 40px;
}

.tbl-thumb-empty {
  display: block;
  width: 56px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--hover);
  border: 1.5px dashed var(--border);
}
/* Image attachment editor controls (image_attachment_controller.js).
   Floating overlay — resize handle + align/link toolbar — over the selected
   image in the Trix editor, plus in-editor alignment preview. Admin-only and
   built on admin tokens so it follows the light/dark theme. Public-page
   alignment lives in components2.css. */
.image-attachment-overlay {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.image-attachment-overlay .image-attachment-toolbar {
  position: absolute;
  top: -2.75rem;
  left: 0;
  display: flex;
  gap: 0.15rem;
  padding: 0.25rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  pointer-events: auto;
}

.image-attachment-overlay .image-attachment-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-sec);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.image-attachment-overlay .image-attachment-toolbar button:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.image-attachment-overlay .image-attachment-toolbar button.is-active {
  background: var(--accent);
  color: #fff;
}

.image-attachment-overlay .image-attachment-toolbar button svg {
  width: 18px;
  height: 18px;
}

.image-attachment-overlay .image-attachment-toolbar button.image-attachment-size {
  width: auto;
  padding: 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
}

.image-attachment-overlay .image-attachment-toolbar .image-attachment-sep {
  width: 1px;
  align-self: stretch;
  margin: 0.15rem 0.1rem;
  background: var(--border);
}

.image-attachment-overlay .image-attachment-handle {
  position: absolute;
  right: -9px;
  bottom: -9px;
  width: 20px;
  height: 20px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--sh-sm);
  cursor: nwse-resize;
  pointer-events: auto;
  touch-action: none;
}

/* In-editor alignment preview (mirrors the public rules in components2.css). */
trix-editor .attachment--align-center {
  display: block;
  width: auto;
  margin-inline: auto;
  text-align: center;
}
trix-editor .attachment--align-left {
  float: left;
  width: auto;
  margin: 0.25rem 1.25rem 0.5rem 0;
}
trix-editor .attachment--align-right {
  float: right;
  width: auto;
  margin: 0.25rem 0 0.5rem 1.25rem;
}
