body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.05rem;
  line-height: 1.45;
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  align-items: stretch;
}

.portal-sidebar {
  position: sticky;
  top: 0;
  width: 15rem;
  height: 100vh;
  height: 100dvh;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #e2e8f0;
}

.portal-sidebar__brand {
  flex-shrink: 0;
}

.portal-sidebar__nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  padding-bottom: 1rem;
}

.portal-sidebar__locale {
  flex-shrink: 0;
  margin-top: auto;
  padding: 1rem 0.75rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

dialog::backdrop {
  background: rgb(15 23 42 / 0.45);
}

.nav-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 8px;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav-item:hover {
  background: #f1f5f9;
}

.nav-item-active {
  background: #ccfbf1;
  color: #0f766e;
  font-weight: 600;
}

.nav-section-separator {
  margin: 0.8rem 0 0.35rem;
  padding: 0.65rem 0.75rem 0.35rem;
  border-top: 1px solid #cbd5e1;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.badge {
  background: #14b8a6;
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  min-width: 24px;
  text-align: center;
}

.tab-btn {
  border: 1px solid #e2e8f0;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: #475569;
}

.tab-btn.active {
  background: #14b8a6;
  color: #fff;
  border-color: #14b8a6;
}

/* Pestanyes denúncies: text i comptadors més llegibles */
.tab-btn.tab-btn-reports {
  color: #0f172a;
  font-weight: 600;
}

.tab-btn.tab-btn-reports.active {
  color: #f8fafc;
}

.link {
  color: #0f766e;
  font-weight: 600;
}

.link:hover {
  text-decoration: underline;
}

th.sortable {
  cursor: pointer;
}

th.sort-asc::after {
  content: " ▲";
  font-size: 10px;
}

th.sort-desc::after {
  content: " ▼";
  font-size: 10px;
}

.btn-primary {
  background: #14b8a6;
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
}
.btn-danger {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: .375rem;
  padding: .5rem .75rem;
  font-size: .875rem;
  font-weight: 500;
}
.btn-danger:hover { background: #fee2e2; border-color: #fca5a5; }

a.btn-primary {
  display: inline-block;
  text-decoration: none;
}

.btn-primary:hover {
  background: #0d9488;
}

.btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-ghost {
  background: transparent;
  color: #0f766e;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
}

.btn-ghost:hover {
  background: #ccfbf1;
}

.input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
}

/* Llistat posts: files més baixes i text compacte */
.js-posts-list-root table {
  font-size: 12px;
}

.js-posts-list-root table thead th,
.js-posts-list-root table tbody td {
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

.posts-list-filters,
.lists-list-filters {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
}

.posts-list-filters__grid,
.lists-list-filters__grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.posts-list-filters__row {
  display: grid;
  gap: 8px 12px;
  align-items: end;
}

.posts-list-filters__row--primary {
  grid-template-columns: 6rem minmax(10rem, 1.5fr) minmax(8rem, 1fr) minmax(8rem, 1fr);
}

.posts-list-filters__row--secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
}

.posts-list-filters__field--types {
  flex: 1 1 14rem;
  min-width: 0;
}

.posts-list-filters__row--secondary .js-posts-date-from-wrap,
.posts-list-filters__row--secondary .js-posts-date-to-wrap {
  flex: 0 0 auto;
  width: 8.5rem;
}

.lists-list-filters__grid {
  display: grid;
  grid-template-columns: 7.5rem minmax(12rem, 1.6fr) minmax(9rem, 1fr) minmax(9rem, 1fr) auto;
  gap: 12px 14px;
  align-items: end;
}

.posts-list-filters__field,
.lists-list-filters__field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.posts-list-filters__field span,
.lists-list-filters__field span {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.01em;
}

.posts-list-filters__field .input,
.lists-list-filters__field .input {
  width: 100%;
  background: #fff;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 6px;
}

.posts-list-filters__types {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  min-height: 30px;
  padding: 4px 2px;
}

.posts-list-filters__type-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.posts-list-filters__type-option input {
  margin: 0;
}

.posts-list-filters__actions,
.lists-list-filters__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 1px;
  margin-left: auto;
  flex-shrink: 0;
}

.posts-list-filters__actions .btn-primary,
.lists-list-filters__actions .btn-primary {
  white-space: nowrap;
  font-size: 12px;
  padding: 5px 12px;
}

.posts-list-filters__actions .btn-primary + button,
.posts-list-filters__actions button {
  font-size: 12px;
  padding: 5px 10px;
}

@media (max-width: 1100px) {
  .posts-list-filters__row--primary,
  .posts-list-filters__row--secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .posts-list-filters__field--types,
  .posts-list-filters__field--priority,
  .posts-list-filters__actions,
  .lists-list-filters__actions {
    grid-column: 1 / -1;
  }

  .posts-list-filters__row--secondary .posts-list-filters__field--types {
    flex: 1 1 100%;
  }

  .posts-list-filters__actions {
    justify-content: flex-end;
    margin-left: 0;
    width: 100%;
  }

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

  .lists-list-filters__field--wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .posts-list-filters__row--primary,
  .posts-list-filters__row--secondary,
  .lists-list-filters__grid {
    grid-template-columns: 1fr;
  }
}

/* —— Rendiment (quadres BI) —— */
.perf-filters {
  display: grid;
  grid-template-columns: minmax(14rem, 1.6fr) 9rem 9rem minmax(8rem, 1fr) auto;
  gap: 10px 12px;
  align-items: end;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
}

.perf-filters__field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  position: relative;
}

.perf-filters__field span {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

.perf-filters__field span em {
  font-style: normal;
  font-weight: 500;
  color: #94a3b8;
}

.perf-filters__field .input {
  font-size: 12px;
  padding: 6px 8px;
}

.perf-filters__actions .btn-primary {
  font-size: 12px;
  padding: 6px 14px;
}

.perf-user-results {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  max-height: 220px;
  overflow: auto;
  box-shadow: 0 8px 20px rgb(15 23 42 / 0.08);
}

.perf-user-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.perf-user-item:hover {
  background: #f1f5f9;
}

.perf-placeholder,
.perf-error {
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 28px 20px;
  color: #64748b;
  font-size: 13px;
  background: #fff;
}

.perf-error {
  border-style: solid;
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.perf-report__header {
  margin-bottom: 16px;
}

.perf-report__header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.perf-report__period {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  border: 1px solid #a78bfa;
  border-radius: 6px;
  font-size: 12px;
  color: #5b21b6;
  background: #f5f3ff;
}

.perf-sources-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
  font-size: 11px;
  color: #64748b;
  align-items: center;
}

.perf-source {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.perf-source--db,
.perf-source--db_proxy { background: #ccfbf1; color: #0f766e; }
.perf-source--brevo { background: #e0e7ff; color: #3730a3; }
.perf-source--brevo_error { background: #fee2e2; color: #991b1b; }
.perf-source--pending,
.perf-source--pending_bi { background: #fef3c7; color: #92400e; }
.perf-source--pending_brevo { background: #e0e7ff; color: #3730a3; }

.perf-note {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
}

.perf-highlights {
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.perf-highlights ul {
  margin: 0;
  padding: 12px 18px 14px 28px;
  font-size: 13px;
  color: #334155;
}

.perf-highlights li + li {
  margin-top: 4px;
}

.perf-section-hint {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
}

.perf-muted {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}

.perf-activity {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
}

.perf-activity__head {
  font-size: 12px;
  font-weight: 700;
  color: #0f766e;
  margin-bottom: 8px;
}

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

.perf-activity__card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
}

.perf-activity__label {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
}

.perf-activity__value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f766e;
  margin-top: 2px;
}

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

@media (max-width: 640px) {
  .perf-activity__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.perf-grid-top {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(14rem, 0.7fr);
  gap: 14px;
  margin-bottom: 14px;
}

.perf-grid-charts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.perf-grid-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}

.perf-panel,
.perf-table-card,
.perf-compare-card,
.perf-kpi {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.perf-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #0f766e;
  color: #fff;
  padding: 8px 12px;
}

.perf-panel__head h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}

.perf-legend {
  display: flex;
  gap: 10px;
  font-size: 10px;
}

.perf-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 4px;
}

.perf-dot--app { background: #7dd3fc; }
.perf-dot--webapp { background: #0369a1; }

.perf-bars {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  min-height: 140px;
  padding: 16px 14px 10px;
}

.perf-bar-col {
  flex: 1;
  min-width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 120px;
  position: relative;
}

.perf-bar-track {
  width: 28px;
  min-height: 4px;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  background: #f1f5f9;
}

.perf-bar-seg--app { background: #7dd3fc; }
.perf-bar-seg--webapp { background: #0369a1; }
.perf-bar-seg--solid { background: #0ea5e9; display: block; width: 100%; }

.perf-bar-value,
.perf-bar-label {
  font-size: 10px;
  color: #475569;
  text-align: center;
}

.perf-bar-value { margin-bottom: 4px; font-weight: 600; }
.perf-bar-label { margin-top: 6px; line-height: 1.2; max-width: 72px; }
.perf-bar-bubble {
  position: absolute;
  top: 0;
  font-size: 10px;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 999px;
  padding: 1px 6px;
  font-weight: 700;
}

.perf-empty,
.perf-td-empty {
  color: #94a3b8;
  font-size: 12px;
  padding: 18px;
}

.perf-kpi {
  padding: 12px 14px;
}

.perf-kpi__label {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}

.perf-kpi__value {
  font-size: 1.45rem;
  font-weight: 700;
  color: #0f766e;
  margin-top: 2px;
}

.perf-kpi__sub {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.perf-compare-row-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.perf-compare-body {
  padding: 10px 12px;
  font-size: 12px;
}

.perf-compare-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #f1f5f9;
}

.perf-compare-row:last-child { border-bottom: 0; }

.perf-delta--up { color: #15803d; }
.perf-delta--down { color: #c2410c; }
.perf-delta--na,
.perf-delta--flat { color: #94a3b8; }

.perf-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin: 8px 0 10px;
}

.perf-marketing-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.perf-marketing-kpis--nl {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.perf-brevo-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.perf-brevo-error strong {
  display: block;
  margin-bottom: 4px;
}

.perf-brevo-error p {
  margin: 4px 0 0;
}

.perf-brevo-error code {
  font-size: 12px;
  background: #fee2e2;
  padding: 1px 5px;
  border-radius: 4px;
}

.perf-marketing-charts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

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

.perf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.perf-table th {
  text-align: left;
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.perf-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.perf-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

@media (max-width: 1100px) {
  .perf-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .perf-filters__actions { grid-column: 1 / -1; justify-self: end; }
  .perf-grid-top,
  .perf-compare-row-grid,
  .perf-tables-grid,
  .perf-marketing-kpis,
  .perf-marketing-kpis--nl {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 701px) and (max-width: 1100px) {
  .perf-marketing-kpis--nl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Landing editor — selector de llistes públiques */
.landing-lists-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.35rem;
  margin: 0 -0.25rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.landing-lists-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.75rem;
  width: max-content;
  min-width: 100%;
  padding-bottom: 0.15rem;
}

.landing-list-card {
  flex: 0 0 auto;
  width: 7.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 0.5rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.landing-list-card:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.landing-list-card.is-selected {
  border-color: #0d9488;
  box-shadow: 0 0 0 1px #0d9488;
  background: #f0fdfa;
}

.landing-list-card__img {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 0.375rem;
  border: 1px solid #e2e8f0;
  object-fit: cover;
  background: #f8fafc;
}

.landing-list-card__img--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  color: #94a3b8;
}

.landing-list-card__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
  color: #1e293b;
  min-height: 2.5em;
}

.landing-list-card__meta {
  font-size: 0.6875rem;
  line-height: 1.2;
  color: #64748b;
}

.landing-list-card__cb {
  margin-top: 0.15rem;
  width: 1rem;
  height: 1rem;
  accent-color: #0d9488;
  cursor: pointer;
}

/* City photos: double-size thumbnails and an unclipped hover preview. */
.city-photo-button { display: block; cursor: zoom-in; }
.city-photo-thumbnail { display: block; width: 8rem; height: 5rem; max-width: none; object-fit: cover; border-radius: .375rem; }
.city-photo-zoom { position: fixed; inset: auto; margin: 0; padding: 8px; border: 1px solid #cbd5e1; border-radius: .5rem; background: #fff; box-shadow: 0 12px 32px #0f172a40; pointer-events: none; z-index: 100; }
.city-photo-zoom img { width: 100%; height: 100%; object-fit: contain; }
.city-photo-zoom::backdrop { background: transparent; pointer-events: none; }
/* Visible feedback while the users list is fetched, including filter refreshes. */
.users-list-loading { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; color: #0f766e; font-size: .875rem; }
.users-list-loading[hidden] { display: none; }
.users-list-spinner { width: 1rem; height: 1rem; border: 2px solid #99f6e4; border-top-color: #0f766e; border-radius: 50%; animation: users-list-spin .8s linear infinite; }
@keyframes users-list-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .users-list-spinner { animation: none; } }

/* External provider activity lists */
.provider-activities-scroll { width: 100%; overflow-x: auto; }
.provider-activities-table { min-width: 820px; border-collapse: collapse; }
.provider-activities-table th, .provider-activities-table td { padding: 12px 14px; text-align: left; vertical-align: middle; }
.provider-activities-table th { white-space: nowrap; }
.provider-activities-table td:nth-child(3) { min-width: 260px; overflow-wrap: anywhere; }
.provider-activities-table td:not(:nth-child(3)) { white-space: nowrap; }
.provider-activity-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 130px; }
.provider-activity-actions > * { margin-left: 0; }
