/* ==========================================================================
   Theme tokens, base resets, and global helpers
   ========================================================================== */

:root {
  /* Colors */
  --c-bg: #ffffff;
  --c-bg-soft: #F9FAFB;
  --c-card: #ffffff;
  --c-border: #E5E7EB;
  --c-text: #111827;
  --c-muted: #6b7280;
  --c-note: #374151;
  --c-tableHeader: #f9fafb;

  /* Buttons */
  --c-btn: #F3F4F6;
  --c-btnText: #374151;
  --c-btnPrimary: #3092D0;
  --c-btnPrimaryText: #ffffff;

  /* Icon buttons */
  --c-iconBtnBg: #ffffff;
  --c-iconBtnBorder: #E5E7EB;

  /* Hover */
  --c-hover: #F3F4F6;

  /* News status colors */
  --st-published: #16a34a; /* green-600 */
  --st-concept:    #eab308; /* amber-500 */
  --st-declined:   #dc2626; /* red-600 */

  /* Layout + typography */
  --font-ui: Gilroy, ui-sans-serif, system-ui, -apple-system, "Segoe UI",
             Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  --sidebar-w: 260px;

  /* Misc utilities */
  --radius: 8px;
  --shadow: 0 2px 6px rgba(0,0,0,.08);

  color-scheme: light dark; /* better native controls in both modes */
}

/* Dark theme variables (overrides) */
[data-theme="dark"] {
  --c-bg: #0f172a;          /* slate-900-ish */
  --c-bg-soft: #0b1220;
  --c-card: #0b1220;
  --c-border: #1f2937;      /* slate-800 */
  --c-text: #e5e7eb;        /* slate-200 */
  --c-muted: #9ca3af;       /* slate-400 */
  --c-note: #cbd5e1;        /* slate-300 */
  --c-tableHeader: #111827; /* slate-900 */
  --c-btn: #111827;
  --c-btnText: #e5e7eb;
  --c-btnPrimary: #1d4ed8;  /* blue-700 */
  --c-btnPrimaryText: #ffffff;
  --c-iconBtnBg: #111827;
  --c-iconBtnBorder: #374151;
  --c-hover: #1f2937;

  /* Keep strong, readable hues in dark mode too */
  --st-published: #16a34a;
  --st-concept:   #eab308;
  --st-declined:  #ef4444; /* a touch brighter red in dark */
}

/* Respect system preference when no explicit theme is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --c-bg: #0f172a;
    --c-bg-soft: #0b1220;
    --c-card: #0b1220;
    --c-border: #1f2937;
    --c-text: #e5e7eb;
    --c-muted: #9ca3af;
    --c-note: #cbd5e1;
    --c-tableHeader: #111827;
    --c-btn: #111827;
    --c-btnText: #e5e7eb;
    --c-btnPrimary: #1d4ed8;
    --c-btnPrimaryText: #ffffff;
    --c-iconBtnBg: #111827;
    --c-iconBtnBorder: #374151;
    --c-hover: #1f2937;
  }
}

/* Box-sizing reset and base text rendering */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-ui) !important;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden; /* prevent page scroll; content scrolls */
}

/* Inherit UI font for common elements */
button, input, select, textarea,
label, table, th, td, code,
.tm-note, .login-card, .navigation, .content {
  font-family: inherit;
}

/* A11y: focus styles only when keyboard focusing */
:focus-visible {
  outline: 2px solid rgba(48,146,208,.35);
  outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Utility */
.hidden { display: none !important; }
.plain-link { color: inherit; text-decoration: none; }
.plain-link:hover, .plain-link:focus-visible { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* Screen-reader only */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ==========================================================================
   App layout
   ========================================================================== */

.main {
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  background: var(--c-bg);
  overflow: hidden;
}

.page--sponsors #spAdd[hidden],
.sp-read-only[hidden] { display: none; }

.sp-read-only {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-inline-start: 3px solid var(--c-primary);
  border-radius: 8px;
  background: var(--c-bg-soft);
  color: var(--c-text);
}
.sp-read-only > i { font-size: 20px; }
.sp-read-only p { margin: 2px 0 0; color: var(--c-muted); }

[data-account-preview] body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
[data-account-preview] .main {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}
.account-preview-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
  background: var(--c-bg-soft);
  color: var(--c-text);
  border-bottom: 2px solid var(--c-primary);
  overflow-wrap: anywhere;
}
.account-preview-note {
  display: inline-block;
  margin-inline-start: 8px;
  color: var(--c-muted);
}
[data-account-preview] .content .appbar {
  padding-top: 10px;
}
[data-account-preview] .content .appbar::before {
  content: none;
}

/* Left navigation: sticky, scrolls internally */
.navigation {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: 100%;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  background: var(--c-bg-soft);
  border-right: 1px solid var(--c-border);
  overflow-y: auto;
  overflow-x: hidden;
}

[data-is-admin="0"]:not([data-menu-ready]) .navigation > :is(.menu_item, .submenu) {
  display: none;
}

/* Admin club selector */
.club-select {
  padding: 8px 12px;
}

.club-select__label {
  display: block;
  font-size: 12px;
  color: var(--c-muted);
  margin-bottom: 4px;
}

/* Right content: independent scroll container */
.content {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Mobile app bar (hidden on desktop) */
.appbar { display: none; }

/* Initial content message */
.initial-msg {
  color: var(--c-muted);
}

.website-module-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
}

.website-module-layout__header {
  flex: 0 0 auto;
}

.website-module-layout__header h2 {
  margin-bottom: 6px;
}

.website-module-layout__body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

/* Club settings: make full module vertically scrollable inside .content */
.club-settings-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

/* Club settings sports table: better width balance between sport and actions */
#spTbl { table-layout: fixed; width: 100%; }
#spTbl col.sp-col-sport { width: 30%; }
#spTbl col.sp-col-provider { width: 28%; }
#spTbl col.sp-col-client { width: 26%; }
#spTbl col.sp-col-actions { width: 16%; }
#spTbl td.td-actions, #spTbl th.td-actions { min-width: 108px; width: 108px; }
#spTbl .sp-sport { overflow-wrap: anywhere; }

/* Uploads */
.uploads-tab {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* The application shell suppresses body scrolling, so Media owns its scroller. */
.content:has(#overviewPane) {
  overflow-y: auto;
}

.upload-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.upload-card__head {
  padding: 16px;
  border-bottom: 1px solid var(--c-border);
}

.upload-card__head h3 {
  margin: 0;
  font-size: 1.125rem;
}

.upload-card__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.upload-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.upload-field {
  display: flex;
  flex-direction: column;
}

.upload-field--full {
  grid-column: 1 / -1;
}

.upload-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--c-muted);
}

.upload-file-btn {
  display: flex;
  width: 100%;
  justify-content: center;
  text-align: center;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.upload-status {
  min-height: 1.5em;
  color: var(--c-muted);
}

.upload-rules {
  border: 1px dashed var(--c-border);
  border-radius: 10px;
  background: var(--c-bg-soft);
  padding: 16px;
}

.upload-rules h4 {
  margin: 0;
  font-size: 1rem;
}

.upload-rules__list {
  margin: 8px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
}

.upload-rules__list li {
  color: var(--c-muted);
}

.uploads-overview-toolbar {
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.uploads-filter-fields {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.uploads-filter-fields[hidden] {
  display: none !important;
}

.uploads-filter-toggle {
  display: none !important;
  margin-bottom: 10px;
}

.uploads-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.uploads-pagination .tm-pagination__info {
  margin-right: auto;
}

.uploads-pagination__right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.uploads-pagination .tm-pagination__size {
  margin-left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  text-align: right;
}

.uploads-filter-field {
  min-width: 170px;
}

.uploads-filter-field--date {
  min-width: 280px;
}

.uploads-date-range {
  display: flex;
  gap: 8px;
}

.uploads-date-range .tm-input {
  min-width: 0;
  flex: 1 1 0;
}

.uploads-overview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

@media (max-width: 700px) {
  .upload-card__body {
    padding: 14px;
  }

  .upload-grid {
    grid-template-columns: 1fr;
  }

  .upload-file-btn {
    justify-content: center;
  }

  .uploads-filter-field,
  .uploads-filter-field--date {
    min-width: 100%;
  }

  .uploads-overview-actions {
    width: 100%;
    margin-left: 0;
  }

  .uploads-filter-toggle {
    display: inline-flex !important;
    width: 100%;
    justify-content: center;
  }

  .uploads-filter-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
  }

  .uploads-pagination {
    justify-content: flex-end;
    gap: 10px;
  }

  .uploads-pagination .tm-pagination__info {
    width: 100%;
  }

  .uploads-pagination .tm-pagination__size {
    order: 2;
    width: auto;
    justify-content: flex-end;
    margin-left: auto;
  }

  .uploads-pagination .tm-pagination__nav {
    order: 1;
  }
}

/* === API Management split layout (stacked vertically) === */
.api-split {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.api-pane { display: flex; flex-direction: column; gap: 8px; }
.api-pane .pane-body { display: block; }
.api-pane .pane-selected {
  display: none;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-card);
  padding: 10px 12px;
  cursor: pointer;
}
.api-pane .pane-selected:focus-visible { outline: 2px solid #2563eb33; }
.api-pane .sel-row {
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
}
.api-pane .sel-chip {
  font-size: 12px;
  color: var(--c-muted);
  background: var(--c-hover);
  border: 1px solid var(--c-border);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.api-pane .sel-value {
  font-weight: 600;
  color: var(--c-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Expand affordance on collapsed pane headers */
.api-pane .sel-expand {
  margin-left: auto; opacity: .7; font-size: 18px; line-height: 1; pointer-events: none;
}
/* Collapsed state: hide tools/table, show compact selection */
.api-pane.collapsed .pane-body { display: none; }
.api-pane.collapsed .pane-selected { display: block; }


/* ==========================================================================
   Navigation visuals
   ========================================================================== */

.menu_logo {
  height: 70px;
  width: auto;
  margin: 2px 12px;
  padding-left: 10px;
  box-sizing: border-box;
  flex-shrink: 0;
}
.logo { width: 200px; border: 0; }

.menu_font { font-family: inherit; }

.menu_item {
  height: 40px;
  margin: 2px 12px;
  padding-left: 10px;
  line-height: 40px;
  border-radius: 5px;
  color: var(--c-text);
  cursor: pointer;
}
.menu_item:hover { background-color: #3092D0; color: #FFFFFF; }

.menu_bottom { margin-top: auto; padding-bottom: 10px; }
.menu_icon { vertical-align: middle; }

/* Submenus (animated open/close via max-height; JS toggles) */
.submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 32px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}
.submenu_item {
  height: 30px; line-height: 30px;
  color: var(--c-muted);
  border-radius: 3px;
  padding-left: 10px;
  cursor: pointer;
}
.submenu_item:hover { background-color: var(--c-hover); }

.row-selected { background: var(--c-hover); }

.page--api-admin #apProvBody tr[data-id],
.page--api-admin #apEpBody tr[data-id] { cursor: pointer; }

.api-clickable-slug,
.api-clickable-param { cursor: default; }

.page--api-admin {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  gap: 8px;
  overflow: auto;
}

.page--api-admin > h2 {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0;
  padding: 6px 0;
  background: var(--c-bg);
}

/* ==========================================================================
   Tables & data containers
   ========================================================================== */

.tm-table-wrap {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-card);
  overflow: auto;
  max-height: 60vh;
}

@supports (-webkit-overflow-scrolling: touch) {
  .tm-table-wrap {
    /* smoother momentum scrolling on iOS Safari */
    -webkit-overflow-scrolling: touch;
  }
}


/* Profile page: restore desktop/tablet scrolling inside content pane */
.profile-page-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.profile-page-scroll > h2 {
  position: sticky;
  top: 0;
  z-index: 12;
  margin: 0;
  padding: 6px 0 8px;
  background: var(--c-bg);
}

/* Smart-scroll variant: overflow only when needed (JS toggles .has-overflow) */

/* Profile module: let page scroll instead of individual table cards */
.tm-table-wrap.profile-table-wrap {
  overflow: visible;
  max-height: none;
}
.tm-table-wrap.smart-scroll { overflow: visible; max-height: none; }
.tm-table-wrap.smart-scroll.has-overflow {
  overflow: auto;
  max-height: 60vh;
  padding-bottom: 10px;       /* keep last row readable above bar */
  margin-bottom: 6px;
}

@supports (scrollbar-gutter: stable) {
  .tm-table-wrap.smart-scroll.has-overflow {
    scrollbar-gutter: stable both-edges;
  }
}

/* Teams module uses nested scroll containers; keep everything constrained to the content pane. */
.page--teams-layout {
  min-height: 0;
}

.page--teams-layout .website-module-layout__body {
  overflow: hidden;
}

/* --- Teams page: keep header/pager fixed and table body scrollable --- */
.page--teams {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  gap: 8px;
  overflow: auto;
}

/* API admin: keep header/pagination fixed while lists scroll within cards */
.page--api-admin .api-pane .pane-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 8px;
}

/* Ensure collapsed state still wins inside API admin scoped rules */
.page--api-admin .api-pane.collapsed .pane-body { display: none; }
.page--api-admin .api-pane.collapsed .pane-selected { display: block; }

.page--api-admin .api-pane .tm-table-wrap.smart-scroll.has-overflow {
  max-height: 42vh;
}

.page--api-admin .tm-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.page--api-admin .tm-pagination__nav { display: inline-flex; gap: 6px; align-items: center; }
.page--api-admin .tm-pagination__size { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; }


.page--api-admin .api-pane .tm-table-wrap.smart-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  max-height: min(52vh, 420px);
  overscroll-behavior: contain;
}


.page--api-admin #apEpTbl,
.page--api-admin #apParTbl {
  min-width: 0;
  table-layout: fixed;
}

.page--api-admin #apEpTbl th,
.page--api-admin #apEpTbl td,
.page--api-admin #apParTbl th,
.page--api-admin #apParTbl td {
  padding-left: 8px;
}

.page--api-admin .api-pane .tm-table-wrap.smart-scroll {
  scrollbar-gutter: auto;
}


.page--api-admin #apEpTbl thead th {
  z-index: 4;
}

.page--api-admin #apEpTbl tbody .icon-btn {
  position: relative;
  z-index: 1;
}
.page--api-admin #apEpPageSize {
  width: 56px;
  min-width: 56px;
}
.page--api-admin #paneEp .tm-pagination {
  position: sticky;
  bottom: 0;
  z-index: 6;
  background: var(--c-bg);
  padding: 6px 0 2px;
}

@media (max-width: 700px) {
  .page--api-admin #apParTbl {
    table-layout: fixed;
    width: 100%;
  }

  .page--api-admin #apParTbl th:first-child,
  .page--api-admin #apParTbl td:first-child {
    width: calc(100% - 74px);
    max-width: calc(100% - 74px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page--api-admin #apParTbl th:last-child,
  .page--api-admin #apParTbl td:last-child {
    width: 74px;
    min-width: 74px;
  }
}

/* Providers table: hide slug column to free space */
#apProvTbl th:first-child,
#apProvTbl td:first-child { display: none; }

.page--teams > h2 {
  position: sticky;
  top: 0;
  z-index: 15;
  margin: 0;
  padding: 6px 0;
  background: var(--c-bg);
}

.page--teams .tm-table-wrap {
  overflow: auto;
  max-height: 60vh;
  min-height: 0;
  overscroll-behavior: contain;
  overscroll-behavior-y: contain;
}

.page--teams #tmTbl thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--c-tableHeader);
}

/* Match General > Media overview pagination spacing/alignment */
.page--teams .tm-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.page--teams .tm-pagination__nav { display: inline-flex; gap: 6px; align-items: center; }
.page--teams .tm-pagination__nav .icon-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
}
.page--teams .tm-pagination__size { display: inline-flex; gap: 6px; align-items: center; color: #4b5563; font-size: 13px; }
.page--teams .tm-pagination__size span { font-weight: 600; }

.page--teams .tm-pagination__info {
  margin-right: auto;
  font-size: 13px;
  color: #4b5563;
  text-align: left;
  font-weight: 600;
}
.page--clubs .tm-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.page--clubs .tm-pagination__nav { display: inline-flex; gap: 6px; align-items: center; }
.page--clubs .tm-pagination__nav .icon-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
}
.page--clubs .tm-pagination__size { display: inline-flex; gap: 6px; align-items: center; color: #4b5563; font-size: 13px; }
.page--clubs .tm-pagination__size span { font-weight: 600; }
.page--clubs .tm-pagination__info {
  margin-right: auto;
  font-size: 13px;
  color: #4b5563;
  text-align: left;
  font-weight: 600;
}
.page--news .tm-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.page--news .tm-pagination__nav { display: inline-flex; gap: 6px; align-items: center; }
.page--news .tm-pagination__nav .icon-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
}
.page--news .tm-pagination__size { display: inline-flex; gap: 6px; align-items: center; color: #4b5563; font-size: 13px; }
.page--news .tm-pagination__size span { font-weight: 600; }
.page--news .tm-pagination__info {
  margin-right: auto;
  font-size: 13px;
  color: #4b5563;
  text-align: left;
  font-weight: 600;
}
.page--users .tm-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.page--users .tm-pagination__nav { display: inline-flex; gap: 6px; align-items: center; }
.page--users .tm-pagination__nav .icon-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
}
.page--users .tm-pagination__size { display: inline-flex; gap: 6px; align-items: center; color: #4b5563; font-size: 13px; }
.page--users .tm-pagination__size span { font-weight: 600; }
.page--users .tm-pagination__info {
  margin-right: auto;
  font-size: 13px;
  color: #4b5563;
  text-align: left;
  font-weight: 600;
}

.page--teams .tm-toolbar__label { font-weight: 600; }
.page--teams .tm-select--sport {
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100% - 96px);
}
.page--teams .tm-sync-btn { flex: 0 0 auto; }
.page--users .tm-sync-btn { flex: 0 0 auto; }

/* Make sync/refresh icon-buttons stand out on dark backgrounds */
.icon-btn.tm-sync-btn {
  color: #1f2937;
}
[data-theme="dark"] .icon-btn.tm-sync-btn {
  color: #f9fafb;
  border-color: #94a3b8;
  background: #334155;
}
[data-theme="dark"] .icon-btn.tm-sync-btn:hover {
  background: #475569;
  border-color: #cbd5e1;
}

/* Club settings sports: make add button pop in dark mode similar to sync button */
[data-theme="dark"] #sp_add.tm-btn {
  color: #f9fafb;
  border-color: #94a3b8;
  background: #334155;
}
[data-theme="dark"] #sp_add.tm-btn:hover {
  background: #475569;
  border-color: #cbd5e1;
}

/* Club settings (Club → Instellingen): make inputs 50% width on tablet */
@media (min-width: 701px) and (max-width: 1024px) {
  #clubBody .tm-input {
    width: 50%;
    min-width: 50%;
  }

  /* Club settings sports editor: wider fields on tablet */
  .sp-edit-grid .tm-input,
  .sp-edit-grid .tm-select {
    width: 50%;
    min-width: 50%;
  }
}
[data-theme="dark"] .page--teams .tm-pagination__size,
[data-theme="dark"] .page--teams .tm-pagination__info {
  color: #e5e7eb;
}
[data-theme="dark"] .page--teams .tm-pagination__nav .icon-btn {
  border-color: #4b5563;
  color: #e5e7eb;
  background: #1f2937;
}
[data-theme="dark"] .page--teams .tm-pagination__nav .icon-btn:hover {
  background: #374151;
  border-color: #6b7280;
}
[data-theme="dark"] .page--clubs .tm-pagination__size,
[data-theme="dark"] .page--clubs .tm-pagination__info {
  color: #e5e7eb;
}
[data-theme="dark"] .page--clubs .tm-pagination__nav .icon-btn {
  border-color: #4b5563;
  color: #e5e7eb;
  background: #1f2937;
}
[data-theme="dark"] .page--clubs .tm-pagination__nav .icon-btn:hover {
  background: #374151;
  border-color: #6b7280;
}
[data-theme="dark"] .page--news .tm-pagination__size,
[data-theme="dark"] .page--news .tm-pagination__info {
  color: #e5e7eb;
}
[data-theme="dark"] .page--news .tm-pagination__nav .icon-btn {
  border-color: #4b5563;
  color: #e5e7eb;
  background: #1f2937;
}
[data-theme="dark"] .page--news .tm-pagination__nav .icon-btn:hover {
  background: #374151;
  border-color: #6b7280;
}
[data-theme="dark"] .page--users .tm-pagination__size,
[data-theme="dark"] .page--users .tm-pagination__info {
  color: #e5e7eb;
}
[data-theme="dark"] .page--users .tm-pagination__nav .icon-btn {
  border-color: #4b5563;
  color: #e5e7eb;
  background: #1f2937;
}
[data-theme="dark"] .page--users .tm-pagination__nav .icon-btn:hover {
  background: #374151;
  border-color: #6b7280;
}

/* Teams table: fit within screen without horizontal scroll */
.page--teams #tmTbl {
  min-width: 0 !important;        /* override base 780px */
  table-layout: fixed;            /* make widths predictable */
}

/* Always hide teamcode (first) column, even on desktop */
.page--teams #tmTbl th:first-child,
.page--teams #tmTbl td:first-child {
  display: none;
}

/* Truncate long team names so actions stay visible */
.page--teams #tmTbl td:nth-child(2) {
  max-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Slim actions column on all viewports */
.page--teams #tmTbl .td-actions {
  width: 96px;
  min-width: 96px;
  white-space: nowrap;
}
.page--teams #tmTbl .td-actions .icon-btn {
  width: 32px; height: 32px;
  min-width: 32px; min-height: 32px;
}

.tm-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;           /* allow horizontal scroll on narrow screens */
}
.tm-table th, .tm-table td {
  border-bottom: 1px solid var(--c-border);
  padding: 8px;
}
.tm-table th {
  position: sticky;
  top: 0;
  background: var(--c-tableHeader);
  text-align: left;
  z-index: 1;
}

.tm-table th.nw-select-head {
  text-align: center;
  padding: 0;
  width: 42px;
}

/* Sortable header affordance */
.tm-table th.sortable {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.tm-table th.sortable .sort-ind { opacity: 0.75; margin-left: 6px; font-size: 0.85em; }

/* Key–value tables (mobile-friendly) */
.tm-table.tm-kv { 
  min-width: 0; 
  table-layout: fixed;
}
.tm-table.tm-kv td:last-child,
.tm-table.tm-kv code {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.settings-kv thead { display: none; }
.settings-page .settings-section + .settings-section { margin-top: 16px; }
.settings-page .settings-section__title {
  margin: 0;
  padding: 8px 12px;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 700;
  background: var(--c-tableHeader);
  border: 1px solid var(--c-border);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}
.settings-page .tm-table-wrap {
  margin-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}
.settings-page .settings-kv tbody td:first-child {
  width: 360px;
  vertical-align: middle;
}
.settings-page .settings-kv tbody td:last-child {
  vertical-align: middle;
}
.settings-page .settings-actions {
  margin-top: 14px;
  justify-content: flex-end;
  padding-inline: 8px;
}
.settings-page .settings-msg { margin-top: 6px; }

.tm-kv.kv-wide tbody td:first-child {
  width: 18ch;
  white-space: nowrap;
  vertical-align: top;
}
.tm-kv.kv-wide tbody td:last-child { width: auto; }
@media (max-width: 700px) {
  .tm-kv.kv-wide tbody td:first-child { width: 32vw; }
}

/* Action cell alignment */
.td-actions { text-align: right; white-space: nowrap; }
/* Ensure the header label is right-aligned too */
.tm-table th.td-actions { text-align: right; }

/* Inline editor for Sports rows */
.sp-edit-row td { background: var(--c-bg-soft); }
.sp-edit-grid { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 701px) {
  .sp-edit-grid { grid-template-columns: 1fr 1fr 1fr auto; align-items: end; }
}
.sp-edit-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ==========================================================================
   Toolbars, inputs & buttons
   ========================================================================== */

/* --- Teams editor: optical distinction for API-synced vs editable --- */
.tm-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 8px 0;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  border: 1px solid var(--c-border);
  background: var(--c-bg-soft);
  color: var(--c-muted);
}
.pill .material-icons { font-size: 16px; line-height: 1; }
.pill-edit   { border-color: #86efac; background: #ecfdf5; color: #065f46; }
.pill-locked { border-color: #fca5a5; background: #fef2f2; color: #991b1b; }
[data-theme="dark"] .pill-edit   { border-color: #14532d; background: #052e1a; color: #86efac; }
[data-theme="dark"] .pill-locked { border-color: #7f1d1d; background: #220909; color: #fca5a5; }
.pill--strong {
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .01em;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

.tm-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 0;
  border-bottom: 1px solid var(--c-border);
}
.tm-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 12px 12px 0 0;
  background: transparent;
  color: var(--c-muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tm-tab .material-icons { font-size: 19px; }
.tm-tab:hover { background: var(--c-bg-soft); color: var(--c-text); }
.tm-tab.is-active {
  border-color: var(--c-border);
  border-bottom-color: var(--c-card);
  background: var(--c-card);
  color: var(--c-text);
}
.tm-tab-panel { padding-top: 12px; }
.tm-tab-panel[hidden] { display: none; }
.tm-section-card {
  border: 1px solid var(--c-border);
  border-radius: 14px;
  background: var(--c-card);
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .05);
}
.tm-section-card--locked { border-color: #fca5a5; box-shadow: 0 10px 24px rgba(153, 27, 27, .11); }
.tm-section-card--bond { border-color: #bfdbfe; box-shadow: 0 10px 24px rgba(37, 99, 235, .08); }
.tm-section-card--editable { border-color: #86efac; box-shadow: 0 10px 24px rgba(6, 95, 70, .10); }
.tm-section-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--c-border);
  background: linear-gradient(90deg, var(--c-bg-soft), transparent);
}
.tm-section-card__header p {
  margin: 0;
  color: var(--c-muted);
  font-weight: 600;
  text-align: right;
}
.tm-section-card .tm-table-wrap { border: 0; border-radius: 0; }
[data-theme="dark"] .tm-section-card--locked { border-color: #7f1d1d; box-shadow: 0 10px 24px rgba(248, 113, 113, .08); }
[data-theme="dark"] .tm-section-card--bond { border-color: #1e3a8a; box-shadow: 0 10px 24px rgba(96, 165, 250, .08); }
[data-theme="dark"] .tm-section-card--editable { border-color: #14532d; box-shadow: 0 10px 24px rgba(74, 222, 128, .08); }
@media (max-width: 700px) {
  .tm-tabs { gap: 4px; }
  .tm-tab { flex: 1 1 140px; justify-content: center; padding: 9px 10px; }
  .tm-section-card__header { align-items: flex-start; flex-direction: column; }
  .tm-section-card__header p { text-align: left; }
}

/* Section header inside key–value tables */
.tm-table.tm-kv tr.kv-section td { padding-top: 10px; }
.kv-subcategory td{padding:0!important;background:var(--c-bg,#f8fafc)}
.kv-subcategory__toggle{display:flex;width:100%;align-items:center;gap:7px;padding:10px 14px;border:0;background:transparent;color:inherit;cursor:pointer;text-align:left}
.kv-subcategory__toggle .material-icons{font-size:20px}
.kv-head {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700;           /* make section headers stand out more */
  color: var(--c-muted);
  border-top: 1px dashed var(--c-border);
  padding-top: 6px;
}
.kv-head .material-icons { font-size: 18px; }

/* Tiny, safe preview block under textarea rows */
.tiny-preview {
  border: 1px solid var(--c-border);
  border-radius: 8px;
  background: var(--c-card);
  margin-top: 6px;
  overflow: hidden;
}
.tiny-preview__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-muted);
  font-weight: 600;
}
.tiny-preview__frame {
  display: block;
  width: 100%;
  height: 140px;            /* compact/tiny */
  border: 0;
  background: transparent;
}

/* Mini layout preview for footer columns */
.layout-mini { 
  margin-top: 6px; 
  border: 1px dashed var(--c-border);
  border-radius: 8px;
  background: var(--c-card);
}
.layout-mini__head{
  display:flex; align-items:center; gap:8px;
  padding:6px 8px; border-bottom:1px dashed var(--c-border);
  color: var(--c-muted); font-weight:600;
}
.layout-mini__head .material-icons { font-size:18px; }
.layout-mini__stage{
  --left: 44px;
  --right: 44px;
  display: grid;
  grid-template-columns: var(--left) 1fr var(--right);
  align-items: stretch;
  gap: 6px;
  padding: 8px;
}
.layout-mini .l-left, .layout-mini .l-right{
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  height: 40px;
}
.layout-mini .l-mid{
  display: grid; gap: 6px;
  grid-template-columns: 1fr 1fr 1fr; /* base: 1-3-1 shows 3 mids */
}
.layout-mini .mid{
  background: var(--c-hover);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  height: 40px;
}
/* 1-2-1 → hide the 3rd mid */
.layout-mini__stage[data-layout="1-2-1"] .mid-3 { display: none; }
/* 1-1-1 → hide the 2nd and 3rd mids */
.layout-mini__stage[data-layout="1-1-1"] .mid-2,
.layout-mini__stage[data-layout="1-1-1"] .mid-3 { display: none; }

/* Locked rows get a subtle background; inputs show dashed border + disabled cursor */
.tm-table.tm-kv tr.kv-locked td { background: var(--c-bg-soft); }
.tm-input.api-locked[disabled] { background: var(--c-bg-soft); color: var(--c-muted); border-style: dashed; cursor: not-allowed; opacity: 1; }
.tm-input.user-editable { box-shadow: inset 0 0 0 2px rgba(48,146,208,.15); }

.tm-toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 6px 0;
}

/* Extra inner padding for Staff “add new …” rows */
.page--staff .tm-toolbar {
  padding-left: 12px;
  padding-right: 12px;
}

.tm-toolbar .tm-input,
.tm-toolbar .tm-select {
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  min-width: 180px;
}

#newsToolbar .tm-btn {
  padding-top: 6px;
  padding-bottom: 6px;
}

.content.is-editing-news #newsToolbar,
.content.is-editing-news #newsArchiveSelected,
.content.is-editing-news #newsManageCats {
  display: none !important;
}

.tm-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.tm-actions .btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tm-note { font-size: 0.9em; color: var(--c-muted); margin-top: 8px; }

.tm-backups {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Badge (used for backup chips) */
.tm-badge {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
}
.tm-badge:hover { background-color: #3092D0; border-color: #3092D0; color: #FFFFFF; }

/* Buttons */
.tm-btn {
  border: 0;
  border-radius: 5px;
  padding: 8px 12px;
  line-height: 1;
  color: var(--c-btnText);
  background: var(--c-btn);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease, transform .02s ease;
}
.tm-btn .material-icons {
  font-size: 18px;
  line-height: 1;
}
.tm-btn.small {
  padding: 6px 10px;
}
.tm-btn.small .material-icons {
  font-size: 16px;
}
.tm-btn:hover { background-color: #3092D0; color: #FFFFFF; }
.tm-btn:active { transform: translateY(1px); }
.tm-btn.primary { background-color: var(--c-btnPrimary); color: var(--c-btnPrimaryText); }
.tm-btn.primary:hover { background-color: #2883BA; }
.tm-btn.is-loading { pointer-events: none; opacity: .7; }

/* Inputs & selects */
.tm-input, .tm-select {
  padding: 8px 10px;
  border: 1px solid var(--c-border);
  border-radius: 5px;
  min-width: 180px;
  background: var(--c-card);
  color: var(--c-text);
  transition: border-color .2s ease, box-shadow .2s ease;
  max-width: 100%;
}
.nw-editor-grid .tm-table.tm-kv input.tm-input {
  width: 100%;
}
.nw-editor-grid .tm-table.tm-kv .nw-publication-input {
  width: 100%;
  max-width: 240px;
}
.tm-input:focus, .tm-select:focus {
  outline: none;
  border-color: #3092D0;
  box-shadow: 0 0 0 3px rgba(48,146,208,0.15);
}

/* Bigger, bar-like color input for clearer preview */
input[type="color"].tm-input.color-wide {
  padding: 0;
  width: 180px;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
}
input[type="color"].tm-input.color-wide::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"].tm-input.color-wide::-webkit-color-swatch {
  border: 1px solid var(--c-border);
  border-radius: 6px;
}
input[type="color"].tm-input.color-wide::-moz-color-swatch {
  border: 1px solid var(--c-border);
  border-radius: 6px;
}

.image-input {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.image-input__preview {
  width: 160px;
  min-height: 96px;
  border: 1px dashed var(--c-border);
  background: var(--c-bg-soft);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.image-input__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-input__placeholder {
  font-size: 13px;
  color: var(--c-muted);
  padding: 12px;
  text-align: center;
}

.image-input__controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-input__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.image-input__actions .tm-btn {
  flex: 0 0 auto;
}

.settings-layout__content .tm-table.tm-kv td:nth-child(2) > .tm-input,
.settings-layout__content .tm-table.tm-kv td:nth-child(2) > .tm-select,
.settings-layout__content .tm-table.tm-kv td:nth-child(2) > textarea.tm-input,
.settings-layout__content .image-input__controls .tm-input,
.settings-layout__content .image-input__controls textarea.tm-input {
  width: 100%;
  max-width: calc(100% / 3);
}

@media (min-width: 901px) {
  .settings-layout__setting-column {
    width: 33ch; /* 50% wider than the previous 22ch settings column */
  }

  .settings-layout__content textarea.tm-input.mid-html {
    width: calc(200% / 3);
    max-width: calc(200% / 3); /* twice the standard one-third value field */
  }
}

@media (max-width: 900px) {
  .settings-layout__content .tm-table.tm-kv td:nth-child(2) > .tm-input,
  .settings-layout__content .tm-table.tm-kv td:nth-child(2) > .tm-select,
  .settings-layout__content .tm-table.tm-kv td:nth-child(2) > textarea.tm-input,
  .settings-layout__content .image-input__controls .tm-input,
  .settings-layout__content .image-input__controls textarea.tm-input {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .image-input {
    flex-direction: column;
  }

  .image-input__preview {
    width: 100%;
    max-width: 300px;
  }

  .image-input__actions {
    flex-wrap: wrap;
  }
}

/* Icon-only buttons (touch friendly) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 36px; height: 36px;
  min-width: 36px; min-height: 36px;
  border: 1px solid var(--c-iconBtnBorder);
  border-radius: var(--radius);
  background: var(--c-iconBtnBg);
  cursor: pointer;
  transition: background-color .2s ease, box-shadow .2s ease, transform .02s ease, border-color .2s ease;
}
.icon-btn .material-icons { font-size: 20px; line-height: 1; }
.icon-btn:hover { background: var(--c-hover); border-color:#D1D5DB; }
.icon-btn:active { transform: translateY(1px); }
.icon-btn.edit { color:#1f2937; }
.icon-btn.del  { color:#991b1b; }
.icon-btn.save { color:#065f46; }

/* Denser inside action cells */
.td-actions .icon-btn { width: 34px; height: 34px; min-width: 34px; min-height: 34px; }
.td-actions .setting-help { vertical-align: middle; }
.td-actions .setting-reset { color:#2563eb; }
.settings-layout__content .td-actions { vertical-align: middle; }
.setting-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  line-height: 1;
  width: 100%;
}

/* Better icon contrast in dark theme */
[data-theme="dark"] .icon-btn.edit { color:#93c5fd; }  /* blue-300 */
[data-theme="dark"] .icon-btn.del  { color:#fca5a5; }  /* red-300 */
[data-theme="dark"] .icon-btn.save { color:#86efac; }  /* green-300 */

/* ===== Website → Design: Settings layout ===== */
.settings-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-card);
}

.settings-layout__inner {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.settings-layout__sidebar {
  flex: 0 0 230px;
  max-width: 260px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 12px;
  max-height: 70vh;
  overflow-y: auto;
}

.settings-layout__content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
}

.settings-layout__toggle {
  display: none;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
}

.settings-layout__toggle .material-icons {
  font-size: 20px;
}

.settings-layout__toggleCurrent {
  font-weight: 600;
  color: var(--c-muted);
  margin-left: 4px;
}

.settings-layout__toggleIcon {
  margin-left: auto;
  transition: transform .2s ease;
}

.settings-layout[data-open="true"] .settings-layout__toggleIcon {
  transform: rotate(180deg);
}

.settings-layout--empty .settings-layout__sidebar {
  display: none;
}

.settings-layout--empty .settings-layout__inner {
  flex-direction: column;
}

.settings-layout--empty .settings-layout__toggle {
  display: none !important;
}

.settings-categories {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-categories li { margin: 0; }

.tm-table.tm-kv tr.is-hidden-by-variant {
  display: none !important;
}

.tm-table.tm-kv tr.is-hidden-by-category,
.tm-table.tm-kv tr.is-hidden-by-rule {
  display: none !important;
}

.settings-category {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  padding: 8px 12px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.settings-category:hover,
.settings-category:focus-visible {
  background: var(--c-hover);
  border-color: rgba(48,146,208,0.25);
}

.settings-category.is-active {
  background: var(--c-btnPrimary);
  color: var(--c-btnPrimaryText);
  border-color: var(--c-btnPrimary);
  font-weight: 600;
}

.settings-category:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(48,146,208,0.25);
}

.settings-layout__sidebar .settings-category .material-icons {
  font-size: 18px;
}

@media (min-width: 1025px) {
  .settings-layout__toggle {
    display: none !important;
  }
  .settings-layout__sidebar {
    display: block;
  }
}

@media (max-width: 1024px) {
  .settings-layout__inner {
    flex-direction: column;
    gap: 12px;
  }
  .settings-layout__sidebar {
    display: none;
    width: 100%;
    max-width: none;
    max-height: 60vh;
  }
  .settings-layout[data-open="true"] .settings-layout__sidebar {
    display: block;
  }
  .settings-layout__toggle {
    display: inline-flex;
  }
}

/* ===== Website → Design: Socials list editor ===== */
.socials-ed { display: flex; flex-direction: column; gap: 8px; }
.socials-ed__list { display: flex; flex-direction: column; gap: 8px; }
.soc-row {
  display: grid;
  grid-template-columns: 140px 1fr 1.2fr auto; /* icon | name | url | del */
  gap: 8px;
  align-items: center;
}
.soc-row .tm-select,
.soc-row .tm-input { width: 100%; min-width: 0; }
.soc-row .icon-btn { justify-self: end; }
@media (max-width: 700px){
  .soc-row {
    grid-template-columns: 1fr; /* stack nicely on phones */
  }
  .soc-row .icon-btn { justify-self: end; }
}

/* Website → Design: Site icon picker */
.site-icon-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 360px;
}
.site-icon-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.site-icon-preview__tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-bg-soft);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
}
[data-theme="dark"] .site-icon-preview__tab {
  background: rgba(15, 23, 42, 0.55);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.site-icon-preview__icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--c-border);
  background: var(--c-card);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.site-icon-preview__icon img {
  width: 18px;
  height: 18px;
  display: block;
  object-fit: contain;
}
.site-icon-preview__title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.site-icon-preview__caption {
  font-size: 0.85rem;
  color: var(--c-muted);
}
.site-icon-field__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.site-icon-field__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.site-icon-field__buttons .tm-btn {
  flex: 0 1 auto;
}
.site-icon-note {
  font-size: 0.85rem;
  color: var(--c-muted);
  min-height: 1.2em;
}
.site-icon-note.is-success { color: var(--st-published); }
.site-icon-note.is-warning { color: var(--st-declined); }
.site-icon-note.is-info    { color: var(--c-muted); }

@media (max-width: 700px) {
  .site-icon-field { max-width: none; }
  .site-icon-field__buttons { width: 100%; }
  .site-icon-field__buttons .tm-btn {
    flex: 1 1 160px;
  }
}

/* Toggle switch (notifications) */
.switch {
  position: relative;
  display: inline-block;
  width: 44px; height: 24px;
  vertical-align: middle;
}
.switch input { display: none; }
.switch .slider {
  position: absolute; inset: 0;
  background: var(--c-border);
  border-radius: 999px;
  transition: background .2s ease;
}
.switch .slider::before {
  content: "";
  position: absolute; left: 2px; top: 2px;
  width: 20px; height: 20px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
  transition: transform .2s ease;
}
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px rgba(48,146,208,0.35); }
[data-theme="dark"] .switch .slider { background: #374151; }
.switch input:checked + .slider { background: #3092D0; }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ==========================================================================
   Uploads & gallery
   ========================================================================== */

#filesWrap .preview-btn {
  border: none;
  padding: 0;
  margin: 0;
  background: none;
  display: inline-flex;
  cursor: zoom-in;
  border-radius: 8px;
  line-height: 0;
}

#filesWrap .preview-btn img {
  pointer-events: none;
  border-radius: inherit;
}

#filesWrap > .gallery-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.gal-card { width: 100% !important; }

.image-lightbox[hidden] { display: none !important; }

.image-lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.78);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 1300;
  overflow: auto;
}

.image-lightbox__content {
  position: relative;
  max-width: min(90vw, 960px);
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-lightbox__image {
  width: auto;
  height: auto;
  max-width: min(90vw, 960px);
  max-height: calc(90vh - 40px);
  border-radius: 12px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.3);
  object-fit: contain;
  background: var(--c-card);
}

.image-lightbox__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.image-lightbox__close:hover,
.image-lightbox__close:focus-visible {
  background: rgba(15, 23, 42, 0.9);
}

[data-theme="dark"] .image-lightbox {
  background: rgba(3, 7, 18, 0.82);
}

[data-theme="dark"] .image-lightbox__close {
  background: rgba(255, 255, 255, 0.25);
  color: var(--c-text);
}

[data-theme="dark"] .image-lightbox__close:hover,
[data-theme="dark"] .image-lightbox__close:focus-visible {
  background: rgba(255, 255, 255, 0.35);
}

/* Inline editor spacing responsiveness */
.__inlineEditor .tm-input,
.__inlineEditor .tm-select {
  width: 100%;
  min-width: 0;           /* allow shrinking on narrow phones */
}
@media (min-width: 720px) {
  .__inlineEditor .tm-input,
  .__inlineEditor .tm-select { width: auto; }
}

.inline-meta-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inline-meta-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.inline-meta-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 220px;
  min-width: 180px;
}

.inline-meta-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-muted);
}

.inline-meta-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ==========================================================================
   Login page
   ========================================================================== */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--c-bg-soft);
}
.login-wrapper { width: 100%; max-width: 380px; padding: 20px; }
.login-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-logo { display: block; max-width: 200px; margin: 0 auto 10px auto; }
.login-form { display: flex; flex-direction: column; gap: 6px; }
.login-form .form-group { display: flex; flex-direction: column; gap: 6px; }
.login-form .remember-line { flex-direction: row; align-items: center; gap: 8px; }
.login-form .remember-line label { margin: 0; }
.login-form .login-submit { align-self: flex-end; margin-top: 10px; }
.login-card-heading h1 { margin: 0 0 6px; font-size: 1.25rem; line-height: 1.3; }
.login-card-heading p { margin: 0; color: var(--c-muted); }
.login-footer-action { background: none; border: 0; padding: 0; cursor: pointer; }

/* Enroll step label/fields vertical */
#enrollBox .form-group { display: flex; flex-direction: column; gap: 6px; }

/* Two-factor step */
#twofaStep { display: flex; flex-direction: column; gap: 6px; }
#twofaStep label { margin-bottom: 2px; }
.mfa-method-wrap { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.mfa-method-bar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: var(--c-card);
  color: var(--c-text);
  padding: 12px;
  cursor: pointer;
  text-align: left;
  font-weight: 600;
}
.mfa-method-bar .material-icons { font-size: 20px; color: var(--c-muted); }
.mfa-method-bar:hover { border-color: #3092D0; }
.mfa-method-bar:focus-visible {
  outline: 2px solid var(--c-btnPrimary);
  outline-offset: 2px;
}
.mfa-method-bar.is-active {
  border-color: var(--c-btnPrimary);
  background: #eef7fd;
  color: #0f172a;
}
.mfa-method-bar.is-active .material-icons { color: #1d4ed8; }
[data-theme="dark"] .mfa-method-bar.is-active {
  background: #0b2a4a;
  color: #e2ecff;
}
[data-theme="dark"] .mfa-method-bar.is-active .material-icons { color: #93c5fd; }
.mfa-method-bar:disabled { opacity: .6; cursor: not-allowed; }

/* MFA enroll modal tweaks */
.login-card:has(#enrollBox) { gap: 14px; }
.login-card:has(#enrollBox) .login-form { display: none; }
#enrollBox #qrWrap { margin-top: 12px; }
#enrollBox #qrWrap + .form-group { margin-top: 12px; }
#enrollBox .form-group > label[data-i18n="login.2fa"] { display: block; margin-top: 14px; }
#enrollBox #btnConfirmEnroll { display: block; margin-top: 14px; margin-left: auto; }

/* ==========================================================================
   Notifications
   ========================================================================== */

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-item { border-bottom: 1px solid var(--c-border); cursor: pointer; outline: none; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:focus-visible { box-shadow: inset 0 0 0 2px #2563eb33; }

.notif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}

.notif-title {
  font-weight: 600;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-item.unread .notif-title { font-weight: 700; }

.notif-meta { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.notif-meta small { color: var(--c-muted); }
.notif-content { color: var(--c-note); }

.notif-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.notif-ic { width: 18px; text-align: center; flex: 0 0 18px; }

.notif-content {
  overflow: hidden;
  max-height: 0;
  transition: max-height .25s ease;
  background: var(--c-bg-soft);
  border-top: 1px solid var(--c-border);
}
.notif-content-inner {
  padding: 12px 16px;
  color: var(--c-note);
  line-height: 1.45;
  white-space: pre-wrap;
}
.notif-item.open .notif-content { max-height: 800px; }

/* Notification badge bubble (generic) */
.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #EF4444;
  color: #fff;
  font-size: 12px; line-height: 18px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}

/* =========================
   Staff module
   ========================= */
.page--staff .staff-grid {
  display: grid;
  /* Stack panes vertically below each other */
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.page--staff .drag-col,
.page--staff .drag-handle { width: 28px; padding-left: 6px; padding-right: 0; }
.page--staff .drag-handle { cursor: grab; opacity: .55; user-select: none; }
.page--staff .drag-handle:hover { opacity: 1; }
.page--staff .drag-handle .material-icons { font-size: 20px; vertical-align: middle; }
.page--staff tr.is-dragging { opacity: .45; }
.page--staff .staff-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.page--staff .staff-card > header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
  font-weight: 600; color: var(--c-text);
}

/* Use API admin “pane” behaviours */
.page--staff .api-pane .pane-body { display:block; }
.page--staff .api-pane .pane-selected { 
  display:none;
  border-top: 1px solid var(--c-border);
  padding: 10px 12px;
  cursor: pointer;
}
.page--staff .api-pane.collapsed .pane-body { display:none; }
.page--staff .api-pane.collapsed .pane-selected { display:block; }

.page--staff #tblMem th.status-col { text-align: center; }
.page--staff #tblMem td.member-status-cell { text-align: center; }
.page--staff #tblMem .member-status-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 120px;
}
.page--staff #tblMem .member-status-toggle { margin: 0; }
.page--staff #tblMem .member-status-toggle-label,
.page--staff #tblMem .member-status-text {
  font-weight: 600;
}
.page--staff #tblMem .member-status-text.is-inactive,
.page--staff #tblMem .member-status-toggle-label.is-inactive {
  color: var(--c-muted);
}
.page--staff #tblMem .member-status-text.is-active,
.page--staff #tblMem .member-status-toggle-label.is-active {
  color: var(--st-published);
}

/* Tablet: in Staff Members toolbar, keep role label on first row and keep all member inputs on one row */
@media (min-width: 701px) and (max-width: 1024px) {
  .page--staff #paneMem .tm-toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 10px;
    align-items: center;
  }

  .page--staff #paneMem .tm-toolbar > .staff-role-inline {
    grid-column: 1 / -1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .page--staff #paneMem .tm-toolbar > #mName,
  .page--staff #paneMem .tm-toolbar > #mEmail,
  .page--staff #paneMem .tm-toolbar > .phone-active-row {
    grid-column: auto;
    width: 100%;
  }

  .page--staff #paneMem .tm-toolbar > .phone-active-row {
    grid-column: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
  }

  .page--staff #paneMem .tm-toolbar > .phone-active-row > #mPhone {
    width: 100%;
    min-width: 0;
  }

  .page--staff #paneMem .tm-toolbar > .phone-active-row > .switch {
    justify-self: end;
  }

  .page--staff #paneMem .tm-toolbar > #mAdd {
    grid-column: 3;
    justify-self: end;
  }

  .page--staff #paneMem .tm-toolbar > .phone-active-row > .switch,
  .page--staff #paneMem .tm-toolbar > #mAdd {
    width: fit-content;
  }

  .page--staff #paneMem .tm-toolbar > .phone-active-row > .switch .slider { background: #e5e7eb; }
  .page--staff #paneMem .tm-toolbar > .phone-active-row > .switch input:checked + .slider { background: #3092D0; }

  .page--staff #tblMem tr.__inlineEditor .sp-edit-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
  }

  .page--staff #tblMem tr.__inlineEditor .member-status-content {
    grid-column: 2;
    justify-self: end;
  }

  .page--staff #tblMem tr.__inlineEditor .sp-edit-actions {
    grid-column: 3;
    justify-self: end;
  }
}

/* Sticky action columns for Staff tables on phones */
@media (max-width: 700px) {
  .page--staff {
    padding-left: 0;
    padding-right: 0;
    overflow: auto;
  }

  .page--staff .appbar {
    position: sticky;
    top: 0;
    z-index: 905;
  }

  .page--staff > h2 {
    position: sticky;
    top: 57px;
    z-index: 904;
    margin: 0;
    padding: 10px 16px;
    background: var(--c-bg);
    border-bottom: 1px solid var(--c-border);
  }

  .page--staff .staff-grid {
    overflow: visible;
    padding: 12px 0 16px;
    min-height: auto;
  }

  .page--staff .staff-card > header {
    margin-left: 0;
    margin-right: 0;
    padding-left: 16px;
    padding-right: 16px;
  }

  .page--staff #paneMem .tm-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: center;
  }

  .page--staff #paneMem .tm-toolbar > .staff-role-inline,
  .page--staff #paneMem .tm-toolbar > #mName,
  .page--staff #paneMem .tm-toolbar > #mEmail,
  .page--staff #paneMem .tm-toolbar > .phone-active-row {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .page--staff #paneMem .tm-toolbar > .phone-active-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
  }

  .page--staff #paneMem .tm-toolbar > .phone-active-row > #mPhone {
    width: 100%;
    min-width: 0;
  }

  .page--staff #paneMem .tm-toolbar > .phone-active-row > .switch {
    justify-self: end;
  }

  .page--staff #paneMem .tm-toolbar > #mAdd {
    grid-column: 2;
    justify-self: end;
  }

  #tblCat, #tblRole, #tblMem { min-width: 0; table-layout: fixed; }

  /* Make role/member rows look like settings category list items on mobile */
  #tblCat tbody td:first-child .linklike {
    display: block;
    width: 100%;
    text-align: left;
  }

  #tblRole tbody td:first-child .linklike,
  #tblMem tbody td:first-child strong {
    display: block;
    width: 100%;
    text-align: left;
  }

  #tblRole tbody td:first-child,
  #tblMem tbody td:first-child {
    border: 1px solid var(--c-border);
    border-radius: 10px;
    border-bottom: 0;
    background: var(--c-bg);
    padding: 10px 12px;
  }
  
  #tblRole tbody td:first-child .linklike,
  #tblMem tbody td:first-child strong {
    font-weight: 600;
  }
  #tblMem tbody td:first-child .tm-note {
    margin-top: 4px;
    line-height: 1.35;
  }

  #tblCat td.td-actions, #tblCat th.td-actions,
  #tblRole td.td-actions, #tblRole th.td-actions,
  #tblMem  td.td-actions, #tblMem  th.td-actions {
    position: sticky; right: 0; z-index: 2;
  }

  #tblCat thead th.td-actions,
  #tblRole thead th.td-actions,
  #tblMem thead th.td-actions {
    z-index: 6;
  }

  #tblCat th.td-actions, #tblRole th.td-actions, #tblMem th.td-actions {
    background: var(--c-tableHeader);
  }

  #tblCat td.td-actions, #tblRole td.td-actions, #tblMem td.td-actions {
    background: var(--c-card);
    padding-right: 10px;
  }
  #tblCat td.td-actions,
  #tblCat th.td-actions {
    border-left: 0;
  }
  #tblCat .td-actions, #tblRole .td-actions { min-width: 88px; width: 88px; }
  #tblMem .td-actions { min-width: 64px; width: 64px; }
  #tblMem th:first-child,
  #tblMem td:first-child { width: auto; min-width: 0; }
  #tblMem th.td-actions,
  #tblMem td.td-actions {
    width: 60px;
    min-width: 60px;
    max-width: 64px;
  }
  #tblMem thead th.td-actions { background: var(--c-tableHeader); }
  #tblCat .td-actions .icon-btn,
  #tblRole .td-actions .icon-btn,
  #tblMem .td-actions .icon-btn { width: 32px; height: 32px; min-width: 32px; min-height: 32px; }
  /* Reserve space so sticky actions don't overlap first text cell */
  #tblRole td:first-child, #tblCat td:first-child, #tblMem td:first-child {
    padding-right: 88px;
  }
  #tblMem td:first-child { padding-right: 88px; }

  .page--staff #tblMem th.status-col,
  .page--staff #tblMem td.member-status-cell { display: none; }

  .page--staff #tblMem tr.__inlineEditor td.hide-sm { display: table-cell; }
  .page--staff #tblMem tr.__inlineEditor td.hide-sm .tm-input,
  .page--staff #tblMem tr.__inlineEditor td.hide-sm .tm-select {
    width: 100%;
  }
  .page--staff #tblMem tr.__inlineEditor .member-status-content {
    justify-content: flex-end;
    align-self: center;
  }

  .page--staff #tblMem tr.__inlineEditor .sp-edit-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .page--staff #tblMem tr.__inlineEditor .sp-edit-grid > #em_name,
  .page--staff #tblMem tr.__inlineEditor .sp-edit-grid > #em_role,
  .page--staff #tblMem tr.__inlineEditor .sp-edit-grid > #em_email,
  .page--staff #tblMem tr.__inlineEditor .sp-edit-grid > .em-phone-status {
    grid-column: 1 / -1;
    width: 100%;
  }

  .page--staff #tblMem tr.__inlineEditor .sp-edit-grid > .em-phone-status {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
  }

  .page--staff #tblMem tr.__inlineEditor .sp-edit-grid > .em-phone-status .member-status-content {
    justify-content: flex-end;
  }

  .page--staff #tblMem tr.__inlineEditor .sp-edit-grid > .sp-edit-actions {
    grid-column: 1 / -1;
  }

  .page--staff #tblMem tr.__inlineEditor .sp-edit-actions {
    justify-content: flex-end;
  }

  .page--staff #tblMem tr.__inlineEditor .td-actions,
  .page--staff #tblMem th.td-actions {
    display: none;
  }
  .page--staff #tblMem tr.__inlineEditor td:first-child { padding-right: 12px; }

  .page--staff #tblRole tr.__inlineEditor td:first-child,
  .page--staff #tblMem tr.__inlineEditor td:first-child {
    border-radius: 10px;
    border: 1px solid var(--c-border);
    background: var(--c-bg);
    padding: 10px 12px;
  }
  .page--staff #tblMem th.td-actions,
  .page--staff #tblMem td.td-actions {
    width: 60px;
    min-width: 60px;
  }
}

/* Anchor badge to sidebar bottom Notifications item */
.menu_bottom .menu_item[data-i18n="menu.notifications"] { position: relative; }
.menu_bottom .menu_item[data-i18n="menu.notifications"] .notif-badge { top: -4px; right: -4px; }

/* ==========================================================================
   News editor split view
   ========================================================================== */

.tm-toolbar--wrap {
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.tm-toolbar--wrap .toolbar-block {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.nw-editor-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .nw-editor-grid { grid-template-columns: 1fr; }
}

.nw-photo-picker {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.nw-photo-thumb {
  width: 140px;
  height: 96px;
  border-radius: 10px;
  border: 1px solid var(--c-border);
  background-size: cover;
  background-position: center;
  background-color: var(--c-bg-soft);
  position: relative;
  flex: 0 0 auto;
}
.nw-photo-thumb.is-placeholder {
  background-image: none !important;
  border-style: dashed;
}
.nw-photo-thumb.is-placeholder::after {
  content: attr(data-placeholder);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  color: var(--c-muted);
  padding: 0 12px;
  text-align: center;
}
.nw-photo-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nw-preview {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 12px;
}
.nw-preview-card {
  background: var(--c-card);
  border-radius: 16px;
  border: 1px solid var(--c-border);
  box-shadow: 0 8px 18px rgba(2, 6, 23, .06);
  overflow: hidden;
  transition: transform .15s ease;
}
.nw-preview-card:hover {
  transform: translateY(-3px);
}
.nw-preview-img {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  background-color: var(--c-bg-soft);
}
.nw-preview-img.is-placeholder::after {
  content: attr(data-placeholder);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-muted);
  font-size: .9rem;
  background-image: linear-gradient(135deg, rgba(148,163,184,.12) 25%, transparent 25%, transparent 50%, rgba(148,163,184,.12) 50%, rgba(148,163,184,.12) 75%, transparent 75%, transparent);
  background-size: 20px 20px;
}
.nw-preview-head { font-weight: 600; margin-bottom: 6px; }
.nw-preview-meta {
  padding: 10px 14px 0;
  color: var(--c-muted);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nw-preview-title {
  margin: 0;
  padding: 4px 14px 16px;
  font-size: 18px;
  color: var(--c-text);
}
.nw-preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nw-preview-tags.empty {
  color: var(--c-muted);
}
.nw-preview-body {
  line-height: 1.5;
  word-wrap: break-word;
  padding: 0 12px 12px;
}

.nw-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.nw-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nw-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(59, 130, 246, .12);
  color: var(--c-text);
  font-size: .85rem;
}
.nw-tag-chip .material-icons {
  font-size: 16px;
}
.nw-tag-remove {
  border: none;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.nw-tag-placeholder {
  color: var(--c-muted);
  font-size: .85rem;
}
.nw-row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.nw-cat-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-card);
}
.nw-cat-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, .15);
  color: #047857;
  font-size: .75rem;
}
.nw-cat-pill {
  color: var(--c-muted);
}

.nw-select-head {
  text-align: center;
  width: 42px;
  padding: 0;
}
.nw-select-cell {
  text-align: center;
  width: 42px;
}
.nw-title-cell {
  display: flex;
  gap: 10px;
  align-items: stretch;
  min-width: 0;
}
.nw-title-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  justify-content: center;
}
.nw-title-body .linklike,
.nw-title-body > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nw-row-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.nw-row-tags-wrap {
  width: 100%;
}

.nw-row-actions-mobile {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
}

.nw-audit {
  margin-top: 16px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: var(--c-card);
  padding: 12px;
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.nw-audit-head {
  font-weight: 600;
  margin-bottom: 10px;
}
.nw-audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nw-audit-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  font-size: .9rem;
}
.nw-audit-action { font-weight: 600; }
.nw-audit-meta { color: var(--c-muted); }
.nw-audit-detail {
  font-size: .85rem;
  color: var(--c-text);
  background: var(--c-bg-soft);
  border-radius: 6px;
  padding: 6px 8px;
}

/* TinyMCE chrome theming to match cards/borders */
.tox-tinymce { border-radius: var(--radius) !important; border: 1px solid var(--c-border) !important; }
[data-theme="dark"] .tox .tox-toolbar,
[data-theme="dark"] .tox .tox-menubar,
[data-theme="dark"] .tox .tox-statusbar { background: var(--c-card); }

/* ==========================================================================
   Modals (theme-aware)
   ========================================================================== */

.modal-shell {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(17,24,39,.45);
  z-index: 9999; padding: 16px;
}
[data-theme="dark"] .modal-shell { background: rgba(0,0,0,.6); }

.modal-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  width: min(560px, 96vw);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  overflow: hidden;
  font-family: var(--font-ui);
}

.modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-body { padding: 16px; }

/* Theme fix for legacy inline-styled modals (IDs used elsewhere) */
#clubFormModal,
#teamModal,
#apiProviderModal,
#apEpModal,
#apParModal,
#userFormModal,
#notificationsModal { background: rgba(17,24,39,.45); }
[data-theme="dark"] #clubFormModal,
[data-theme="dark"] #teamModal,
[data-theme="dark"] #apiProviderModal,
[data-theme="dark"] #apEpModal,
[data-theme="dark"] #apParModal,
[data-theme="dark"] #userFormModal,
[data-theme="dark"] #notificationsModal { background: rgba(0,0,0,.6); }

#clubFormModal > [role="dialog"],
#teamModal > [role="dialog"],
#apiProviderModal > [role="dialog"],
#apEpModal > [role="dialog"],
#apParModal > [role="dialog"],
#userFormModal > [role="dialog"],
#notificationsModal > [role="dialog"] {
  background: var(--c-card) !important;
  border: 1px solid var(--c-border) !important;
  color: var(--c-text);
}
#clubFormModal > [role="dialog"] > div:first-child,
#teamModal > [role="dialog"] > div:first-child,
#apiProviderModal > [role="dialog"] > div:first-child,
#apEpModal > [role="dialog"] > div:first-child,
#apParModal > [role="dialog"] > div:first-child,
#userFormModal > [role="dialog"] > div:first-child,
#notificationsModal > [role="dialog"] > div:first-child {
  border-bottom: 1px solid var(--c-border) !important;
  background: var(--c-card);
  color: var(--c-text);
}

/* ==========================================================================
   Scrollbar styling (table wraps & modals)
   ========================================================================== */

@supports (scrollbar-color: auto) {
  .tm-table-wrap,
  .modal-card,
  .club-settings-scroll {
    scrollbar-color: var(--c-border) transparent; /* Firefox */
  }
}
.tm-table-wrap::-webkit-scrollbar,
.modal-card::-webkit-scrollbar,
.club-settings-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.tm-table-wrap::-webkit-scrollbar-track,
.modal-card::-webkit-scrollbar-track,
.club-settings-scroll::-webkit-scrollbar-track { background: transparent; }
.tm-table-wrap::-webkit-scrollbar-thumb,
.modal-card::-webkit-scrollbar-thumb,
.club-settings-scroll::-webkit-scrollbar-thumb {
  background-color: var(--c-border);
  border-radius: 999px;
  border: 2px solid var(--c-card);
}

/* ==========================================================================
   Badges & small utilities
   ========================================================================== */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e5f6ed;
  color: #065f46;
  font-size: 12px;
  line-height: 1.4;
}
.badge.warn { background: #fee2e2; color: #991b1b; }

/* Club Users — stacked name/email on mobile */
.us-name-cell .us-nm { font-weight: 600; color: var(--c-text); }
.us-name-line {
  display: flex;
  align-items: center;
  gap: 4px;
}
.us-name-line .us-preview { flex: 0 0 auto; }
.us-name-cell .us-audit-link {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}
#usAudit [hidden] { display: none; }
.page--users #usAdd[hidden] { display: none; }
#usAudit td:first-child { white-space: nowrap; }
#usAudit .us-audit-scroll { max-height: 55vh; overflow: auto; overscroll-behavior: contain; }
#usAudit .us-audit-scroll thead th { position: sticky; top: 0; background: var(--c-bg, #fff); z-index: 1; }
#usAudit .us-audit-filters { flex-wrap: wrap; align-items: end; }
#usAudit .us-audit-filters label { display: grid; gap: 4px; }
#usAudit summary { cursor: pointer; }
#usAudit dl { white-space: normal; min-width: 220px; max-width: 480px; }
#usAudit dd { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
#usAudit dt { font-weight: 600; }
#usAudit .us-audit-preview { max-width: 320px; white-space: normal; overflow-wrap: anywhere; }
#userFormModal [data-password-result][hidden] { display: none; }
.us-name-cell .us-email-sm { font-size: 12px; color: var(--c-muted); margin-top: 2px; }

.nw-title-cell {
  /* Let the status dot sit next to a truncating text block */
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;            /* allow children to shrink */
  white-space: nowrap;
  overflow: hidden;
}
/* The colored bar should not shrink */
.nw-title-cell .nw-status-bar { flex: 0 0 auto; }
/* The actual title text/link should truncate with an ellipsis */
.nw-title-cell .linklike,
.nw-title-cell > span:not(.nw-status-bar) {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nw-status-bar {
  display: block;
  width: 4px;
  border-radius: 2px;
  align-self: stretch;
  margin-block: 4px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
}
.nw-status--published { background: var(--st-published); }
.nw-status--concept   { background: var(--st-concept); }
.nw-status--declined  { background: var(--st-declined); }
.nw-status--archived  { background: var(--c-muted); }
.nw-status--unknown   { background: #9ca3af; }

.show-sm { display: none; }

/* Button that looks like a link for row titles */
.linklike {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.linklike:focus-visible { outline: 2px solid var(--c-btnPrimary); outline-offset: 2px; }

/* Rights UI: each right on its own row under the module */
#uf_rights_body .right-row td:first-child { width: 24px; }
#uf_rights_body .right-row td { background: var(--c-bg-soft); }
#uf_rights_body .right-label { font-weight: 600; }
#uf_rights_body .right-desc { margin-top: 2px; }

/* ===== User Edit → Userrights table (no horizontal scroll on mobiles) ===== */
/* Base: allow the table to shrink within the modal */
#uf_rights_tbl { 
  min-width: 0;                 /* override global 780px */
  table-layout: fixed;          /* predictable widths on small screens */
}
#uf_rights_tbl td, #uf_rights_tbl th {
  white-space: normal;          /* allow wrapping */
  word-break: break-word;
  overflow-wrap: anywhere;
}
/* Ensure header stays above any sticky body cells and has an opaque bg */
#uf_rights_tbl thead th {
  position: sticky;             /* reaffirm sticky and layering for this table */
  top: 0;
  z-index: 8;                   /* higher than body cells */
  background: var(--c-tableHeader);
  box-shadow: 0 1px 0 0 var(--c-border); /* subtle divider below header */
}
/* Keep the toggle column narrow and aligned right */
#uf_rights_tbl .td-actions {
  text-align: right;
  width: 64px;
  min-width: 64px;
  white-space: nowrap;          /* switches don't wrap */
}
/* Body right column should never overdraw the header */
#uf_rights_tbl td.td-actions { z-index: 3; }
#uf_rights_tbl th.td-actions { z-index: 9; }  /* header cell above body cells */

@media (max-width: 700px) {
  /* Pin the toggle column so sliders remain visible while content scrolls vertically */
  #uf_rights_tbl td.td-actions,
  #uf_rights_tbl th.td-actions {
    position: sticky;
    right: 0;
    background: var(--c-card);
  }
  /* Header already has higher z-index globally; keep separation on mobile too */
  #uf_rights_tbl thead th { z-index: 10; }  /* ensure it wins on small screens */

  /* Prevent sticky toggles from overlapping text in the previous column */
  #uf_rights_tbl td:nth-child(2) {
    padding-right: 72px;        /* ≈ toggle col + small gap */
  }

  /* Module name cell: allow wrapping, but keep it readable */
  #uf_rights_tbl td:first-child {
    max-width: none;
    width: auto;
    min-width: 0;
  }
}

/* ==========================================================================
   Responsiveness
   ========================================================================== */

/* <= 1024px: hide medium breakpoint columns */
@media (max-width: 1024px) {
  .tm-table th.hide-md,
  .tm-table td.hide-md {
    display: none;
  }
}

/* <= 900px: mobile shell & drawer nav */
@media (max-width: 900px) {
  /* Mobile app bar */
  .appbar {
    position: sticky;
    top: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
    background-color: var(--c-card); /* keep header fully opaque while content scrolls under it */
    border-bottom: 1px solid var(--c-border);
    background-clip: padding-box;
    /* Make the bar full-bleed inside the padded .content scroller. */
    margin-left: -16px;
    margin-right: -16px;
    padding-left: calc(12px + 16px);
    padding-right: calc(12px + 16px);
  }

  /* Fill the dynamic iOS safe-area row above the buttons with the same opaque color. */
  .appbar::before {
    content: "";
    position: absolute;
    top: calc(-1 * env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    height: env(safe-area-inset-top, 0px);
    background: var(--c-card);
    pointer-events: none;
  }
  .appbar-title { display: none; }

  .appbar .nav-toggle,
  .appbar .nav-bell {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 36px;
    border: 1px solid var(--c-iconBtnBorder);
    background: var(--c-iconBtnBg);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
    line-height: 1;
    color: var(--c-text);
  }
  .appbar .nav-bell { margin-left: auto; }
  .appbar .nav-bell .material-icons { font-size: 20px; }
  .appbar .nav-toggle:hover,
  .appbar .nav-bell:hover {
    background: var(--c-hover);
    border-color: var(--c-iconBtnBorder);
  }

  .page--teams > h2 {
    top: 57px;
  }

  .page--api-admin > h2 {
    top: 57px;
  }

  /* Content no longer reserves sidebar space */
  .content {
    margin-left: 0;
    padding-top: 0;
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 16px;
    overflow: auto;
  }

  /*
   * Website modules already use a dedicated body container under the app bar.
   * Keep scrolling inside that body so content does not bleed around the bar.
   */
  .content > .appbar + .website-module-layout {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }

  /* Bottom actions: icon group */
  .menu_bottom {
    margin-top: auto;
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
  }
  .menu_bottom .menu_item {
    width: auto; margin: 0; padding: 8px;
    height: auto; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    min-width: 44px; min-height: 44px;
  }
  .menu_bottom .menu_item span { display: none; }
  .menu_bottom .menu_icon { font-size: 24px; vertical-align: middle; }

  /* Sidebar becomes an overlay drawer */
  .navigation {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(82vw, 320px);
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    transform: translateX(-100%);
    transition: transform .25s ease-in-out;
    z-index: 1001;
    background: var(--c-card);
    border-right: 1px solid var(--c-border);
    box-sizing: border-box;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  body.nav-open { overflow: hidden; }
  body.nav-open .navigation { transform: translateX(0); }

  /* Backdrop behind the nav */
  .nav-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 1000;
    display: none;
  }
  body.nav-open .nav-backdrop { display: block; }
}

/* Make Club Settings scroll affordance visible on touch layouts */
@media (max-width: 1024px) {
  .club-settings-scroll {
    overflow-y: scroll;
  }

  @supports (scrollbar-gutter: stable) {
    .club-settings-scroll {
      scrollbar-gutter: stable;
    }
  }
}

/* <= 900px: KV tables render as stacked "cards" */
@media (max-width: 900px) {
  .tm-table.tm-kv thead { display: none; }
  .tm-table.tm-kv tr {
    display: block;
    padding: 10px 12px;
    border-bottom: 1px solid var(--c-border);
  }
  .tm-table.tm-kv td {
    display: block;
    border: 0;
    padding: 2px 0;
  }
  .tm-table.tm-kv td:first-child {
    font-size: 12px;
    line-height: 1.2;
    color: var(--c-muted);
    letter-spacing: 0.02em;
  }
  .tm-table.tm-kv td:last-child {
    font-size: 16px;
    line-height: 1.35;
    color: var(--c-text);
    margin-top: 2px;
    text-align: left; /* values stack under labels on mobile */
  }
  .tm-table.tm-kv .td-actions { padding-top: 6px; }
  .settings-page .settings-kv tbody td:first-child { width: auto; }
  .settings-page .settings-section__title {
    padding-inline: 10px;
  }
  .settings-page .settings-actions {
    padding-inline: 10px;
  }

  /* News editor: make the Title input span the full available width on mobile */
  #nwTitle { width: 100%; }
}

/* Tablets (~900-1024px): hide medium-priority columns */
@media (max-width: 1024px) and (min-width: 901px) {
  .tm-table th.hide-md, .tm-table td.hide-md { display: none; }

  /* Website templates table on tablet: show name + actions only */
  #admTpl th.hide-sm,
  #admTpl td.hide-sm {
    display: none;
  }
  #admTpl {
    min-width: 0;
    table-layout: fixed;
  }
  #admTpl th:first-child,
  #admTpl td:first-child {
    width: calc(100% - 72px);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #admTpl td.td-actions,
  #admTpl th.td-actions {
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--c-card);
  }
  #admTpl td.td-actions { box-shadow: -8px 0 8px rgba(0,0,0,.05); }
  #admTpl th.td-actions { z-index: 3; }
  #admTpl .td-actions { width: 72px; min-width: 72px; }
}

  /* Website menu table on tablet: keep actions fully visible */
  #wmTbl { min-width: 0; table-layout: fixed; }
  #wmTbl td:first-child,
  #wmTbl th:first-child {
    width: calc(100% - 84px);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #wmTbl td.td-actions,
  #wmTbl th.td-actions {
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--c-card);
  }
  #wmTbl td.td-actions { box-shadow: -8px 0 8px rgba(0,0,0,.05); }
  #wmTbl th.td-actions { z-index: 3; }
  #wmTbl .td-actions { width: 84px; min-width: 84px; }

/* <= 700px: compact toolbars & hide some table columns */
@media (max-width: 700px) {

  /* Club → Instellingen: full-width inputs on mobile */
  #clubBody .tm-input,
  #clubBody .tm-select,
  #clubBody textarea.tm-input {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
  }

  .page--teams .tm-pagination {
    justify-content: space-between;
    row-gap: 10px;
  }
  .page--clubs .tm-pagination {
    justify-content: space-between;
    row-gap: 10px;
  }
  .page--news .tm-pagination {
    justify-content: space-between;
    row-gap: 10px;
  }
  .page--users .tm-pagination {
    justify-content: space-between;
    row-gap: 10px;
  }

  .page--teams .tm-pagination__size {
    order: -1;
    width: 100%;
    justify-content: flex-start;
  }
  .page--clubs .tm-pagination__size {
    order: -1;
    width: 100%;
    justify-content: flex-start;
  }
  .page--news .tm-pagination__size {
    order: -1;
    width: 100%;
    justify-content: flex-start;
  }
  .page--users .tm-pagination__size {
    order: -1;
    width: 100%;
    justify-content: flex-start;
  }

  .page--teams .tm-pagination__nav {
    margin-left: auto;
  }

  .page--teams .tm-table-wrap {
    max-height: min(42dvh, 320px);
  }

  .page--teams .tm-pagination {
    position: sticky;
    bottom: 0;
    z-index: 6;
    background: var(--c-bg);
    padding: 6px 0 2px;
  }

  .page--clubs .tm-pagination__nav {
    margin-left: auto;
  }
  .page--news .tm-pagination__nav {
    margin-left: auto;
  }
  .page--users .tm-pagination__nav {
    margin-left: auto;
  }

  .uploads-pagination {
    justify-content: flex-end;
  }

  .uploads-pagination .tm-pagination__size {
    width: auto;
    justify-content: flex-end;
    margin-left: auto;
    order: 2;
  }

  .tm-toolbar > .tm-input,
  .tm-toolbar > .tm-select {
    flex: 1 1 180px;
  }
  .page--teams .tm-toolbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
  }
  .page--teams .tm-select--sport {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .page--teams .tm-sync-btn { justify-self: end; }
  .page--staff .tm-toolbar > .switch,
  .page--staff .tm-toolbar > .tm-btn {
    flex: 0 0 auto;
  }
  .tm-table th.hide-sm, .tm-table td.hide-sm { display: none; }
  /* Title cell keeps the colored dot on mobile; status column is hidden */

  /* Users table: keep name readable and actions compact on mobile */
  #usTbl { min-width: 0; table-layout: fixed; }
  #usTbl th:first-child,
  #usTbl td:first-child {
    min-width: 0;
  }
  #usTbl .us-nm,
  #usTbl .us-email-sm {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #usTbl td.td-actions, #usTbl th.td-actions {
    position: sticky; right: 0; z-index: 2; background: var(--c-card);
  }
  #usTbl td.td-actions { box-shadow: -8px 0 8px rgba(0,0,0,.05); }
  #usTbl th.td-actions { z-index: 3; }
  #usTbl .td-actions { width: 106px; min-width: 106px; padding-left: 4px; padding-right: 4px; }
  #usTbl .td-actions .icon-btn { width: 30px; height: 30px; min-width: 30px; min-height: 30px; }

  .show-sm { display: block; }

  /* API endpoints table: keep Code + Actions visible without horizontal scroll */
  #apEpTbl { min-width: 0; table-layout: fixed; }
  #apEpTbl th:first-child,
  #apEpTbl td:first-child {
    width: calc(100% - 92px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #apEpTbl td.td-actions,
  #apEpTbl th.td-actions {
    position: sticky;
    right: 0;
    z-index: 1;
    background: var(--c-card);
  }
  #apEpTbl thead th { z-index: 5; }
  #apEpTbl th.td-actions { z-index: 6; }
  #apEpTbl .td-actions { width: 84px; min-width: 84px; }
  #apEpTbl .td-actions .icon-btn { width: 32px; height: 32px; min-width: 32px; min-height: 32px; }
  #apEpTbl th.hide-sm, #apEpTbl td.hide-sm { display: none; }
  #apProvTbl { min-width: 0; table-layout: fixed; }
  #apProvTbl th:nth-child(2), #apProvTbl td:nth-child(2) {
    width: calc(100% - 92px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #apProvTbl .td-actions { width: 84px; min-width: 84px; }

  /* Clubs table: allow wrap + pinned actions */
  #clubsTable { min-width: 0; table-layout: auto; }
  #clubsTable td:not(.td-actions),
  #clubsTable th:not(.td-actions) {
    white-space: normal; word-break: break-word; overflow-wrap: anywhere;
  }
  #clubsTable td.td-actions, #clubsTable th.td-actions {
    position: sticky; right: 0; z-index: 2; background: var(--c-card);
  }
  #clubsTable td.td-actions { box-shadow: -8px 0 8px rgba(0,0,0,.05); }
  #clubsTable th.td-actions { z-index: 3; }
  #clubsTable .td-actions { min-width: 92px; }

  /* Teams table: keep actions visible on mobile */
  #tmTbl { min-width: 560px; table-layout: fixed; }
  #tmTbl td.td-actions, #tmTbl th.td-actions {
    position: sticky; right: 0; z-index: 2; background: var(--c-card);
  }
  #tmTbl td.td-actions { box-shadow: -8px 0 8px rgba(0,0,0,.05); }
  #tmTbl th.td-actions { z-index: 3; }
  /* Slimmer actions column so it doesn't eat content */
  #tmTbl .td-actions { min-width: 104px; }
  /* Slightly smaller icon buttons inside actions on mobile */
  #tmTbl .td-actions .icon-btn { width: 32px; height: 32px; min-width: 32px; min-height: 32px; }

  /* Website templates table: keep edit/delete actions visible on phones */
  #admTpl { min-width: 560px; table-layout: fixed; }
  #admTpl td.td-actions, #admTpl th.td-actions {
    position: sticky; right: 0; z-index: 2; background: var(--c-card);
  }
  #admTpl td.td-actions { box-shadow: -8px 0 8px rgba(0,0,0,.05); }
  #admTpl th.td-actions { z-index: 3; }
  #admTpl .td-actions { width: 72px; min-width: 72px; }
  #admTpl .td-actions .icon-btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
  }
  /* Website menu table: keep edit/delete actions visible and reachable */
  #wmTbl { min-width: 500px; table-layout: fixed; }
  #wmTbl td.td-actions, #wmTbl th.td-actions {
    position: sticky; right: 0; z-index: 2; background: var(--c-card);
  }
  #wmTbl td.td-actions { box-shadow: -8px 0 8px rgba(0,0,0,.05); }
  #wmTbl th.td-actions { z-index: 3; }
  #wmTbl .td-actions { width: 84px; min-width: 84px; }
  #wmTbl .td-actions .icon-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }
  /* Keep title visible when sticky actions are pinned on the right */
  #wmTbl td:first-child {
    max-width: none;
    width: auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 92px; /* actions width + breathing room */
  }

  /* Prevent the sticky actions cell from covering the team name:
     reserve space on the name cell and truncate with ellipsis */
  #tmTbl td:nth-child(2) {
    /* Let some of the title be visible and cut off with … at the end */
    max-width: none;         /* allow the column to occupy remaining space */
    width: auto;
    min-width: 0;            /* enable shrinking within fixed-layout tables */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 110px; /* ≈ actions min-width + a tiny gap */
  }

  /* News table: stack meta + actions below the title on phones */
  #newsTbl { min-width: 0; table-layout: fixed; }
  #newsTbl td.td-actions,
  #newsTbl th.td-actions {
    display: none;
  }
  #newsTbl .td-actions { width: auto; min-width: 0; }
  .nw-row-meta {
    gap: 8px;
    margin-top: 4px;
  }
  .nw-row-tags-wrap { display: none; }
  .nw-row-tags { display: none; }
  .nw-row-actions-mobile {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  /* Hide text labels in buttons on very small screens if needed */
  .btn-label { display: none; }

  /* Sports table (Club → Settings): mobile-friendly layout */
  #spTbl { min-width: 0; table-layout: fixed; } /* fit viewport */
  #spTbl col.sp-col-sport { width: 74%; }
  #spTbl col.sp-col-provider { width: 0; }
  #spTbl col.sp-col-client { width: 0; }
  #spTbl col.sp-col-actions { width: 26%; }
  #spTbl td.td-actions, #spTbl th.td-actions {
    position: sticky;
    right: 0;
    z-index: 1;
    text-align: right;
    vertical-align: middle;
    background: var(--c-card);
  }
  #spTbl td.td-actions {
    box-shadow: -8px 0 8px rgba(0,0,0,.05);
  }
  #spTbl thead th.td-actions {
    z-index: 3;
    background: var(--c-tableHeader);
  }
  #spTbl thead th.td-actions {
    background: var(--c-tableHeader);
  }
  /* Match tablet/desktop action column sizing */
  #spTbl .td-actions { width: 108px; min-width: 108px; }
  #spTbl .td-actions .icon-btn {
    width: 32px; height: 32px; min-width: 32px; min-height: 32px;
  }
  #spTbl tbody td {
    padding-top: 12px;
    padding-bottom: 12px;
  }
  /* While editing on phones: hide the list so only the form is visible */
  #spTbl.has-editor thead,
  #spTbl.has-editor tbody tr:not(.sp-edit-row) { display: none; }
  /* (extra safety if has-editor isn't applied yet) hide the host row */
  #spTbl tr[aria-expanded="true"] { display: none; }

  /* Sport name: allow 2-line truncation (avoid single-letter + …) */
  #spTbl td:first-child,
  #spTbl .sp-sport {
    max-width: none; width: auto; min-width: 0;
    white-space: normal;                    /* wrap allowed */
    display: -webkit-box;                   /* multi-line clamp */
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;                  /* up to 2 lines */
    line-clamp: 2;
    overflow: hidden;
    padding-right: 84px; /* keep clear of sticky actions */
  }

  /* ===== Licenses: LIST table ===== */
  #licTbl { min-width: 0; table-layout: fixed; }
  #licTbl td.td-actions,
  #licTbl th.td-actions {
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--c-card);
  }
  /* Exactly two icon buttons wide on phones */
  #licTbl .td-actions { width: 76px; min-width: 76px; }
  #licTbl .td-actions .icon-btn { width: 32px; height: 32px; min-width: 32px; min-height: 32px; }
  /* Truncate long names; reserve space so sticky actions don't overlap */
  #licTbl td:first-child {
    max-width: none; width: auto; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    padding-right: 84px; /* ≈ actions width + small gap */
  }

  /* ===== Licenses: EDIT view → Modules table ===== */
  #licModsTbl { min-width: 0; table-layout: fixed; }
  #licModsTbl td.td-actions,
  #licModsTbl th.td-actions {
    position: sticky;
    right: 0;
    background: var(--c-card);
  }
  /* Body cells (with sliders) should slide UNDER the sticky header */
  #licModsTbl td.td-actions { z-index: 2; }
  /* Header stays on top of the sticky right column */
  #licModsTbl thead th { z-index: 5; }
  /* Align the "Activated" column header to the right */
  #licModsTbl th.td-actions { text-align: right; }
  /* Keep the toggle column narrow; override inline min-width on <th> */
  #licModsTbl .td-actions { width: 64px !important; min-width: 64px !important; }
  #licModsTbl th.td-actions { width: 64px !important; min-width: 64px !important; }
  /* Let module names wrap to two lines and avoid hiding behind sticky toggle */
  #licModsTbl td:first-child {
    max-width: none; width: auto; min-width: 0;
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    padding-right: 72px;               /* ≈ toggle col + small gap */
  }
}

/* Sports editor helper title (shown on small screens) */
.sp-edit-title { font-weight: 600; color: var(--c-muted); line-height: 1.25; }

/* ==========================================================================
   Dashboard
   ========================================================================== */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr); /* 6-track grid → 50% = span 3, 33% = span 2 */
  gap: 12px;
  align-items: start;
}
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: repeat(4, 1fr); }
  /* On 4 cols, both sizes collapse to span 2 for a tidy 2-column layout */
  .dash-grid .w-3 { grid-column: span 2; }
  .dash-grid .w-2 { grid-column: span 2; }
}
@media (max-width: 700px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-grid .w-3, .dash-grid .w-2 { grid-column: span 1; }
}
/* Base spans for ≥1100px (6 col) */
.dash-grid .w-3 { grid-column: span 3; } /* 50% */
.dash-grid .w-2 { grid-column: span 2; } /* 33% */

.dash-widget { min-width: 0; }
.dash-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dash-card-head {
  padding: 10px 12px;
  /* Make room for the top-right hide icon so it doesn't feel cramped
     against the header text/border. */
  padding-right: 56px;   /* ≈ icon 36px + gap */
  position: relative;    /* anchor for any absolute children if needed */
  border-bottom: 1px solid var(--c-border);
  font-weight: 600;
  color: var(--c-text);
}
.dash-card-body { padding: 12px; }

/* Drag affordances */
.dash-grid.editing .dash-card { cursor: move; }
.dash-widget.dragging .dash-card { opacity: .7; }

/* Per-card 'Hide' button shown only in edit mode (top-right overlay) */
.dash-hide-btn {
  position: absolute;
  /* Nudge slightly away from the header's bottom border and edges */
  top: 6px;
  right: 10px;
  z-index: 2;
}
.dash-grid:not(.editing) .dash-hide-btn { display: none !important; }
.dash-card { position: relative; } /* anchor the overlay */
/* Website formulieren module alignment with backoffice look-and-feel */
.forms-card {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-card);
  padding: 12px;
}
.forms-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.forms-toolbar .tm-input,
.forms-toolbar .tm-select { flex: 1 1 220px; }
.forms-toolbar[hidden],
#formsGlobalMail[hidden],
#formsSecurity[hidden] { display: none !important; }

#wfTbl code {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  font-size: 12px;
}

@media (max-width: 1024px) and (min-width: 901px) {
  #wfTbl { min-width: 0; table-layout: fixed; }
  #wfTbl td:first-child,
  #wfTbl th:first-child {
    width: calc(100% - 124px);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #wfTbl .td-actions { width: 124px; min-width: 124px; }
}

@media (max-width: 700px) {
  #wfTbl { min-width: 420px; table-layout: fixed; }
  #wfTbl td.td-actions, #wfTbl th.td-actions {
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--c-card);
  }
  #wfTbl td.td-actions { box-shadow: -8px 0 8px rgba(0,0,0,.05); }
  #wfTbl th.td-actions { z-index: 3; }
  #wfTbl .td-actions { width: 124px; min-width: 124px; }
  #wfTbl .td-actions .icon-btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
  }
}
/* Website formulieren editor */
.forms-tabs { display:flex; gap:8px; flex-wrap:wrap; }
.forms-tab-btn { border:1px solid var(--c-border); background:var(--c-bg-soft); }

.forms-builder-shell {
  border: 1px solid var(--c-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, var(--c-card) 0%, var(--c-bg-soft) 100%);
}
.forms-inline-controls { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.forms-option-row { flex-wrap:nowrap; gap:10px; align-items:center; padding:4px 0; }
.forms-option-input { flex:1 1 auto; min-width:0; }
.forms-option-delete { flex:0 0 auto; width:30px; height:30px; min-width:30px; min-height:30px; padding:0; display:inline-flex; align-items:center; justify-content:center; margin-left:4px; }
.forms-option-delete .material-icons { font-size:18px; line-height:1; }
.forms-inline-controls .tm-select { flex:1 1 200px; }
.forms-required-cell,
.forms-type-cell { vertical-align:middle; }
.forms-required-toggle { display:inline-flex; align-items:center; justify-content:center; padding:0; min-height:36px; width:100%; }
.forms-layout-table tr.is-options-field .forms-required-cell,
.forms-layout-table tr.is-options-field .forms-type-cell { vertical-align:top; padding-top:8px; }
.forms-layout-table tr.is-options-field .forms-required-toggle { align-items:flex-start; }
.forms-actions-col { width:72px !important; }
.forms-actions-cell { width:72px; vertical-align:middle; text-align:center; display:flex; align-items:center; justify-content:center; gap:6px; min-height:36px; }
.forms-drag-handle { cursor:grab; width:30px; height:30px; min-width:30px; min-height:30px; display:inline-flex; align-items:center; justify-content:center; }
.forms-actions-cell .icon-btn,
.forms-option-delete { width:30px; height:30px; min-width:30px; min-height:30px; padding:0; display:inline-flex; align-items:center; justify-content:center; }
.forms-actions-cell .material-icons,
.forms-option-delete .material-icons { font-size:18px; line-height:1; }
.forms-drag-handle:active { cursor:grabbing; }
.js-field-row.is-dragging { opacity:.45; }
.js-field-row.drag-over { outline:2px dashed var(--c-btnPrimary); outline-offset:-2px; }
.forms-tab-btn.active { background: var(--c-btnPrimary); color: var(--c-btnPrimaryText); box-shadow:0 0 0 2px rgba(48,146,208,0.2); }
.forms-editor-layout { display:grid; grid-template-columns:1fr; gap:16px; min-width:0; }
.forms-editor-layout > * { min-width:0; }
.form-builder-grid .builder-links { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.field-list { display:grid; gap:8px; }
.field-row { display:grid; grid-template-columns:1.2fr 1.2fr auto auto; gap:8px; align-items:center; }
.mail-settings-grid { display:grid; gap:10px; }
.forms-preview { border:1px solid var(--c-border); border-radius:10px; background:var(--c-bg-soft); padding:12px; }
.forms-preview-window { display:grid; gap:10px; background:var(--c-card); border-radius:10px; border:1px solid var(--c-border); padding:12px; }
.forms-preview-window input,.forms-preview-window select,.forms-preview-window textarea { width:100%; padding:8px; border:1px solid var(--c-border); border-radius:6px; background:var(--c-card); color:var(--c-text); }
.forms-preview-window label { display:block; }
.forms-preview-window .forms-checkbox { display:flex; align-items:center; justify-content:flex-start; gap:6px; }
.forms-preview-window .forms-checkbox input { width:auto; margin:0; flex:0 0 auto; }
.forms-preview.is-hidden { display:none; }
.preview-inline { display:flex; align-items:center; gap:8px; }
@media (min-width:1024px){ .forms-editor-layout { grid-template-columns:minmax(0,1fr) 540px; } }
.forms-tab-content{display:grid;gap:12px;max-width:760px}.forms-global-mail__box{border:1px solid var(--c-border);padding:12px;border-radius:10px;margin:10px 0}
.forms-tab-content--stack { max-width: 900px; }
.forms-global-mail__head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.forms-global-mail__details { margin-top: 10px; }
.forms-panel .forms-tab-content label { font-weight: 600; }
.forms-layout-table { width:100%; border-collapse:separate; border-spacing:0 8px; table-layout:fixed; }
#fieldsEditor { overflow-x:auto; }
#fieldsEditor .forms-layout-table { min-width:680px; }
.forms-layout-table th { width:220px; text-align:left; vertical-align:top; font-weight:600; padding:6px 10px 6px 0; }
.forms-layout-table td { padding:0; }
.forms-layout-table .tm-input, .forms-layout-table .tm-select, .forms-layout-table textarea { width:100%; }
#fieldsEditor .forms-layout-table th:nth-child(3),
#fieldsEditor .forms-layout-table td.forms-required-cell { width:68px; text-align:center; }
#fieldsEditor .forms-layout-table th:nth-child(4),
#fieldsEditor .forms-layout-table td.forms-type-cell { width:110px; }
.forms-preview-window select option { padding:8px 10px; }
.forms-editor-actions { justify-content:flex-end; flex-wrap:wrap; }
.builder-links { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
#fieldsEditor { margin-top: 6px; }
.forms-tab-content--stack .forms-layout-table th { width: 180px; }
.forms-layout-table th textarea.tm-input { min-height:36px; }
.forms-preview-window .tm-btn.primary { width:auto; justify-self:start; }
@media (max-width: 900px){
  .forms-layout-table, .forms-layout-table tbody, .forms-layout-table tr, .forms-layout-table th, .forms-layout-table td { display:block; width:100%; }
  .forms-layout-table th { padding:6px 0; }
  .forms-layout-table tr { margin-bottom:8px; }
  .forms-editor-actions .tm-btn { flex:1 1 140px; }
  .forms-tabs .tm-btn { flex:1 1 calc(50% - 8px); }
}

.page-editor__side .forms-layout-table { table-layout:auto; }
@media (max-width: 1280px){
  .page-editor__side .forms-layout-table,
  .page-editor__side .forms-layout-table tbody,
  .page-editor__side .forms-layout-table tr,
  .page-editor__side .forms-layout-table th,
  .page-editor__side .forms-layout-table td { display:block; width:100%; }
  .page-editor__side .forms-layout-table th { padding:6px 0 4px; }
  .page-editor__side .forms-layout-table td { padding:0; }
}
.tm-btn--with-icon{display:inline-flex;align-items:center;justify-content:center;gap:6px}
.tm-btn--with-icon .material-icons{font-size:18px;line-height:1}
.page-editor{display:grid;grid-template-columns:minmax(0,2fr) minmax(280px,1fr);gap:16px;width:100%;min-width:0}
.page-editor__main,.page-editor__side{min-width:0;background:var(--panel-bg,#fff);border:1px solid var(--border,#ddd);border-radius:12px;padding:12px}
.page-editor__side{position:sticky;top:8px;height:max-content}
@media (min-width: 768px){
  .page-editor__main{max-height:calc(100vh - 120px);overflow-y:auto;overscroll-behavior:contain}
  #p_html{min-height:220px!important}
  .page-editor__main .tox.tox-tinymce{height:340px!important}
  .page-editor__main .tox-edit-area{min-height:0;overflow:hidden}
  .page-editor__main .tox-edit-area iframe{height:100%!important}
}
.page-editor__main{display:flex;flex-direction:column;gap:14px}
.pe-section{border:1px solid var(--border,#ddd);border-radius:10px;overflow:hidden;background:var(--panel-bg,#fff)}
.pe-section__head{display:flex;align-items:center;gap:8px;margin:0;padding:8px 12px;font-size:.95rem;font-weight:600;background:rgba(0,0,0,.05);border-bottom:1px solid var(--border,#ddd);border-left:4px solid var(--primary,#1976d2)}
.pe-section__head .material-icons{font-size:18px}
.pe-section__body{padding:12px}
.pe-section.sidebar-editor{padding:0}
.pe-section.sidebar-editor .sidebar-editor__head{padding:8px 12px;background:rgba(0,0,0,.05);border-bottom:1px solid var(--border,#ddd);border-left:4px solid var(--primary,#1976d2)}
.pe-section.sidebar-editor #p_widgets{padding:12px}
html[data-theme="dark"] .pe-section{background:#1c1f24;border-color:#3a3f48}
html[data-theme="dark"] .pe-section__head,html[data-theme="dark"] .pe-section.sidebar-editor .sidebar-editor__head{background:rgba(255,255,255,.06);border-color:#3a3f48}
@media (max-width: 980px){.page-editor{grid-template-columns:1fr}.page-editor__side{position:static}}
html[data-theme="dark"] .page-editor__main,html[data-theme="dark"] .page-editor__side{background:#1c1f24;border-color:#3a3f48}
/* Website → Design: inline help tooltip for template settings */
.website-options-message {
  margin-top: 8px;
  min-height: 1.4em;
}

.setting-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.setting-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.setting-help__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--c-iconBtnBorder);
  background: var(--c-iconBtnBg);
  color: var(--c-muted);
  font-size: 20px;
  line-height: 1;
  cursor: help;
}

.setting-help__bubble {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: min(280px, 70vw);
  padding: 8px 10px;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  background: var(--c-card);
  box-shadow: var(--shadow);
  color: var(--c-text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}

.setting-help:hover .setting-help__bubble,
.setting-help:focus-visible .setting-help__bubble,
.setting-help:focus-within .setting-help__bubble {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.forms-shortcode-copy {
  cursor: pointer;
  -webkit-user-select: all;
  user-select: all;
}
.forms-shortcode-copy.is-copied {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
}
/* Website → Forms: keep form-element editor rows horizontal on tablet. */
@media (max-width: 900px) {
  #fieldsEditor {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #fieldsEditor .forms-layout-table,
  #fieldsEditor .forms-layout-table tbody,
  #fieldsEditor .forms-layout-table thead,
  #fieldsEditor .forms-layout-table tr,
  #fieldsEditor .forms-layout-table th,
  #fieldsEditor .forms-layout-table td {
    display: revert;
  }

  #fieldsEditor .forms-layout-table {
    display: table;
    min-width: 680px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0 8px;
  }

  #fieldsEditor .forms-layout-table thead { display: table-header-group; }
  #fieldsEditor .forms-layout-table tbody { display: table-row-group; }
  #fieldsEditor .forms-layout-table tr { display: table-row; margin-bottom: 0; }
  #fieldsEditor .forms-layout-table th,
  #fieldsEditor .forms-layout-table td {
    display: table-cell;
    width: auto;
    padding: 6px 8px;
    vertical-align: middle;
  }

  #fieldsEditor .forms-layout-table th:first-child,
  #fieldsEditor .forms-layout-table td:first-child { width: 28%; }
  #fieldsEditor .forms-layout-table th:nth-child(2),
  #fieldsEditor .forms-layout-table td:nth-child(2) { width: auto; }
  #fieldsEditor .forms-layout-table th:nth-child(3),
  #fieldsEditor .forms-layout-table td.forms-required-cell { width: 68px; }
  #fieldsEditor .forms-layout-table th:nth-child(4),
  #fieldsEditor .forms-layout-table td.forms-type-cell { width: 110px; }
  #fieldsEditor .forms-layout-table th.forms-actions-col,
  #fieldsEditor .forms-layout-table td.forms-actions-cell { width: 72px; }

  #fieldsEditor .forms-layout-table td.forms-actions-cell {
    display: table-cell;
    text-align: center;
    white-space: nowrap;
  }
}

/* Website → Pages: tablet table keeps actions visible without horizontal scrolling. */
@media (max-width: 1024px) {
  #wpTbl {
    min-width: 0;
    table-layout: fixed;
  }

  #wpTbl th:nth-child(1),
  #wpTbl td:nth-child(1) { width: 42%; }
  #wpTbl th:nth-child(2),
  #wpTbl td:nth-child(2) { width: 34%; }
  #wpTbl th:nth-child(3),
  #wpTbl td:nth-child(3) { width: calc(24% - 88px); }
  #wpTbl th.td-actions,
  #wpTbl td.td-actions {
    width: 88px;
    min-width: 88px;
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--c-card);
  }
  #wpTbl th.td-actions { z-index: 3; }
  #wpTbl td.td-actions { box-shadow: -8px 0 8px rgba(0,0,0,.05); }

  #wpTbl td,
  #wpTbl th {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
/* Website → Forms: central security settings */
.forms-security__box {
  border: 1px solid var(--c-border);
  padding: 12px;
  border-radius: 10px;
  margin: 10px 0;
  background: var(--c-card);
  color: var(--c-text);
}
.forms-security__details { margin-top: 10px; }
.forms-security-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}
.forms-security-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  align-content: start;
  font-weight: 600;
}
.forms-security-field--wide { grid-column: 1 / -1; }
.forms-security-field .tm-input,
.forms-security-field .tm-select { width: 100%; min-width: 0; }
.forms-security-field small,
.forms-secret-status {
  color: var(--c-muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}
.forms-security-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--c-text);
  font-weight: 500;
}
.forms-security-check input { margin: 0; }
.forms-security-warning {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--c-warning, #f59e0b) 45%, var(--c-border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--c-warning, #f59e0b) 14%, var(--c-card));
  color: var(--c-text);
}
.forms-security-field.is-hidden { display: none; }
html[data-theme="dark"] .forms-security__box { background: var(--c-card); border-color: var(--c-border); }
html[data-theme="dark"] .forms-security-warning { background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .4); }
@media (max-width: 900px) {
  .forms-security-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .forms-global-mail__head { align-items: flex-start; flex-direction: column; }
  .forms-security__box { padding: 10px; }
}
/* Synchronization module */
.sync-page .tm-page-head p{color:var(--c-muted);margin-top:.25rem}.sync-toolbar{gap:.65rem;flex-wrap:wrap}.sync-toolbar .tm-input{min-width:220px}.sync-table-wrap{overflow:visible}.sync-table{width:100%;table-layout:fixed}.sync-table th,.sync-table td{white-space:normal;overflow-wrap:anywhere;word-break:break-word}.sync-table th:nth-child(1){width:17%}.sync-table th:nth-child(2),.sync-table th:nth-child(3),.sync-table th:nth-child(4),.sync-table th:nth-child(5){width:10%}.sync-table th:nth-child(6),.sync-table th:nth-child(7){width:12%}.sync-table th:nth-child(8){width:9%}.sync-table th:nth-child(9){width:10%}.sync-table .td-actions{white-space:normal}.sync-status{display:inline-flex;align-items:center;border-radius:999px;padding:.2rem .55rem;background:var(--c-surface);border:1px solid var(--c-border);font-size:.85rem}.sync-status--success{color:#16803a}.sync-status--failed{color:#b42318}.sync-status--running{color:#0b64c0}.sync-status--cancelled{color:#b45309}.sync-editor{margin:1rem 0}.sync-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}.sync-form-grid label{display:flex;flex-direction:column;gap:.35rem}.sync-form-grid .span-2,.sync-next-preview{grid-column:1/-1}.sync-param-fieldset{border:1px solid var(--c-border);border-radius:12px;padding:1rem;background:var(--c-surface)}.sync-editor-section{background:var(--c-card)}.sync-param-fieldset legend{padding:0 .35rem;font-weight:700}.sync-param-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}.sync-param-grid small{color:var(--c-muted);line-height:1.35}.sync-param-grid em{color:#b42318;font-style:normal}.sync-check{flex-direction:row!important;align-items:center;padding:.65rem;border:1px solid var(--c-border);border-radius:10px;background:var(--c-card)}.sync-log-detail{white-space:pre-wrap;max-height:320px;overflow:auto;background:var(--c-surface);color:var(--c-text);border:1px solid var(--c-border);border-radius:10px;padding:1rem}.sync-log-row{cursor:pointer}.sync-log-row:hover,.sync-log-row:focus-within,.sync-log-row.is-selected{background:color-mix(in srgb,var(--c-primary) 8%,transparent)}.sync-log-arrow-cell,.sync-log-arrow-head{width:44px;text-align:center}.sync-log-arrow{transition:transform .15s ease,color .15s ease}.sync-log-row:hover .sync-log-arrow{color:var(--c-primary);transform:translateX(4px)}.sync-log-row.is-selected .sync-log-arrow{color:var(--c-primary);transform:rotate(90deg)}.sync-action{position:relative;overflow:visible}.sync-action::after{content:attr(data-tooltip);position:absolute;z-index:35;left:50%;bottom:calc(100% + 8px);width:max-content;max-width:min(260px,70vw);padding:.45rem .6rem;border:1px solid var(--c-border);border-radius:8px;background:var(--c-card);box-shadow:var(--shadow);color:var(--c-text);font-size:.78rem;font-weight:400;line-height:1.35;white-space:normal;text-align:left;transform:translateX(-50%) translateY(4px);opacity:0;pointer-events:none;transition:opacity .15s ease,transform .15s ease}.sync-action:hover::after,.sync-action:focus-visible::after{opacity:1;transform:translateX(-50%) translateY(0)}
@media (max-width: 760px){.sync-toolbar>*{width:100%}.sync-form-grid,.sync-param-grid{grid-template-columns:1fr}.sync-table thead{display:none}.sync-table,.sync-table tbody,.sync-table tr,.sync-table td{display:block;width:100%}.sync-table tr{border:1px solid var(--c-border);border-radius:14px;margin:.75rem 0;padding:.65rem;background:var(--c-card)}.sync-table td{border:0!important;display:flex;justify-content:space-between;gap:1rem;padding:.45rem .25rem}.sync-table td::before{content:attr(data-label);font-weight:600;color:var(--c-muted)}.sync-table .td-actions{justify-content:flex-end;flex-wrap:wrap}.sync-table .td-actions::before{width:100%;text-align:left}}.sync-page{max-height:calc(100vh - 96px);overflow:auto;padding-right:.25rem}.sync-table-wrap{overflow:auto}.sync-fetch-url{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:.75rem}.sync-fetch-url label{min-width:0}.sync-fetch-url input[readonly]{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:.85rem}.sync-inline-control{display:flex;gap:.5rem}.sync-inline-control .tm-input{min-width:0}.sync-form-grid label.is-disabled{opacity:.55}.sync-form-grid label.is-disabled input{cursor:not-allowed}.sync-create-modal,.sync-cron-modal{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;padding:1rem;background:rgba(15,23,42,.45)}.sync-create-dialog,.sync-cron-dialog{width:min(760px,96vw);max-height:90vh;overflow:auto;border:1px solid var(--c-border);border-radius:16px;background:var(--c-card);box-shadow:var(--shadow);padding:1.25rem}.sync-duplicate-select{display:flex;flex-direction:column;gap:.35rem;margin:1rem 0}.sync-cron-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}.sync-cron-section{margin:1rem 0}.sync-cron-chips{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.5rem}.sync-cron-chip{border:1px solid var(--c-border);border-radius:999px;background:var(--c-surface);color:var(--c-text);padding:.35rem .65rem;cursor:pointer}.sync-cron-chip.active{background:var(--c-primary);border-color:var(--c-primary);color:#fff}
@media (max-width: 760px){.sync-fetch-url,.sync-cron-grid{grid-template-columns:1fr}.sync-page{max-height:none;overflow:visible}}
/* Club synchronization: keep the jobs grid within the card and avoid an empty
   scrollable gutter after the actions column. */
@media (min-width: 761px) {
  .sync-table-wrap {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .sync-table {
    max-width: 100%;
  }

  .sync-table th:nth-child(9),
  .sync-table td:nth-child(9) {
    width: 168px;
    min-width: 168px;
    max-width: 168px;
    box-sizing: border-box;
  }

  .sync-table .td-actions {
    white-space: nowrap;
  }
}
.sync-markers{display:flex;flex-wrap:wrap;gap:.35rem;margin-top:.35rem}
.sync-marker{display:inline-flex;align-items:center;gap:.25rem;border:1px solid var(--c-border);border-radius:999px;padding:.12rem .45rem;font-size:.75rem;font-weight:700;line-height:1.2;background:var(--c-surface);color:var(--c-muted)}
.sync-marker .material-icons{font-size:1rem}
.sync-marker--admin{border-color:#f59e0b;color:#92400e;background:#fffbeb}
.sync-marker--sequence{border-color:#60a5fa;color:#1d4ed8;background:#eff6ff}
.sync-readonly-note{display:inline-flex;align-items:center;border:1px solid var(--c-border);border-radius:999px;padding:.25rem .55rem;color:var(--c-muted);font-size:.8rem}
.sync-param-fieldset>summary{display:flex;align-items:center;gap:.35rem;cursor:pointer;font-weight:700;list-style:none}
.sync-param-fieldset>summary::-webkit-details-marker{display:none}
.sync-param-fieldset>summary::before{content:"expand_more";font-family:"Material Icons";font-size:1.25rem;line-height:1;transition:transform .15s ease}
.sync-param-fieldset:not([open])>summary::before{transform:rotate(-90deg)}
.sync-param-fieldset:not([open]){padding-bottom:1rem}
.sync-param-fieldset>summary+.sync-param-grid{margin-top:1rem}.sidebar-editor{margin-top:18px;border-top:1px solid var(--border,#ddd);padding-top:16px}.sidebar-editor__head{display:flex;align-items:center;justify-content:space-between}.sidebar-widget-row{display:grid;grid-template-columns:auto minmax(0,1fr) repeat(4,auto);gap:8px;align-items:center;border:1px solid var(--border,#ddd);border-radius:10px;padding:10px;margin-top:10px}.sidebar-widget-row small{display:block;color:var(--muted,#64748b)}
/* Club volunteers */
.volunteers-page{display:grid;gap:16px;max-width:1400px}.volunteers-page header p{color:var(--c-muted);margin:.25rem 0}.volunteers-page .card{background:var(--c-card);border:1px solid var(--c-border);border-radius:var(--radius);padding:16px;min-width:0}.vol-tabs,.vol-toolbar,.vol-pager,.vol-dialog-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.vol-toolbar{margin-bottom:14px}.vol-toolbar .tm-input{min-width:180px;flex:1}.vol-pager{justify-content:flex-end;margin-top:14px}.vol-table small{display:block;color:var(--c-muted);max-width:42ch;overflow-wrap:anywhere}.vol-modal{position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,.55);display:grid;place-items:center;padding:16px}.vol-dialog{width:min(720px,100%);max-height:calc(100vh - 32px);overflow:auto;background:var(--c-card);color:var(--c-text);border:1px solid var(--c-border);border-radius:12px;padding:20px;box-shadow:var(--shadow)}.vol-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.vol-form-grid label{display:grid;gap:6px}.vol-form-grid .vol-span{grid-column:1/-1}.vol-check{display:flex!important;align-items:center}.vol-dialog-actions{justify-content:flex-end;margin-top:18px}.vol-message{color:var(--st-declined);min-height:1.5em;margin-top:8px}
@media(max-width:700px){.vol-form-grid{grid-template-columns:1fr}.vol-form-grid .vol-span{grid-column:auto}.vol-toolbar>*{width:100%}.vol-pager{justify-content:space-between}.vol-table thead{display:none}.vol-table,.vol-table tbody,.vol-table tr,.vol-table td{display:block;width:100%}.vol-table tr{border-bottom:1px solid var(--c-border);padding:8px 0}.vol-table td{border:0!important;padding:6px 4px!important}.vol-table td:before{content:attr(data-label);display:block;color:var(--c-muted);font-size:.8rem;font-weight:600}.tm-table-wrap{overflow-x:visible}}
/* Sponsor manager: intentionally module-scoped. */
.sp-admin .tm-toolbar h2{margin:0 auto 0 0}.sp-admin-logo{width:90px;height:44px;object-fit:contain}.sp-admin-form{max-width:1050px}.sp-admin-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.sp-admin-fields label,.sp-admin-form fieldset>label{display:flex;flex-direction:column;gap:5px}.sp-admin-fields .sp-wide{grid-column:1/-1}.sp-admin-fields .sp-check{flex-direction:row;align-items:center}.sp-admin-form fieldset{margin:18px 0;padding:16px;border:1px solid var(--border-color,#d8dee8);border-radius:10px}.sp-admin-form fieldset>label{display:inline-flex;margin:7px 18px 7px 0}.sp-admin-form textarea{min-height:120px}@media(max-width:700px){.sp-admin-fields{grid-template-columns:1fr}}.sp-admin-form .sp-media{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.sp-admin-form .sp-media-field{display:grid;grid-template-rows:auto 130px auto;gap:8px;margin:0}.sp-media-preview{display:flex;align-items:center;justify-content:center;min-width:0;padding:8px;border:1px solid var(--border-color,#d8dee8);border-radius:8px;background:var(--c-surface,#f8fafc)}.sp-media-preview img{display:block;width:100%;height:100%;object-fit:contain}.sp-media-preview.is-empty{color:var(--c-muted,#64748b)}.sp-media-preview.is-empty .material-icons{font-size:36px}@media(max-width:700px){.sp-admin-form .sp-media{grid-template-columns:1fr}}
/* Sponsors: keep the header and save bar outside the scrolling content. */
.page--sponsors {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.page--sponsors > .appbar { flex: 0 0 auto; }
.page--sponsors .sp-admin {
  flex: 1 1 auto;
  height: auto;
  overflow: hidden;
}
.sp-admin-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--c-border);
  border-radius: 10px;
  background: var(--c-surface);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, .08);
}
.sp-admin-actions[hidden] { display: none; }
.sp-admin-actions .tm-actions { margin: 0; }
.sp-admin-actions #spMsg {
  flex: 1 1 200px;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.sp-filters{margin-top:16px;padding:16px;border:1px solid var(--border-color,#d8dee8);border-radius:10px}
.sp-filters h3{margin:0 0 12px;font-size:1rem}
.sp-filter-fields{display:flex;flex-wrap:wrap;gap:14px}
.sp-filter-fields .tm-input,.sp-filter-fields .tm-select{flex:1;min-width:180px}
.page--sponsors .drag-handle{width:28px;cursor:grab;opacity:.55;user-select:none}
.page--sponsors .drag-handle:hover{opacity:1}
.page--sponsors .drag-handle .material-icons{font-size:20px;vertical-align:middle}
.page--sponsors tr.is-dragging{opacity:.45}
#mfaDigits:not([hidden]) {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

#mfaDigits .tm-input {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  padding-inline: 0;
  text-align: center;
}

#twofaStep [hidden] {
  display: none;
}
.website-statistics { display: grid; gap: 14px; }
.traffic-summary, .traffic-breakdowns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 14px;
}
.traffic-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--c-border, #8885);
  border-radius: 12px;
}
.traffic-panel h3 { margin: 0 0 12px; }
.traffic-summary strong { display: block; font-size: 1.8rem; }
.traffic-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.traffic-controls label { display: grid; gap: 4px; }
.traffic-chart-wrap { overflow-x: auto; margin: 12px 0; }
.traffic-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.traffic-legend span { display: flex; align-items: center; gap: 6px; }
.traffic-legend i { width: 12px; height: 12px; border-radius: 2px; }
.traffic-chart { display: flex; gap: 8px; margin-top: 8px; min-width: max-content; }
.traffic-chart-group { flex: 1; min-width: 28px; text-align: center; }
.traffic-bars { display: flex; align-items: end; justify-content: center; height: 135px; gap: 3px; border-bottom: 1px solid currentColor; }
.traffic-bars span { width: clamp(7px, 1vw, 16px); border-radius: 3px 3px 0 0; }
.traffic-color-0 { background: #2674bd; }
.traffic-color-1 { background: #ca652d; }
.website-statistics .tm-table-wrap { overflow-x: auto; }
