/* ============================================================
   eMS v3 Admin — admin.css
   Sharp edges · dark palette · red accent
   ============================================================ */

:root {
  --black:      #0a0a0b;
  --surface:    #111114;
  --panel:      #18181d;
  --border:     #2a2a32;
  --silver:     #8b8b99;
  --light:      #d4d4dc;
  --white:      #f0f0f4;
  --red:        #cc0000;
  --red-glow:   #ff1a1a;
  --red-dim:    #660000;
  --blue-hi:    #2563a8;
  --green:      #27ae60;
  --yellow:     #f39c12;
  --header-h:   54px;
  --sidebar-w:  220px;
  --footer-h:   36px;
  --font-head:    Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
--font-display: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
--font-mono:    Consolas, 'Courier New', monospace;
--font-body:    Arial, Helvetica, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--black); color: var(--white); font-family: var(--font-body); }
a { color: inherit; text-decoration: none; }
button { background: none; border: none; cursor: pointer; font-family: inherit; }
img, svg { display: block; max-width: 100%; }

/* ── Shell ───────────────────────────────────────────────────────────────── */
.ap-shell {
  display: grid;
  grid-template-areas: "header header" "sidebar main" "footer footer";
  grid-template-rows: var(--header-h) 1fr var(--footer-h);
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.ap-header {
  grid-area: header;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 20px; position: relative; z-index: 200;
}
.ap-header__left, .ap-header__right { display: flex; align-items: center; gap: 14px; }

.ap-logo { display: flex; align-items: center; gap: 10px; }
.ap-logo__mark {
  width: 32px; height: 32px; background: var(--red);
  clip-path: polygon(0 0, 100% 0, 100% 70%, 70% 100%, 0 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 14px; color: #fff; letter-spacing: 1px; flex-shrink: 0;
}
.ap-logo__name { font-family: var(--font-head); font-size: 20px; letter-spacing: 3px; }
.ap-logo__name span { color: var(--red); }

.ap-env-badge { font-family: var(--font-mono); font-size: 9px; padding: 2px 7px; letter-spacing: 2px; }
.ap-env-badge--development { background: #1a2a1a; color: #4ade80; border: 1px solid #1a3a1a; }
.ap-env-badge--staging     { background: #2a1a00; color: var(--yellow); border: 1px solid #3a2a00; }

.ap-hdr-icon {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: var(--panel); border: 1px solid var(--border); font-size: 14px;
  position: relative; transition: border-color .15s;
}
.ap-hdr-icon:hover { border-color: var(--red); }
.ap-hdr-divider { width: 1px; height: 24px; background: var(--border); }

.ap-user-block { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.ap-user-block__name { font-size: 12px; font-weight: 700; }
.ap-user-block__role { font-family: var(--font-mono); font-size: 9px; color: var(--silver); letter-spacing: 1px; }
.ap-user-block__info { text-align: right; }

.ap-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--blue-hi), var(--red));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
}

.ap-user-menu {
  display: none; position: absolute; top: var(--header-h); right: 20px;
  background: var(--panel); border: 1px solid var(--border);
  min-width: 160px; z-index: 300; flex-direction: column;
}
.ap-user-menu.is-open { display: flex; }
.ap-user-menu a { padding: 10px 16px; font-size: 13px; color: var(--silver); transition: background .15s, color .15s; }
.ap-user-menu a:hover { background: var(--surface); color: var(--white); }
.ap-user-menu__divider { border-top: 1px solid var(--border); }
.ap-user-menu__logout { color: var(--red-glow) !important; }

.ap-hamburger { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 32px; height: 32px; padding: 4px; }
.ap-hamburger span { display: block; height: 2px; background: var(--silver); transition: all .25s; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.ap-sidebar {
  grid-area: sidebar; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; transition: transform .25s ease;
}
.ap-nav__section { padding: 16px 0 6px; }
.ap-nav__label-heading {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 3px;
  color: var(--silver); text-transform: uppercase;
  padding: 0 18px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.ap-nav__item {
  display: flex; align-items: center; gap: 10px; padding: 9px 18px;
  font-size: 13px; font-weight: 600; color: var(--silver); transition: all .15s; border-left: 2px solid transparent;
}
.ap-nav__item:hover { background: var(--panel); color: var(--white); border-left-color: var(--border); }
.ap-nav__item--active { background: var(--panel); color: var(--white); border-left-color: var(--red); }
.ap-nav__icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.ap-nav__label { flex: 1; }
.ap-nav__badge { font-family: var(--font-mono); font-size: 9px; background: var(--red-dim); color: var(--red-glow); padding: 2px 6px; }
.ap-nav__dot { width: 6px; height: 6px; background: var(--red); }

.ap-sidebar__footer { margin-top: auto; border-top: 1px solid var(--border); padding: 14px 18px; }
.ap-sys-status { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 9px; color: var(--silver); letter-spacing: 1px; margin-bottom: 4px; }
.ap-sys-status__dot { width: 6px; height: 6px; background: var(--green); flex-shrink: 0; }
.ap-sidebar__version { font-family: var(--font-mono); font-size: 9px; color: var(--silver); letter-spacing: 1px; }

/* ── Main ────────────────────────────────────────────────────────────────── */
.ap-main {
  grid-area: main; background: var(--black); overflow-y: auto; overflow-x: hidden;
  padding: 24px; display: flex; flex-direction: column; gap: 20px;
}

/* ── Notices ─────────────────────────────────────────────────────────────── */
.ap-notices { display: flex; flex-direction: column; gap: 8px; }
.ap-notice {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--panel); border: 1px solid var(--border); padding: 12px 16px;
  animation: ap-slide-in .3s ease;
}
.ap-notice--info    { border-left: 3px solid var(--blue-hi); }
.ap-notice--warning { border-left: 3px solid var(--yellow); }
.ap-notice--error   { border-left: 3px solid var(--red); }
.ap-notice--success { border-left: 3px solid var(--green); }
.ap-notice__icon    { font-size: 16px; flex-shrink: 0; padding-top: 1px; }
.ap-notice__body    { flex: 1; }
.ap-notice__title   { display: block; font-size: 13px; font-weight: 700; color: var(--white); margin-bottom: 2px; }
.ap-notice__message { font-size: 12px; color: var(--silver); }
.ap-notice__dismiss {
  font-family: var(--font-mono); font-size: 9px; color: var(--silver); letter-spacing: 1px;
  padding: 4px 8px; border: 1px solid var(--border); flex-shrink: 0; transition: border-color .15s, color .15s;
}
.ap-notice__dismiss:hover { border-color: var(--red); color: var(--red); }

/* ── Page Header ─────────────────────────────────────────────────────────── */
.ap-page-header { display: flex; align-items: flex-end; justify-content: space-between; }
.ap-page-title { font-family: var(--font-head); font-size: 36px; letter-spacing: 4px; line-height: 1; text-transform: uppercase;}
.ap-page-title span { color: var(--red); }
.ap-page-meta { font-family: var(--font-mono); font-size: 10px; color: var(--silver); text-align: right; line-height: 1.8; }
.ap-page-meta .accent { color: var(--red); }
.ap-breadcrumb { font-family: var(--font-mono); font-size: 10px; color: var(--silver); letter-spacing: 1px; margin-top: 6px; }

/* ── Section Headings ────────────────────────────────────────────────────── */
.ap-section-heading {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-head); font-size: 18px; letter-spacing: 3px; margin-bottom: 12px;
}
.ap-section-heading::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.ap-section-heading__icon {
  width: 28px; height: 28px; background: var(--red-dim); border: 1px solid var(--red-dim);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.ap-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ap-stat-card {
  background: var(--panel); border: 1px solid var(--border);
  padding: 18px 20px; position: relative; overflow: hidden; transition: border-color .2s;
}
.ap-stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.ap-stat-card--red::before    { background: var(--red); }
.ap-stat-card--blue::before   { background: var(--blue-hi); }
.ap-stat-card--silver::before { background: var(--silver); }
.ap-stat-card--green::before  { background: var(--green); }
.ap-stat-card:hover { border-color: var(--silver); }
.ap-stat-card__label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px; color: var(--silver); text-transform: uppercase; margin-bottom: 8px; }
.ap-stat-card__value { font-family: var(--font-head); font-size: 38px; letter-spacing: 2px; line-height: 1; }
.ap-stat-card__sub   { font-family: var(--font-mono); font-size: 10px; color: var(--silver); margin-top: 6px; }
.ap-stat-card__sub .up { color: var(--green); }
.ap-stat-card__sub .dn { color: var(--red-glow); }
.ap-stat-card__ghost  { font-family: var(--font-head); font-size: 72px; position: absolute; right: -8px; bottom: -14px; color: var(--border); line-height: 1; pointer-events: none; user-select: none; }

/* ── Modules ─────────────────────────────────────────────────────────────── */
.ap-module { background: var(--panel); border: 1px solid var(--border); display: flex; flex-direction: column; }
.ap-module__head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.ap-module__icon { width: 28px; height: 28px; background: var(--black); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.ap-module__icon--red { background: var(--red-dim); border-color: var(--red-dim); }
.ap-module__title  { font-family: var(--font-head); font-size: 16px; letter-spacing: 2px; }
.ap-module__action { margin-left: auto; font-family: var(--font-mono); font-size: 9px; color: var(--silver); letter-spacing: 1px; padding: 4px 10px; border: 1px solid var(--border); transition: all .15s; }
.ap-module__action:hover { border-color: var(--red); color: var(--red); }
.ap-module__body   { padding: 16px; flex: 1; }
.ap-module-grid       { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.ap-module-grid--wide { grid-template-columns: 2fr 1fr; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.ap-table { width: 100%; border-collapse: collapse; }
.ap-table th { font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px; color: var(--silver); text-transform: uppercase; padding: 0 0 10px; text-align: left; border-bottom: 1px solid var(--border); }
.ap-table td { font-size: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); color: var(--light); vertical-align: middle; }
.ap-table tr:last-child td { border-bottom: none; }
.ap-table tr:hover td { color: var(--white); }

.ap-tag { font-family: var(--font-mono); font-size: 9px; padding: 2px 7px; letter-spacing: 1px; display: inline-block; }
.ap-tag--webmaster { background: #1a0a2a; color: #c084fc; }
.ap-tag--admin     { background: var(--red-dim); color: var(--red-glow); }
.ap-tag--handler   { background: #1a2035; color: #60a5fa; }
.ap-tag--alumni    { background: #2a1a00; color: var(--yellow); }
.ap-tag--fan       { background: #1a1a1a; color: var(--silver); }

.ap-status-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; }
.ap-status-dot--on  { background: var(--green); }
.ap-status-dot--off { background: var(--silver); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.ap-footer {
  grid-area: footer; background: var(--surface); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; font-family: var(--font-mono); font-size: 9px; color: var(--silver); letter-spacing: 1px;
}
.ap-footer a:hover { color: var(--red); }
.ap-footer__build  { color: var(--red); }

/* ── Overlay ─────────────────────────────────────────────────────────────── */
.ap-sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 150; }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes ap-slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .ap-shell { grid-template-areas: "header" "main" "footer"; grid-template-columns: 1fr; grid-template-rows: var(--header-h) 1fr var(--footer-h); }
  .ap-sidebar { grid-area: unset; position: fixed; top: var(--header-h); left: 0; bottom: var(--footer-h); width: var(--sidebar-w); z-index: 160; transform: translateX(-100%); }
  .ap-sidebar.is-open { transform: translateX(0); }
  .ap-sidebar-overlay.is-open { display: block; }
  .ap-hamburger { display: flex; }
  .ap-stat-grid { grid-template-columns: 1fr 1fr; }
  .ap-module-grid, .ap-module-grid--wide { grid-template-columns: 1fr; }
  .ap-user-block__info { display: none; }
}
@media (max-width: 500px) {
  .ap-stat-grid { grid-template-columns: 1fr; }
  .ap-page-meta { display: none; }
  .ap-main { padding: 16px; gap: 14px; }
}

/* ── Logo image (when custom logo is set) ────────────────────────────────── */
.ap-logo__img {
  max-height: 36px;
  max-width: 160px;
  object-fit: contain;
  display: block;
}

/* ── Federation Switcher ─────────────────────────────────────────────────── */
.ap-fed-switcher {
    position: relative;
}
.ap-fed-switcher__current {
    display: flex; align-items: center; gap: 8px;
    background: var(--panel); border: 1px solid var(--border);
    padding: 6px 12px; cursor: pointer; transition: border-color .15s;
    height: 32px;
}
.ap-fed-switcher__current:hover { border-color: var(--red); }
.ap-fed-switcher__initials {
    font-family: var(--font-head); font-size: 14px; letter-spacing: 1px; color: var(--red);
}
.ap-fed-switcher__name {
    font-family: var(--font-mono); font-size: 10px; color: var(--light); letter-spacing: 1px;
}
.ap-fed-switcher__arrow {
    font-size: 10px; color: var(--silver); margin-left: 4px;
}
.ap-fed-switcher__dropdown {
    display: none; position: absolute; top: 100%; left: 0;
    background: var(--panel); border: 1px solid var(--border);
    min-width: 200px; z-index: 300; flex-direction: column;
    margin-top: 2px;
}
.ap-fed-switcher__dropdown.is-open { display: flex; }
.ap-fed-switcher__label {
    font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px;
    color: var(--silver); padding: 8px 14px 6px; border-bottom: 1px solid var(--border);
}
.ap-fed-switcher__item {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 10px 14px; font-size: 12px; font-weight: 600;
    color: var(--silver); background: none; border: none; cursor: pointer;
    text-align: left; transition: background .15s, color .15s;
    font-family: var(--font-body);
}
.ap-fed-switcher__item:hover { background: var(--surface); color: var(--white); }
.ap-fed-switcher__item--active { color: var(--white); border-left: 2px solid var(--red); }
.ap-fed-switcher__item-init {
    font-family: var(--font-head); font-size: 14px; color: var(--red); width: 28px;
}
.ap-fed-switcher__primary {
    margin-left: auto; font-family: var(--font-mono); font-size: 8px; letter-spacing: 1px;
    background: var(--red-dim); color: var(--red-glow); padding: 2px 6px;
}

/* ── Character pages ─────────────────────────────────────────────────────── */
.ch-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid var(--border);
}
.ch-row:last-of-type { border-bottom: none; }
.ch-info  { flex: 1; }
.ch-name  { font-size: 13px; font-weight: 600; color: var(--white); }
.ch-meta  { font-family: var(--font-mono); font-size: 9px; color: var(--silver); margin-top: 2px; }
.ch-remove {
    background: none; border: 1px solid var(--red-dim); color: var(--red-glow);
    font-family: var(--font-mono); font-size: 11px; padding: 3px 8px; cursor: pointer;
    transition: all .15s;
}
.ch-remove:hover { background: var(--red-dim); }
.ch-add-form { display: flex; gap: 6px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.ch-select { background: var(--black); border: 1px solid var(--border); color: var(--white); font-family: var(--font-mono); font-size: 11px; padding: 7px 10px; outline: none; flex: 1; min-width: 140px; }
.ch-select:focus { border-color: var(--red); }
.ch-add-btn { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; padding: 7px 14px; background: var(--red); color: #fff; border: none; cursor: pointer; white-space: nowrap; }
.ch-add-btn:hover { background: var(--red-glow); }
.ch-primary-wrap { display: flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 10px; color: var(--silver); cursor: pointer; }
.ch-primary-wrap input { accent-color: var(--red); }

/* Bio field toggle buttons */
.bf-toggle { font-family: var(--font-mono); font-size: 11px; padding: 4px 10px; border: none; cursor: pointer; transition: all .15s; }
.bf-toggle--on  { background: #1a2a1a; color: #4ade80; }
.bf-toggle--on:hover { background: #1a3a1a; }
.bf-toggle--off { background: var(--black); color: var(--border); border: 1px solid var(--border); }
.bf-toggle--off:hover { border-color: var(--silver); color: var(--silver); }

/* ── Sidebar Scrollbar ───────────────────────────────────────────────────── */
.ap-sidebar::-webkit-scrollbar {
    width: 4px;
}
.ap-sidebar::-webkit-scrollbar-track {
    background: var(--surface);
}
.ap-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
}
.ap-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--red);
}

/* Firefox */
.ap-sidebar {
    scrollbar-width: thin;
    scrollbar-color: #2a2a32 #111114;
}

/* ── Form fields — global dark theme ─────────────────────────────────────── */
.ue-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ue-field { display: flex; flex-direction: column; }
.ue-field--full { grid-column: 1 / -1; }
@media (max-width: 600px) { .ue-grid { grid-template-columns: 1fr; } .ue-field--full { grid-column: 1; } }

.ue-label  { display: block; font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px; color: var(--silver); text-transform: uppercase; margin-bottom: 4px; }
.ue-req    { color: var(--red); }
.ue-hint   { font-size: 11px; color: var(--silver); margin-bottom: 6px; line-height: 1.5; }

.ue-input, .ue-select, .ue-textarea {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 9px 12px;
    outline: none;
    transition: border-color .15s;
    -webkit-appearance: none;
    appearance: none;
}
.ue-input:focus, .ue-select:focus, .ue-textarea:focus { border-color: var(--red); }
.ue-input:disabled { opacity: .4; cursor: not-allowed; }
.ue-input::placeholder, .ue-textarea::placeholder { color: var(--silver); opacity: .6; }
.ue-select { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b8b99'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.ue-select option { background: var(--panel); color: var(--white); }
.ue-textarea { resize: vertical; min-height: 80px; font-family: var(--font-body); font-size: 13px; }
.ue-textarea--sm { min-height: 56px; }

.ue-toggle-wrap  { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ue-toggle-wrap input[type="checkbox"] { accent-color: var(--red); width: 15px; height: 15px; cursor: pointer; }
.ue-toggle-label { font-size: 13px; color: var(--light); }

.ue-layout { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
.ue-col    { display: flex; flex-direction: column; gap: 16px; }
.ue-col--side { }
@media (max-width: 900px) { .ue-layout { grid-template-columns: 1fr; } .ue-col--side { order: -1; } }

.ue-btn { width: 100%; font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; padding: 11px; border: none; cursor: pointer; transition: all .15s; text-align: center; text-decoration: none; display: block; }
.ue-btn--primary   { background: var(--red); color: #fff; }
.ue-btn--primary:hover { background: var(--red-glow); }
.ue-btn--secondary { background: transparent; color: var(--silver); border: 1px solid var(--border); }
.ue-btn--secondary:hover { border-color: var(--red); color: var(--white); }

.ue-pw-wrap { display: flex; gap: 8px; }
.ue-input--pw { flex: 1; }
.ue-pw-gen { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; padding: 0 12px; background: var(--panel); border: 1px solid var(--border); color: var(--silver); cursor: pointer; white-space: nowrap; transition: all .15s; }
.ue-pw-gen:hover { border-color: var(--red); color: var(--white); }

.ue-meta-bar { display: flex; gap: 24px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); padding: 12px 20px; }
.ue-meta-item { display: flex; flex-direction: column; gap: 2px; }
.ue-meta-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px; color: var(--silver); }
.ue-meta-val   { font-family: var(--font-mono); font-size: 12px; color: var(--white); }

/* ── Character pages ─────────────────────────────────────────────────────── */
.ch-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.ch-row:last-of-type { border-bottom: none; }
.ch-info { flex: 1; }
.ch-name { font-size: 13px; font-weight: 600; color: var(--white); }
.ch-meta { font-family: var(--font-mono); font-size: 9px; color: var(--silver); margin-top: 2px; }
.ch-remove { background: none; border: 1px solid var(--red-dim); color: var(--red-glow); font-family: var(--font-mono); font-size: 11px; padding: 3px 8px; cursor: pointer; transition: all .15s; }
.ch-remove:hover { background: var(--red-dim); }
.ch-add-form { display: flex; gap: 6px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.ch-select { background: var(--panel); border: 1px solid var(--border); color: var(--white); font-family: var(--font-mono); font-size: 11px; padding: 7px 10px; outline: none; flex: 1; min-width: 140px; }
.ch-select:focus { border-color: var(--red); }
.ch-add-btn { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; padding: 7px 14px; background: var(--red); color: #fff; border: none; cursor: pointer; white-space: nowrap; }
.ch-add-btn:hover { background: var(--red-glow); }
.ch-primary-wrap { display: flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 10px; color: var(--silver); cursor: pointer; }
.ch-primary-wrap input { accent-color: var(--red); }

/* Bio field toggle buttons */
.bf-toggle { font-family: var(--font-mono); font-size: 11px; padding: 4px 10px; border: none; cursor: pointer; transition: all .15s; }
.bf-toggle--on  { background: #1a2a1a; color: #4ade80; }
.bf-toggle--on:hover { background: #1a3a1a; }
.bf-toggle--off { background: var(--black); color: var(--border); border: 1px solid var(--border); }
.bf-toggle--off:hover { border-color: var(--silver); color: var(--silver); }


/* ── Filter bars — global ────────────────────────────────────────────────── */
.ul-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.ul-filter-input, .ul-filter-select {
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 8px 12px;
    outline: none;
    transition: border-color .15s;
    -webkit-appearance: none;
    appearance: none;
}
.ul-filter-input  { width: 240px; }
.ul-filter-input::placeholder { color: var(--silver); opacity: .6; }
.ul-filter-input:focus, .ul-filter-select:focus { border-color: var(--red); }
.ul-filter-select { cursor: pointer; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b8b99'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.ul-filter-select option { background: var(--panel); color: var(--white); }

.ul-filter-toggle { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10px; color: var(--silver); cursor: pointer; }
.ul-filter-toggle input { accent-color: var(--red); }

.ul-filter-btn { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; padding: 8px 16px; background: var(--red); color: #fff; border: none; cursor: pointer; transition: background .15s; }
.ul-filter-btn:hover { background: var(--red-glow); }

.ul-filter-clear { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; color: var(--silver); padding: 8px 12px; border: 1px solid var(--border); transition: all .15s; }
.ul-filter-clear:hover { border-color: var(--red); color: var(--red); }

.ul-filter-count { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--silver); letter-spacing: 1px; }

/* ── User/Character table — global ───────────────────────────────────────── */
.ul-btn-new { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; padding: 8px 16px; background: var(--red); color: #fff; transition: background .15s; text-decoration: none; display: inline-block; }
.ul-btn-new:hover { background: var(--red-glow); color: #fff; }

.ul-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ul-table th { font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px; color: var(--silver); text-transform: uppercase; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ul-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--light); }
.ul-table tr:last-child td { border-bottom: none; }
.ul-table tr:hover td { background: var(--black); }
.ul-row--deleted td { opacity: .5; }

.ul-td--id       { font-family: var(--font-mono); font-size: 11px; color: var(--silver); width: 48px; }
.ul-td--username { font-family: var(--font-mono); font-size: 11px; }
.ul-td--email a  { color: var(--red); }
.ul-td--email a:hover { color: var(--red-glow); }
.ul-td--active   { font-family: var(--font-mono); font-size: 10px; color: var(--silver); white-space: nowrap; }
.ul-td--actions  { white-space: nowrap; }
.ul-alias { display: block; font-size: 10px; color: var(--silver); font-style: italic; font-weight: 400; }

.ul-char-tag { display: inline-flex; align-items: center; gap: 4px; background: var(--black); border: 1px solid var(--border); font-family: var(--font-mono); font-size: 10px; color: var(--light); padding: 2px 6px; margin: 2px 2px 2px 0; }
.ul-char-tag--primary { border-color: var(--red-dim); color: var(--red-glow); }
.ul-char-unassign { background: none; border: none; color: var(--silver); cursor: pointer; font-size: 12px; padding: 0 0 0 2px; line-height: 1; transition: color .15s; }
.ul-char-unassign:hover { color: var(--red-glow); }

.ul-action { font-family: var(--font-mono); font-size: 9px; letter-spacing: 1px; padding: 4px 10px; border: none; cursor: pointer; transition: all .15s; display: inline-block; text-decoration: none; margin-left: 4px; }
.ul-action--edit    { background: var(--panel); border: 1px solid var(--border); color: var(--silver); }
.ul-action--edit:hover { border-color: var(--red); color: var(--white); }
.ul-action--delete  { background: transparent; border: 1px solid var(--red-dim); color: var(--red-glow); }
.ul-action--delete:hover { background: var(--red-dim); }
.ul-action--restore { background: #1a2a1a; border: 1px solid #1a3a1a; color: #4ade80; }
.ul-action--restore:hover { background: #1a3a1a; }

.ul-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; }
.ul-page-btn { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; padding: 7px 16px; border: 1px solid var(--border); color: var(--silver); transition: all .15s; }
.ul-page-btn:hover { border-color: var(--red); color: var(--white); }
.ul-page-info { font-family: var(--font-mono); font-size: 10px; color: var(--silver); letter-spacing: 1px; }

/* ── Settings cards ──────────────────────────────────────────────────────── */
.ap-settings-card {
    display: flex; align-items: center; gap: 16px;
    background: var(--panel); border: 1px solid var(--border);
    padding: 20px; text-decoration: none; color: inherit;
    transition: border-color .15s; cursor: pointer;
}
.ap-settings-card:hover { border-color: var(--red); }
.ap-settings-card--soon { opacity: .6; cursor: default; }
.ap-settings-card--soon:hover { border-color: var(--border); }
.ap-settings-card__icon  { font-size: 24px; flex-shrink: 0; width: 40px; text-align: center; }
.ap-settings-card__body  { flex: 1; }
.ap-settings-card__title { font-family: var(--font-head); font-size: 18px; letter-spacing: 2px; margin-bottom: 4px; }
.ap-settings-card__desc  { font-size: 12px; color: var(--silver); line-height: 1.5; }
.ap-settings-card__arrow { font-family: var(--font-mono); font-size: 18px; color: var(--red); flex-shrink: 0; }
.ap-settings-card__badge { font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px; color: var(--silver); border: 1px solid var(--border); padding: 3px 8px; flex-shrink: 0; }

/* ── Alignment manager ───────────────────────────────────────────────────── */
.am-color-picker {
    width: 36px; height: 36px; padding: 2px;
    border: 1px solid var(--border); background: var(--panel);
    cursor: pointer; flex-shrink: 0;
}

/* ── Character switcher (header) ─────────────────────────────────────────── */
.ap-char-switcher { position: relative; }
.ap-char-switcher__current {
    display: flex; align-items: center; gap: 8px;
    background: var(--panel); border: 1px solid var(--border);
    padding: 6px 12px; cursor: pointer; transition: border-color .15s; height: 32px;
}
.ap-char-switcher__current:hover { border-color: var(--red); }
.ap-char-switcher__icon  { font-size: 13px; color: var(--red); }
.ap-char-switcher__name  { font-family: var(--font-mono); font-size: 10px; color: var(--light); letter-spacing: 1px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-char-switcher__arrow { font-size: 10px; color: var(--silver); margin-left: 4px; }
.ap-char-switcher__dropdown {
    display: none; position: absolute; top: 100%; right: 0;
    background: var(--panel); border: 1px solid var(--border);
    min-width: 220px; z-index: 300; flex-direction: column; margin-top: 2px;
}
.ap-char-switcher__dropdown.is-open { display: flex; }
.ap-char-switcher__label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px; color: var(--silver); padding: 8px 14px 6px; border-bottom: 1px solid var(--border); }
.ap-char-switcher__divider { border-top: 1px solid var(--border); }
.ap-char-switcher__clear { width: 100%; padding: 8px 14px; font-family: var(--font-mono); font-size: 10px; color: var(--silver); background: none; border: none; cursor: pointer; text-align: left; transition: background .15s, color .15s; }
.ap-char-switcher__clear:hover { background: var(--surface); color: var(--red); }
.ap-char-switcher__item { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px 14px; background: none; border: none; cursor: pointer; text-align: left; transition: background .15s; border-left: 2px solid transparent; }
.ap-char-switcher__item:hover { background: var(--surface); }
.ap-char-switcher__item--active { border-left-color: var(--red); background: var(--black); }
.ap-char-switcher__item-name  { font-size: 13px; font-weight: 600; color: var(--white); }
.ap-char-switcher__item-type  { font-family: var(--font-mono); font-size: 9px; color: var(--silver); letter-spacing: 1px; }
.ap-char-switcher__item-align { font-family: var(--font-mono); font-size: 9px; letter-spacing: 1px; }

/* ── Quotes & Facts panels ───────────────────────────────────────────────── */
.qf-row { position: relative; padding: 8px 28px 8px 0; border-bottom: 1px solid var(--border); }
.qf-row:last-of-type { border-bottom: none; }
.qf-text { font-size: 12px; color: var(--light); line-height: 1.5; }
.qf-attr { font-family: var(--font-mono); font-size: 10px; color: var(--silver); margin-top: 3px; }
.qf-delete { position: absolute; top: 8px; right: 0; background: none; border: none; color: var(--border); cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 4px; transition: color .15s; }
.qf-delete:hover { color: var(--red-glow); }
.qf-add-form { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0; }
.qf-textarea { min-height: 56px; resize: vertical; }

.ch-make-primary {
    background: none; border: 1px solid var(--border); color: var(--silver);
    font-size: 11px; padding: 3px 7px; cursor: pointer; transition: all .15s;
}
.ch-make-primary:hover { border-color: var(--red); color: var(--red-glow); }

/* ── Messages ────────────────────────────────────────────────────────────── */
.msg-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
@media (max-width: 800px) { .msg-layout { grid-template-columns: 1fr; } }

.msg-inbox { position: sticky; top: 16px; }

.msg-thread-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; transition: background .15s; }
.msg-thread-item:hover { background: var(--black); }
.msg-thread-item--active { background: var(--black); border-left: 3px solid var(--red); }
.msg-thread-item--unread .msg-thread-name { color: var(--white); font-weight: 700; }

.msg-thread-avatar { width: 32px; height: 32px; background: var(--red-dim); color: var(--red-glow); font-family: var(--font-head); font-size: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.msg-thread-info { flex: 1; min-width: 0; }
.msg-thread-name { font-size: 13px; font-weight: 600; color: var(--light); display: flex; align-items: center; gap: 6px; }
.msg-thread-preview { font-size: 11px; color: var(--silver); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.msg-thread-time { font-family: var(--font-mono); font-size: 9px; color: var(--silver); flex-shrink: 0; }

.msg-unread-dot { width: 7px; height: 7px; background: var(--red); border-radius: 50%; display: inline-block; flex-shrink: 0; }
.msg-badge { font-family: var(--font-mono); font-size: 9px; background: var(--red); color: #fff; padding: 2px 6px; margin-left: 6px; }

.msg-thread-body { padding: 16px; max-height: 480px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.msg-bubble-wrap { display: flex; }
.msg-bubble-wrap--mine   { justify-content: flex-end; }
.msg-bubble-wrap--theirs { justify-content: flex-start; }
.msg-bubble { max-width: 75%; padding: 10px 14px; }
.msg-bubble--mine   { background: var(--red-dim); border-radius: 0; }
.msg-bubble--theirs { background: var(--panel); border: 1px solid var(--border); }
.msg-bubble-body { font-size: 13px; color: var(--white); line-height: 1.6; word-break: break-word; }
.msg-bubble-meta { font-family: var(--font-mono); font-size: 9px; color: var(--silver); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.msg-delete-msg { background: none; border: none; color: var(--border); cursor: pointer; font-size: 13px; padding: 0; transition: color .15s; }
.msg-delete-msg:hover { color: var(--red-glow); }

.msg-reply-wrap { border-top: 1px solid var(--border); padding: 12px 14px 14px; }
.msg-reply-form { display: flex; gap: 8px; align-items: flex-end; }
.msg-reply-input { flex: 1; background: var(--black); border: 1px solid var(--border); color: var(--white); font-family: var(--font-body); font-size: 13px; padding: 10px 12px; outline: none; resize: none; transition: border-color .15s; }
.msg-reply-input:focus { border-color: var(--red); }
.msg-reply-btn { font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; padding: 10px 16px; background: var(--red); color: #fff; border: none; cursor: pointer; white-space: nowrap; transition: background .15s; }
.msg-reply-btn:hover { background: var(--red-glow); }

.msg-search-results { margin-bottom: 16px; border: 1px solid var(--border); }
.msg-result-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.msg-result-row:last-child { border-bottom: none; }
.msg-result-name { font-size: 13px; font-weight: 600; color: var(--white); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.msg-result-info { flex: 1; }

.msg-to-display { padding: 8px 0; }
.msg-recipient-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--red-dim); color: var(--red-glow); font-family: var(--font-mono); font-size: 11px; padding: 4px 10px; }
.msg-recipient-tag button { background: none; border: none; color: var(--red-glow); cursor: pointer; font-size: 14px; padding: 0; line-height: 1; }

.ap-hdr-badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-family: var(--font-mono); font-size: 8px; padding: 1px 4px; min-width: 16px; text-align: center; line-height: 14px; }

/* ── Notices management ──────────────────────────────────────────────────── */
.nc-live-badge {
    font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px;
    background: var(--red); color: #fff; padding: 4px 10px;
}
.nc-row {
    display: flex; border-bottom: 1px solid var(--border);
    transition: background .15s;
}
.nc-row:last-child { border-bottom: none; }
.nc-row:hover { background: var(--black); }
.nc-row--inactive { opacity: .6; }
.nc-row--expired  { opacity: .75; }

.nc-type-bar { width: 4px; flex-shrink: 0; }
.nc-body { flex: 1; padding: 14px 16px; }

.nc-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.nc-title  { font-family: var(--font-head); font-size: 16px; letter-spacing: 1px; color: var(--white); flex: 1; }
.nc-meta   { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.nc-type-badge { font-family: var(--font-mono); font-size: 8px; letter-spacing: 1px; padding: 2px 7px; }
.nc-type-badge--info    { background: #1a2a3a; color: #60a5fa; }
.nc-type-badge--success { background: #1a2a1a; color: #4ade80; }
.nc-type-badge--warning { background: #2a2a1a; color: #f2c94c; }
.nc-type-badge--error   { background: var(--red-dim); color: var(--red-glow); }

.nc-tag { font-family: var(--font-mono); font-size: 8px; letter-spacing: 1px; padding: 2px 7px; background: var(--border); color: var(--silver); }
.nc-tag--expired { background: var(--red-dim); color: var(--red-glow); }

.nc-message { font-size: 12px; color: var(--silver); line-height: 1.6; margin-bottom: 10px; }
.nc-footer  { font-family: var(--font-mono); font-size: 9px; color: var(--border); display: flex; justify-content: space-between; margin-bottom: 10px; }
.nc-dismiss-count { color: var(--silver); }

.nc-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nc-btn { font-family: var(--font-mono); font-size: 9px; letter-spacing: 1px; padding: 4px 10px; border: none; cursor: pointer; transition: all .15s; }
.nc-btn--dismiss    { background: var(--panel); border: 1px solid var(--border); color: var(--silver); }
.nc-btn--dismiss:hover { border-color: var(--red); color: var(--white); }
.nc-btn--deactivate { background: transparent; border: 1px solid var(--border); color: var(--silver); }
.nc-btn--deactivate:hover { border-color: var(--silver); color: var(--white); }
.nc-btn--delete     { background: transparent; border: 1px solid var(--red-dim); color: var(--red-glow); }
.nc-btn--delete:hover { background: var(--red-dim); }
.nc-dismissed-label { font-family: var(--font-mono); font-size: 9px; color: #4ade80; }

/* ============================================================
   eMS v3 Admin — Mobile Polish Pass
   Append to bottom of admin.css
   ============================================================ */

@media (max-width: 700px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .ap-shell {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .ap-header {
    padding: 0 10px;
    gap: 8px;
  }

  .ap-header__left,
  .ap-header__right {
    gap: 8px;
    min-width: 0;
  }

  .ap-logo__img {
    max-width: 118px;
    max-height: 34px;
  }

  .ap-hdr-icon,
  .ap-fed-switcher {
    display: none;
  }

  .ap-char-switcher__current {
    max-width: 190px;
    padding: 6px 9px;
  }

  .ap-char-switcher__name {
    max-width: 130px;
    font-size: 9px;
  }

  .ap-main {
    padding: 18px 14px 28px;
    gap: 16px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .ap-page-header {
    display: block;
  }

  .ap-page-title {
    font-size: clamp(40px, 12vw, 58px);
    letter-spacing: 3px;
    line-height: .95;
    overflow-wrap: anywhere;
  }

  .ap-breadcrumb {
    font-size: 10px;
    line-height: 1.6;
    overflow-wrap: anywhere;
  }

  .ap-module,
  .ue-meta-bar {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .ap-module__head {
    padding: 14px;
  }

  .ap-module__body {
    padding: 14px;
  }

  .ap-module__title {
    font-size: 20px;
    letter-spacing: 3px;
  }

  .ue-meta-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 14px;
  }

  .ue-meta-label {
    font-size: 9px;
  }

  .ue-meta-val {
    font-size: 14px;
    word-break: break-word;
  }

  .ue-layout,
  .ue-grid {
    display: block;
  }

  .ue-col,
  .ue-field {
    width: 100%;
    margin-bottom: 14px;
  }

  .ue-input,
  .ue-select,
  .ue-textarea {
    font-size: 16px;
    padding: 13px 14px;
  }

  .ue-hint {
    font-size: 13px;
    line-height: 1.45;
  }

  .ue-btn {
    font-size: 11px;
    padding: 15px 12px;
  }

  .ue-pw-wrap,
  .msg-reply-form,
  .ch-add-form {
    flex-direction: column;
    align-items: stretch;
  }

  .ue-pw-gen,
  .msg-reply-btn,
  .ch-add-btn {
    width: 100%;
    padding: 13px 12px;
  }

  .ul-filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
  }

  .ul-filter-input,
  .ul-filter-select,
  .ul-filter-btn,
  .ul-filter-clear {
    width: 100%;
    font-size: 14px;
    padding: 13px 14px;
  }

  .ul-filter-toggle {
    font-size: 12px;
    padding: 6px 0;
  }

  .ul-filter-count {
    margin-left: 0;
  }

  .ul-table {
    min-width: 760px;
  }

  .ap-table,
  .ul-table {
    white-space: nowrap;
  }

  .table-wrap,
  .ap-table-wrap,
  .ul-table-wrap,
  .ap-module__body:has(.ul-table),
  .ap-module__body:has(.ap-table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ul-table th,
  .ul-table td {
    padding: 12px 14px;
    font-size: 13px;
  }

  .ul-table th {
    font-size: 10px;
  }

  .ap-sidebar {
    width: min(86vw, 320px);
  }

  .ap-nav__item {
    padding: 13px 18px;
    font-size: 15px;
  }
}

@media (max-width: 420px) {
  .ap-char-switcher__current {
    max-width: 170px;
  }

  .ap-char-switcher__name {
    max-width: 110px;
  }

  .ue-meta-bar {
    grid-template-columns: 1fr;
  }

  .ap-page-title {
    font-size: clamp(38px, 14vw, 52px);
  }
}

/* Mobile-only sidebar quick actions */
.ap-nav__section--mobile-actions {
  display: none;
}

@media (max-width: 700px) {
  .ap-nav__section--mobile-actions {
    display: block;
  }

  .ap-nav__section--mobile-actions .ap-nav__item {
    min-height: 48px;
  }

  .ap-nav__section--mobile-actions .ap-nav__badge {
    margin-left: auto;
    min-width: 22px;
    text-align: center;
    background: var(--red);
    color: #fff;
  }
}

@media (max-width: 700px) {
  .ap-nav__section--no-heading {
    padding-top: 0;
  }
}

/* ── Theme Music & Entrance Video ────────────────────────────────────────── */
.tm-upload-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.tm-current-audio {
    margin-bottom: 12px;
}

.tm-audio-player {
    width: 100%;
    height: 36px;
    margin-top: 8px;
    accent-color: var(--red);
}

.tm-audio-filename {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--silver);
    margin-top: 4px;
    word-break: break-all;
}

.tm-current-video {
    margin-bottom: 4px;
}

.tm-upload-field {
    margin-top: 12px;
}

.tm-video-player {
    width: 100%;
    max-height: 200px;
    margin-top: 8px;
    background: #000;
}

.tm-video-link-wrap {
    margin-top: 6px;
}

.tm-video-link {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--red);
    margin-left: 8px;
    word-break: break-all;
}

.tm-video-divider {
    margin: 12px 0;
    border-top: 1px solid var(--border);
}

.is-hidden {
    display: none !important;
}

/* ── Locked / Read-only Character Fields ─────────────────────────────────── */
.ue-input--locked,
.ue-input[readonly] {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ── Docs / Wiki ─────────────────────────────────────────────────────────── */
.doc-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
@media (max-width: 800px) { .doc-layout { grid-template-columns: 1fr; } }

.doc-sidebar { position: sticky; top: 16px; }
.doc-sidebar-section { margin-bottom: 16px; }
.doc-sidebar-heading {
    font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px;
    color: var(--silver); text-transform: uppercase; padding: 6px 0 4px;
    border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.doc-sidebar-link {
    display: block; padding: 5px 8px; font-size: 12px; color: var(--silver);
    transition: color .15s; border-left: 2px solid transparent;
}
.doc-sidebar-link:hover { color: var(--white); }
.doc-sidebar-link--active { color: var(--white); border-left-color: var(--red); }

.doc-article { max-width: 760px; }
.doc-article h1 { font-family: var(--font-head); font-size: 32px; letter-spacing: 2px; color: var(--white); margin-bottom: 8px; }
.doc-article h2 { font-family: var(--font-head); font-size: 22px; letter-spacing: 1px; color: var(--white); margin: 28px 0 10px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.doc-article h3 { font-family: var(--font-head); font-size: 16px; color: var(--light); margin: 20px 0 8px; }
.doc-article p  { font-size: 14px; color: var(--silver); line-height: 1.8; margin-bottom: 14px; }
.doc-article ul, .doc-article ol { padding-left: 20px; margin-bottom: 14px; }
.doc-article li { font-size: 14px; color: var(--silver); line-height: 1.8; margin-bottom: 4px; }
.doc-article a  { color: var(--red); }
.doc-article a:hover { color: var(--red-glow); }
.doc-article code {
    font-family: var(--font-mono); font-size: 12px;
    background: var(--black); border: 1px solid var(--border);
    padding: 1px 6px; color: var(--light);
}
.doc-article pre {
    background: var(--black); border: 1px solid var(--border);
    padding: 14px 16px; overflow-x: auto; margin-bottom: 16px;
}
.doc-article pre code { background: none; border: none; padding: 0; }
.doc-article blockquote {
    border-left: 3px solid var(--red); margin: 0 0 14px;
    padding: 8px 16px; background: var(--black);
}
.doc-article blockquote p { margin-bottom: 0; color: var(--light); }
.doc-article img { max-width: 100%; height: auto; margin: 12px 0; border: 1px solid var(--border); }
.doc-article hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.doc-article table { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 13px; }
.doc-article th { font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px; color: var(--silver); padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.doc-article td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--light); }

.doc-editor-body {
    width: 100%; min-height: 480px; resize: vertical;
    background: var(--black); border: 1px solid var(--border);
    color: var(--white); font-family: var(--font-mono); font-size: 12px;
    line-height: 1.7; padding: 14px; outline: none; transition: border-color .15s;
}
.doc-editor-body:focus { border-color: var(--red); }

.doc-image-thumb { width: 50px; height: 50px; object-fit: cover; border: 1px solid var(--border); }
.doc-image-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.doc-image-row:last-child { border-bottom: none; }
.doc-image-markdown { font-family: var(--font-mono); font-size: 10px; color: var(--silver); flex: 1; word-break: break-all; }

.doc-search-result { padding: 14px 0; border-bottom: 1px solid var(--border); }
.doc-search-result:last-child { border-bottom: none; }
.doc-search-result-title { font-size: 16px; font-weight: 700; color: var(--white); margin-bottom: 4px; }
.doc-search-result-title a { color: var(--white); }
.doc-search-result-title a:hover { color: var(--red); }
.doc-search-result-section { font-family: var(--font-mono); font-size: 9px; color: var(--silver); letter-spacing: 1px; margin-bottom: 6px; }
.doc-search-result-excerpt { font-size: 12px; color: var(--silver); line-height: 1.6; }

.doc-unpublished-badge { font-family: var(--font-mono); font-size: 8px; letter-spacing: 1px; padding: 2px 7px; background: var(--border); color: var(--silver); margin-left: 8px; vertical-align: middle; }

/* ── Character Image Types & Templates ───────────────────────────────────── */
.it-type-card {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.it-type-card + .it-type-card {
    margin-top: 12px;
}

.it-dim-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--silver);
    padding: 2px 8px;
    background: var(--black);
    border: 1px solid var(--border);
    display: inline-block;
}

.it-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.it-template-card {
    background: var(--panel);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: border-color .15s;
}

.it-template-card:hover {
    border-color: var(--silver);
}

.it-template-card--default {
    border-left: 3px solid var(--red);
}

.it-template-preview {
    width: 100%;
    background: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.it-template-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.it-template-preview-placeholder {
    width: 100%;
    padding: 32px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--border);
    flex-direction: column;
    gap: 4px;
}

.it-template-info {
    padding: 10px 12px;
    flex: 1;
}

.it-template-name {
    font-family: var(--font-head);
    font-size: 14px;
    letter-spacing: 1px;
    color: var(--white);
    margin-bottom: 4px;
}

.it-template-meta {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--silver);
    line-height: 1.6;
}

.it-template-actions {
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Text position grid */
.it-position-grid {
    display: grid;
    grid-template-columns: repeat(3, 40px);
    gap: 4px;
}

.it-position-grid input[type="radio"] {
    display: none;
}

.it-position-grid label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--black);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 16px;
    transition: all .15s;
}

.it-position-grid label:hover {
    border-color: var(--silver);
}

.it-position-grid input[type="radio"]:checked + label {
    background: var(--red-dim);
    border-color: var(--red);
    color: var(--red-glow);
}

.notice {
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 10px;
}

.notice-error {
    border-left: 3px solid var(--red);
}

.notice-icon {
    color: var(--red-glow);
    font-size: 20px;
    line-height: 1;
}

.notice-dismiss {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    padding: 6px 10px;
    cursor: pointer;
}

.notice-dismiss:hover {
    border-color: var(--red);
    color: var(--white);
}

.ue-btn.is-disabled,
.ue-btn:disabled,
button.is-disabled,
button:disabled {
    opacity: .45;
    cursor: not-allowed;
    filter: grayscale(1);
}

/* ── Image Templates: collapsed add prompt + visual previews ─────────────── */
.it-add-template-prompt {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    margin-bottom: 16px;
    background: rgba(255,255,255,.035);
    border: 1px dashed var(--border);
    color: var(--white);
    text-decoration: none;
    opacity: .82;
    transition: opacity .15s, border-color .15s, background .15s;
}

.it-add-template-prompt:hover {
    opacity: 1;
    border-color: var(--red);
    background: rgba(192,57,43,.08);
}

.it-add-template-prompt__icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--red-dim);
    color: var(--red-glow);
    border: 1px solid var(--red);
    font-size: 24px;
    line-height: 1;
}

.it-add-template-prompt__body {
    flex: 1;
    min-width: 0;
}

.it-add-template-prompt__title {
    font-family: var(--font-head);
    font-size: 15px;
    letter-spacing: 1px;
    color: var(--white);
}

.it-add-template-prompt__desc {
    margin-top: 3px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--silver);
}

.it-add-template-prompt__arrow {
    color: var(--silver);
    font-size: 18px;
}

.it-form-cancel {
    width: auto;
    padding: 10px 20px;
}

.it-template-preview--cover {
    height: 180px;
    min-height: 180px;
    background: var(--black);
}

.it-template-preview__img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center center;
    transform: scale(1.05);
}

.it-template-preview__label {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 5px 7px;
    background: rgba(0,0,0,.72);
    border: 1px solid rgba(255,255,255,.08);
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 9px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Image Types: Main Bio Image Selector ───────────────────────────────── */

.it-main-bio-type-module {
    border-color: rgba(192, 57, 43, 0.45);
}

.it-main-bio-type-form {
    margin: 0;
}

.it-main-bio-type-actions {
    margin-top: 16px;
}

.it-config-warning {
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(243, 156, 18, 0.45);
    border-radius: 12px;
    background: rgba(243, 156, 18, 0.08);
    color: var(--yellow);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.it-empty-config {
    padding: 18px;
    border: 1px dashed rgba(192, 57, 43, 0.55);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
}

.it-empty-config__title {
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.it-empty-config__text {
    color: var(--silver);
    font-size: 13px;
    line-height: 1.6;
    max-width: 780px;
    margin-bottom: 16px;
}

.it-empty-config__button {
    width: auto;
}

/* ── Character Edit: Roster Image Sidebar Box ───────────────────────────── */

.ch-roster-preview {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(0,0,0,0.28);
    margin-bottom: 8px;
}

.ch-roster-preview__img {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: cover;
}

.ch-roster-current {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--silver);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}

.ch-roster-empty {
    padding: 14px;
    border: 1px dashed rgba(255,255,255,0.14);
    border-radius: 12px;
    color: var(--silver);
    font-size: 12px;
    text-align: center;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.025);
}

.ch-roster-notes {
    padding: 12px;
    border: 1px solid rgba(243, 156, 18, 0.28);
    border-radius: 12px;
    background: rgba(243, 156, 18, 0.06);
    margin-bottom: 12px;
}

.ch-roster-notes__text {
    color: var(--silver);
    font-size: 12px;
    line-height: 1.55;
    margin-top: 5px;
}

.ch-roster-upload-form {
    margin: 0;
}

/* ── Character Edit: Roster Image Upload Polish ─────────────────────────── */

.ch-roster-upload-form .br-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ch-roster-upload-form .br-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 38px;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    background: rgba(255,255,255,0.055);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ch-roster-upload-form .br-file-label:hover {
    background: rgba(192, 57, 43, 0.16);
    border-color: rgba(231, 76, 60, 0.45);
    color: var(--red-glow);
}

.ch-roster-upload-form .br-file-name {
    display: block;
    margin-top: 7px;
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.4;
    letter-spacing: 0.04em;
    word-break: break-word;
    opacity: 0.9;
}

.ch-roster-upload-form .ue-hint {
    margin-top: 4px;
    line-height: 1.45;
}

.ch-roster-upload-form .ch-add-btn {
    margin-top: 12px !important;
}

/* ── Docs / Article Images: File Upload Polish ──────────────────────────── */

.ap-module .br-file-input,
.ap-module input[type="file"].br-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ap-module .br-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 40px;
    margin-top: 8px;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    background: rgba(255,255,255,0.055);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}

.ap-module .br-file-label:hover {
    background: rgba(192, 57, 43, 0.16);
    border-color: rgba(231, 76, 60, 0.45);
    color: var(--red-glow);
    transform: translateY(-1px);
}

.ap-module .br-file-name {
    display: block;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px;
    background: rgba(0,0,0,0.22);
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.4;
    letter-spacing: 0.04em;
    word-break: break-word;
}

.ap-module .br-file-name:not(:empty) {
    opacity: 0.95;
}

.ap-module .ue-hint,
.ap-module .form-hint,
.ap-module small {
    margin-top: 7px;
    color: var(--silver);
    font-size: 11px;
    line-height: 1.45;
}

/* Optional: makes upload fields feel like their own mini panel */
.ap-module .ue-field:has(.br-file-input),
.ap-module .form-row:has(.br-file-input) {
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    background: rgba(255,255,255,0.025);
}

/* ── Character Allies / Rivals ─────────────────────────────────────────── */

.ue-character-main-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cr-help {
    margin: 0 0 14px;
    color: var(--silver);
    font-size: 12px;
    line-height: 1.6;
}

.cr-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.cr-panel {
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(0,0,0,.22);
    border-radius: 10px;
    overflow: hidden;
}

.cr-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255,255,255,.04);
    border-bottom: 1px solid rgba(255,255,255,.08);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    color: var(--white);
}

.cr-panel__head em {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    color: var(--silver);
    font-style: normal;
    font-size: 10px;
}

.cr-panel--ally .cr-panel__head {
    border-left: 3px solid rgba(46, 204, 113, .8);
}

.cr-panel--rival .cr-panel__head {
    border-left: 3px solid var(--red);
}

.cr-empty {
    padding: 12px;
    color: var(--silver);
    font-size: 12px;
    line-height: 1.5;
}

.cr-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,.06);
}

.cr-row:first-of-type {
    border-top: 0;
}

.cr-info {
    min-width: 0;
    flex: 1;
}

.cr-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--white);
    font-size: 13px;
    font-weight: 800;
}

.cr-meta {
    margin-top: 2px;
    color: var(--silver);
    font-size: 10px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.cr-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 7px;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.cr-status--active {
    background: rgba(46, 204, 113, .14);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, .28);
}

.cr-status--alumni {
    background: rgba(255,255,255,.07);
    color: var(--silver);
    border: 1px solid rgba(255,255,255,.12);
}

.cr-reason {
    margin-top: 8px;
    padding-left: 9px;
    border-left: 2px solid rgba(255,255,255,.1);
    color: var(--silver);
    font-size: 12px;
    line-height: 1.5;
}

.cr-add-form {
    border-top: 1px solid rgba(255,255,255,.08);
    padding-top: 14px;
}

.cr-reason-input {
    min-height: 80px;
}

.cr-submit {
    width: 100%;
    margin-top: 10px;
    text-align: center;
}

@media (max-width: 860px) {
    .cr-columns {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Venue Manager
   ============================================================ */

.venue-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  align-items: start;
}

.venue-country-panel {
  position: sticky;
  top: 16px;
}

.venue-country-panel__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.venue-country-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  background: var(--surface);
  max-height: 520px;
  overflow: auto;
}

.venue-country-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--light);
  transition: background .15s, color .15s, border-color .15s;
  border-left: 3px solid transparent;
}

.venue-country-link:last-child {
  border-bottom: 0;
}

.venue-country-link:hover {
  background: var(--panel);
  color: var(--white);
}

.venue-country-link--active {
  background: var(--panel);
  color: var(--white);
  border-left-color: var(--red);
}

.venue-country-link__name {
  font-size: 13px;
  font-weight: 700;
}

.venue-country-link__meta {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--silver);
  text-transform: uppercase;
}

.venue-main-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.venue-rule {
  border: 0;
  border-top: 1px solid var(--border);
}

.venue-compact-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.venue-toggle-pad {
  min-height: 38px;
  align-items: center;
}

.venue-actions-row {
  display: flex;
  justify-content: flex-end;
  align-self: end;
}

.venue-actions-row .ue-btn {
  width: auto;
  min-width: 160px;
}

.venue-delete-country-form {
  margin-top: 12px;
  max-width: 220px;
}

.venue-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: center;
  min-height: 180px;
  gap: 8px;
  color: var(--silver);
}

.venue-empty-state__icon {
  font-size: 34px;
}

.venue-empty-state__title {
  font-family: var(--font-head);
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--white);
}

.venue-empty-state__text {
  max-width: 380px;
  font-size: 13px;
  line-height: 1.5;
}

.venue-empty-mini {
  padding: 12px;
  border: 1px dashed var(--border);
  color: var(--silver);
  font-size: 12px;
  line-height: 1.5;
  background: var(--surface);
}

.venue-residency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.venue-residency-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.venue-residency-item:hover {
  background: var(--black);
  border-color: var(--red-dim);
}

.venue-residency-item input {
  margin-top: 2px;
  accent-color: var(--red);
}

.venue-residency-item strong {
  display: block;
  font-size: 12px;
  color: var(--white);
}

.venue-residency-item em {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--silver);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.venue-residency-save {
  margin-top: 14px;
  max-width: 220px;
}

.venue-table-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

.venue-table td {
  vertical-align: top;
}

.venue-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  background: #1a2a1a;
  color: #4ade80;
  text-transform: uppercase;
}

.venue-note {
  margin-top: 5px;
  max-width: 360px;
  color: var(--silver);
  font-size: 11px;
  line-height: 1.45;
}

.venue-edit-details {
  min-width: 220px;
}

.venue-edit-details summary {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid var(--border);
  color: var(--silver);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.venue-edit-details summary:hover {
  border-color: var(--red);
  color: var(--white);
}

.venue-edit-details[open] summary {
  margin-bottom: 10px;
  border-color: var(--red);
  color: var(--white);
}

.venue-edit-form {
  min-width: 520px;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.venue-inline-delete {
  margin-top: 10px;
  max-width: 180px;
}

.venue-row.is-filtered {
  display: none;
}

.venue-country-link.is-filtered {
  display: none;
}

@media (max-width: 1000px) {
  .venue-layout {
    grid-template-columns: 1fr;
  }

  .venue-country-panel {
    position: static;
  }

  .venue-edit-form {
    min-width: 0;
  }
}

@media (max-width: 600px) {
  .venue-actions-row {
    justify-content: stretch;
  }

  .venue-actions-row .ue-btn {
    width: 100%;
    min-width: 0;
  }

  .venue-residency-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Venue Manager — Improved layout + scrollbars
   ============================================================ */

.venue-top-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
  gap: 16px;
  align-items: start;
}

.venue-add-card {
  overflow: hidden;
}

.venue-add-card__summary {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 94px;
  padding: 18px;
  list-style: none;
  cursor: pointer;
  border: 1px dashed var(--border);
  background:
    linear-gradient(135deg, rgba(192, 57, 43, 0.12), rgba(0, 0, 0, 0)),
    var(--surface);
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.venue-add-card__summary::-webkit-details-marker {
  display: none;
}

.venue-add-card__summary:hover {
  border-color: var(--red);
  background:
    linear-gradient(135deg, rgba(192, 57, 43, 0.2), rgba(0, 0, 0, 0)),
    var(--black);
}

.venue-add-card[open] .venue-add-card__summary {
  border-color: var(--red-dim);
  border-bottom-style: solid;
}

.venue-add-card__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  background: rgba(192, 57, 43, 0.16);
  border: 1px solid rgba(192, 57, 43, 0.45);
  color: var(--white);
  font-size: 20px;
}

.venue-add-card__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.venue-add-card__text strong {
  font-family: var(--font-head);
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--white);
}

.venue-add-card__text em {
  font-style: normal;
  font-size: 12px;
  color: var(--silver);
  line-height: 1.4;
}

.venue-add-card__plus {
  margin-left: auto;
  font-family: var(--font-head);
  font-size: 28px;
  line-height: 1;
  color: var(--red);
  transition: transform .18s ease;
}

.venue-add-card[open] .venue-add-card__plus {
  transform: rotate(45deg);
}

.venue-add-card__body {
  border-top: 1px solid var(--border);
}

.venue-residency-card .ap-module__body {
  max-height: 420px;
  overflow: auto;
}

.venue-residency-grid--compact {
  grid-template-columns: 1fr;
  max-height: 255px;
  overflow: auto;
  padding-right: 4px;
}

.venue-residency-grid--compact .venue-residency-item {
  padding: 8px 9px;
}

/* Sidebar-style scrollbars for venue panels */
.venue-country-list,
.venue-residency-card .ap-module__body,
.venue-residency-grid--compact,
.venue-table-wrap {
  scrollbar-width: thin;
  scrollbar-color: var(--red-dim) rgba(255, 255, 255, 0.05);
}

.venue-country-list::-webkit-scrollbar,
.venue-residency-card .ap-module__body::-webkit-scrollbar,
.venue-residency-grid--compact::-webkit-scrollbar,
.venue-table-wrap::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.venue-country-list::-webkit-scrollbar-track,
.venue-residency-card .ap-module__body::-webkit-scrollbar-track,
.venue-residency-grid--compact::-webkit-scrollbar-track,
.venue-table-wrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

.venue-country-list::-webkit-scrollbar-thumb,
.venue-residency-card .ap-module__body::-webkit-scrollbar-thumb,
.venue-residency-grid--compact::-webkit-scrollbar-thumb,
.venue-table-wrap::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--red), var(--red-dim));
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.35);
}

.venue-country-list::-webkit-scrollbar-thumb:hover,
.venue-residency-card .ap-module__body::-webkit-scrollbar-thumb:hover,
.venue-residency-grid--compact::-webkit-scrollbar-thumb:hover,
.venue-table-wrap::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--red-glow), var(--red));
}

@media (max-width: 1150px) {
  .venue-top-grid {
    grid-template-columns: 1fr;
  }

  .venue-residency-card .ap-module__body {
    max-height: none;
  }

  .venue-residency-grid--compact {
    max-height: 300px;
  }
}

@media (max-width: 600px) {
  .venue-add-card__summary {
    min-height: 82px;
    padding: 14px;
  }

  .venue-add-card__text strong {
    font-size: 17px;
  }

  .venue-add-card__icon {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    font-size: 17px;
  }
}

/* ── Match Type Manager ─────────────────────────────────────────────────── */

.mt-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.mt-stat .ap-module__body {
    padding: 18px;
}

.mt-stat__label {
    display: block;
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--silver);
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.mt-stat__value {
    display: block;
    font-family: var(--font-head);
    font-size: 30px;
    color: var(--white);
    line-height: 1;
}

.mt-form-actions,
.mt-inline-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-start;
}

.mt-submit {
    width: auto;
    min-width: 190px;
    padding-left: 18px;
    padding-right: 18px;
}

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

.mt-table-wrap {
    padding: 0;
    overflow-x: auto;
}

.mt-table td {
    vertical-align: top;
}

.mt-id {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--silver);
    white-space: nowrap;
}

.mt-slug,
.mt-description,
.mt-limit {
    display: block;
}

.mt-slug {
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--silver);
}

.mt-description {
    margin-top: 7px;
    max-width: 480px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.mt-limit {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--silver);
    line-height: 1.6;
    white-space: nowrap;
}

.mt-details {
    position: relative;
    min-width: 90px;
}

.mt-details summary {
    list-style: none;
    width: max-content;
}

.mt-details summary::-webkit-details-marker {
    display: none;
}

.mt-details[open] summary {
    border-color: var(--red);
    color: var(--white);
}

.mt-inline-form,
.mt-delete-form {
    margin-top: 12px;
    padding: 14px;
    min-width: 560px;
    border: 1px solid var(--border);
    background: var(--black);
}

.mt-delete-form {
    border-color: var(--red-dim);
}

.mt-delete-note {
    margin: 0;
    color: var(--silver);
    font-size: 12px;
    line-height: 1.45;
}

.mt-confirm-delete {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--silver);
    letter-spacing: 1px;
    cursor: pointer;
}

.mt-toggle-wrap {
    min-height: 42px;
    align-items: center;
}

.mt-empty {
    padding: 22px;
    color: var(--silver);
    text-align: center;
    border: 1px dashed var(--border);
    background: var(--black);
}

.mt-slug-cell {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--silver);
}

@media (max-width: 800px) {
    .mt-stats {
        grid-template-columns: 1fr;
    }

    .mt-submit {
        width: 100%;
    }

    .mt-inline-form,
    .mt-delete-form {
        min-width: 0;
    }
}

/* ── Match Types: Venue-style Add Box ───────────────────────────────────── */

.mt-manage-grid {
    margin: 18px 0;
}

.mt-manage-grid__main {
    max-width: 760px;
}

.mt-add-panel {
    display: block;
    margin: 0 0 18px;
}

.mt-add-panel > summary {
    list-style: none;
}

.mt-add-panel > summary::-webkit-details-marker {
    display: none;
}

.mt-add-panel > summary::marker {
    content: "";
}

.mt-add-prompt {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 86px;
    padding: 20px 24px;
    cursor: pointer;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    background:
        radial-gradient(circle at left center, rgba(196, 38, 38, 0.24), transparent 34%),
        linear-gradient(135deg, rgba(196, 38, 38, 0.10), rgba(255, 255, 255, 0.015)),
        var(--panel);
    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        transform 0.18s ease;
}

.mt-add-prompt:hover {
    border-color: rgba(255, 0, 0, 0.48);
    background:
        radial-gradient(circle at left center, rgba(196, 38, 38, 0.34), transparent 36%),
        linear-gradient(135deg, rgba(196, 38, 38, 0.15), rgba(255, 255, 255, 0.025)),
        var(--panel);
}

.mt-add-prompt__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 999px;
    color: var(--red);
    font-size: 30px;
    line-height: 1;
    border: 1px solid rgba(255, 0, 0, 0.45);
    background: rgba(255, 0, 0, 0.10);
}

.mt-add-prompt__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mt-add-prompt__title {
    font-family: var(--font-head);
    color: var(--white);
    font-size: 18px;
    letter-spacing: 1px;
    line-height: 1.1;
}

.mt-add-prompt__desc {
    margin-top: 8px;
    color: var(--silver);
    font-size: 12px;
    line-height: 1.35;
}

.mt-add-prompt__plus {
    margin-left: auto;
    color: var(--red);
    font-family: var(--font-head);
    font-size: 26px;
    line-height: 1;
    transition: transform 0.18s ease;
}

.mt-add-panel[open] .mt-add-prompt__plus {
    transform: rotate(45deg);
}

.mt-add-form-module {
    margin-top: 14px;
}

.mt-add-panel[open] .mt-add-prompt {
    border-style: solid;
    border-color: rgba(255, 0, 0, 0.5);
}

@media (max-width: 800px) {
    .mt-manage-grid__main {
        max-width: none;
    }

    .mt-add-prompt {
        padding: 18px;
    }

    .mt-add-prompt__title {
        font-size: 16px;
    }
}

/* ── Booking / Events ────────────────────────────────────────────────────── */
.ev-status-badge {
    display: inline-block; font-family: var(--font-mono); font-size: 9px;
    letter-spacing: 1px; padding: 3px 8px; text-transform: uppercase;
}
.ev-type-badge {
    display: inline-block; font-family: var(--font-mono); font-size: 9px;
    letter-spacing: 1px; padding: 3px 8px;
}
.ev-color-swatch {
    display: inline-block; width: 12px; height: 12px;
    border-radius: 2px; vertical-align: middle; margin-right: 6px;
    flex-shrink: 0;
}
.ev-name-preview { margin-top: 10px; min-height: 40px; }

.ev-form-section {
    margin-bottom: 24px; padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.ev-form-section:last-child { border-bottom: none; margin-bottom: 0; }
.ev-form-section-heading {
    font-family: var(--font-mono); font-size: 9px; letter-spacing: 3px;
    color: var(--red); text-transform: uppercase; margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}
.ev-form-section-heading::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.ev-form-wrap {
    max-width: 680px; margin: 0 auto;
}
.ev-venue-add-link {
    font-family: var(--font-mono); font-size: 10px; color: var(--silver);
    margin-top: 6px; display: inline-block; transition: color .15s;
}
.ev-venue-add-link:hover { color: var(--red); }

.ap-collapsed-add {
    width: 100%;
    border: 1px dashed var(--border);
    background: rgba(20, 12, 15, .72);
    color: var(--white);
    padding: 24px 28px;
    display: flex;
    align-items: center;
    gap: 18px;
    text-align: left;
    cursor: pointer;
}

.ap-collapsed-add__icon {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(192, 57, 43, .55);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--red-glow);
    font-size: 26px;
    background: rgba(192, 57, 43, .08);
}

.ap-collapsed-add__body {
    flex: 1;
}

.ap-collapsed-add__title {
    display: block;
    font-family: var(--font-display);
    font-size: 18px;
    letter-spacing: 1px;
}

.ap-collapsed-add__desc {
    display: block;
    margin-top: 6px;
    color: var(--silver);
    font-size: 13px;
}

.ap-collapsed-add__plus {
    color: var(--red);
    font-size: 22px;
    font-weight: 700;
}

.ap-collapsed-add__content {
    margin-top: 18px;
}

.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    background: var(--input-bg, #10131a) !important;
    border: 1px solid var(--border) !important;
    color: var(--white) !important;
    min-height: 42px;
    border-radius: 0;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--white) !important;
    line-height: 42px;
    padding-left: 12px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 42px;
}

.select2-dropdown {
    background: #10131a !important;
    border: 1px solid var(--border) !important;
    color: var(--white) !important;
}

.select2-search--dropdown .select2-search__field {
    background: #05070a !important;
    color: var(--white) !important;
    border: 1px solid var(--red) !important;
}

.select2-container--default .select2-results__option {
    color: var(--white) !important;
    background: #10131a !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--red) !important;
    color: #fff !important;
}

.br-preview__box {
    min-height: 150px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.025);
    border: 1px dashed var(--border);
    border-radius: 10px;
}

.br-preview__placeholder {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .08em;
    color: var(--silver);
    text-transform: uppercase;
    opacity: .85;
}

.br-preview__label {
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .14em;
    color: var(--red);
    text-transform: uppercase;
}

.ev-name-thumb {
    width: 54px;
    height: 36px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: #08090d;
    border-radius: 6px;
    display: block;
}

.ev-name-thumb--empty {
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: .12em;
    color: var(--silver);
    opacity: .75;
}

.ul-table td form {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.ul-table td select {
    min-height: 24px;
    font-size: 10px;
    padding: 2px 6px;
    max-width: 145px;
}

.ul-table td .ul-action {
    margin-right: 4px;
}

.ev-type-badge {
    border-radius: 4px;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0,0,0,.45);
}

.ev-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ev-action-form {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.ev-action-form--move {
    padding-left: 8px;
    border-left: 1px solid var(--border);
}

.ev-action-select {
    height: 28px;
    min-width: 120px;
    max-width: 150px;
    background: #0c0d12;
    border: 1px solid var(--border);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .04em;
    padding: 0 28px 0 8px;
    text-transform: uppercase;
}

.ev-action-select:focus {
    outline: none;
    border-color: var(--red);
}

.ev-actions .ul-action {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ─────────────────────────────────────────────────────────────
   Event Detail / View Page
───────────────────────────────────────────────────────────── */

.ev-detail-page {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.ev-detail-hero {
    position: relative;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) auto;
    gap: 22px;
    align-items: stretch;
    padding: 18px;
    border: 1px solid rgba(240, 240, 244, 0.09);
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(192, 57, 43, 0.16), rgba(10, 10, 11, 0.94) 42%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
    overflow: hidden;
}

.ev-detail-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 18% 18%, rgba(231, 76, 60, 0.18), transparent 34%),
        radial-gradient(circle at 88% 12%, rgba(243, 156, 18, 0.12), transparent 28%);
}

.ev-detail-hero > * {
    position: relative;
    z-index: 1;
}

.ev-detail-hero__image {
    min-height: 150px;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.36);
    border: 1px solid rgba(240, 240, 244, 0.10);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.ev-detail-hero__image img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 150px;
    object-fit: cover;
}

.ev-detail-hero__placeholder {
    min-height: 150px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background:
        linear-gradient(135deg, rgba(122, 31, 22, 0.68), rgba(0, 0, 0, 0.58)),
        repeating-linear-gradient(
            -45deg,
            rgba(255, 255, 255, 0.035),
            rgba(255, 255, 255, 0.035) 8px,
            transparent 8px,
            transparent 16px
        );
    color: var(--white);
    text-align: center;
}

.ev-detail-hero__placeholder span {
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    color: rgba(240, 240, 244, 0.62);
}

.ev-detail-hero__placeholder strong {
    font-size: 1.05rem;
    letter-spacing: 0.08em;
}

.ev-detail-hero__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.ev-detail-kicker {
    margin-bottom: 8px;
    color: var(--yellow);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.ev-detail-title {
    margin: 0;
    color: var(--white);
    font-size: clamp(1.65rem, 2.4vw, 2.55rem);
    line-height: 1.04;
    letter-spacing: -0.035em;
    text-transform: uppercase;
}

.ev-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
    color: rgba(240, 240, 244, 0.74);
    font-size: 0.92rem;
}

.ev-detail-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 7px 11px;
    border: 1px solid rgba(240, 240, 244, 0.08);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.22);
}

.ev-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.ev-detail-status {
    align-self: start;
    padding: 9px 13px;
    border-radius: 999px;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
}

.ev-detail-status--pre {
    background: #71717a;
}

.ev-detail-status--booking {
    background: #2563eb;
}

.ev-detail-status--ready {
    background: #15803d;
}

.ev-detail-status--aired {
    background: #52525b;
}

.ev-detail-status--cancelled {
    background: var(--red);
}

.ev-detail-status--default {
    background: #71717a;
}

.ev-detail-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.ev-detail-stat {
    padding: 16px;
    border: 1px solid rgba(240, 240, 244, 0.08);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
        rgba(14, 14, 18, 0.86);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
}

.ev-detail-stat span {
    display: block;
    margin-bottom: 7px;
    color: rgba(240, 240, 244, 0.58);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.ev-detail-stat strong {
    display: block;
    color: var(--white);
    font-size: 1rem;
    line-height: 1.25;
}

.ev-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}

.ev-detail-card,
.ev-image-card,
.ev-danger-card {
    border-radius: 20px;
    overflow: hidden;
}

.ev-detail-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ev-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.ev-form-grid .form-row {
    margin: 0;
}

.ev-form-grid .form-row label {
    margin-bottom: 7px;
    color: rgba(240, 240, 244, 0.72);
    font-size: 0.73rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.13em;
}

.ev-form-grid input,
.ev-form-grid select {
    width: 100%;
    min-height: 44px;
    border-radius: 13px;
    border: 1px solid rgba(240, 240, 244, 0.12);
    background: rgba(0, 0, 0, 0.28);
    color: var(--white);
    outline: none;
}

.ev-form-grid input:focus,
.ev-form-grid select:focus {
    border-color: rgba(231, 76, 60, 0.72);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.14);
}

.ev-current-venue {
    padding: 14px 16px;
    border: 1px solid rgba(243, 156, 18, 0.20);
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(243, 156, 18, 0.10), rgba(0, 0, 0, 0.16));
}

.ev-current-venue span {
    display: block;
    margin-bottom: 5px;
    color: rgba(240, 240, 244, 0.58);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.13em;
}

.ev-current-venue strong {
    color: var(--white);
    font-size: 0.98rem;
}

.ev-detail-submit {
    display: flex;
    justify-content: flex-start;
}

.ev-image-preview {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(240, 240, 244, 0.10);
    background: rgba(0, 0, 0, 0.30);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.ev-image-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ev-image-preview__empty {
    height: 100%;
    display: grid;
    place-items: center;
    background:
        linear-gradient(135deg, rgba(122, 31, 22, 0.62), rgba(0, 0, 0, 0.58)),
        repeating-linear-gradient(
            -45deg,
            rgba(255, 255, 255, 0.035),
            rgba(255, 255, 255, 0.035) 8px,
            transparent 8px,
            transparent 16px
        );
    color: rgba(240, 240, 244, 0.76);
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.ev-image-note {
    margin-top: 12px;
    padding: 12px 13px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.20);
    color: rgba(240, 240, 244, 0.64);
    font-size: 0.86rem;
    line-height: 1.45;
}

.ev-danger-card {
    border-color: rgba(192, 57, 43, 0.28);
}

.ev-danger-form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.ev-danger-form strong {
    display: block;
    margin-bottom: 4px;
    color: var(--white);
    font-size: 1rem;
}

.ev-danger-form p {
    margin: 0;
    color: rgba(240, 240, 244, 0.62);
}

@media (max-width: 1180px) {
    .ev-detail-hero {
        grid-template-columns: 180px minmax(0, 1fr);
    }

    .ev-detail-status {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .ev-detail-grid {
        grid-template-columns: 1fr;
    }

    .ev-image-card {
        order: -1;
    }
}

@media (max-width: 860px) {
    .ev-detail-hero {
        grid-template-columns: 1fr;
    }

    .ev-detail-hero__image {
        min-height: 190px;
    }

    .ev-detail-hero__image img,
    .ev-detail-hero__placeholder {
        min-height: 190px;
    }

    .ev-detail-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ev-form-grid {
        grid-template-columns: 1fr;
    }

    .ev-danger-form {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .ev-detail-page {
        gap: 16px;
    }

    .ev-detail-hero {
        padding: 14px;
        border-radius: 18px;
    }

    .ev-detail-title {
        font-size: 1.45rem;
    }

    .ev-detail-meta span {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .ev-detail-actions {
        flex-direction: column;
    }

    .ev-detail-actions .button,
    .ev-detail-actions .button-red {
        width: 100%;
        justify-content: center;
    }

    .ev-detail-stats {
        grid-template-columns: 1fr;
    }
}

/* ─────────────────────────────────────────────────────────────
   Event Detail / View Page — Sharp eMS v3 Style
───────────────────────────────────────────────────────────── */

.ev-detail-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Top event display */
.ev-detail-hero {
    position: relative;
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    min-height: 116px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    background:
        linear-gradient(90deg, rgba(204, 0, 0, 0.20), rgba(10, 10, 11, 0.96) 42%),
        var(--panel);
    overflow: hidden;
}

.ev-detail-hero::before {
    content: none;
}

.ev-detail-hero > * {
    position: relative;
    z-index: 1;
}

.ev-detail-hero__image {
    width: 150px;
    height: 84px;
    min-height: 0;
    overflow: hidden;
    background: var(--black);
    border: 1px solid var(--border);
}

.ev-detail-hero__image img {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    object-position: center;
}

.ev-detail-hero__placeholder {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: var(--black);
    color: var(--silver);
    text-align: center;
    border: 1px dashed var(--border);
}

.ev-detail-hero__placeholder span {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--silver);
}

.ev-detail-hero__placeholder strong {
    font-family: var(--font-head);
    font-size: 16px;
    letter-spacing: 2px;
    color: var(--white);
}

.ev-detail-hero__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.ev-detail-kicker {
    margin: 0 0 4px;
    color: var(--yellow);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.ev-detail-title {
    margin: 0;
    color: var(--white);
    font-family: var(--font-head);
    font-size: 34px;
    line-height: 1;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.ev-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 10px;
}

.ev-detail-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    background: var(--black);
}

.ev-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.ev-detail-status {
    align-self: start;
    padding: 6px 10px;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,.12);
}

.ev-detail-status--pre {
    background: var(--silver);
}

.ev-detail-status--booking {
    background: var(--blue-hi);
}

.ev-detail-status--ready {
    background: var(--green);
}

.ev-detail-status--aired {
    background: var(--border);
}

.ev-detail-status--cancelled {
    background: var(--red);
}

.ev-detail-status--default {
    background: var(--silver);
}

/* Stat strip */
.ev-detail-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.ev-detail-stat {
    padding: 14px 16px;
    border: 1px solid var(--border);
    background: var(--panel);
}

.ev-detail-stat span {
    display: block;
    margin-bottom: 6px;
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.ev-detail-stat strong {
    display: block;
    color: var(--white);
    font-size: 15px;
    line-height: 1.25;
}

/* Main edit form layout */
.ev-detail-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ev-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 16px;
    align-items: start;
}

.ev-detail-card,
.ev-image-card,
.ev-danger-card,
.ev-card-builder {
    border-radius: 0;
    overflow: hidden;
}

/* Fields */
.ev-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.ev-form-grid .form-row {
    margin: 0;
    padding: 0;
}

.ev-form-grid .form-row--full {
    grid-column: 1 / -1;
}

.ev-form-grid .form-row label,
.ev-builder-heading h3 {
    display: block;
    margin-bottom: 6px;
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.ev-form-grid input,
.ev-form-grid select,
.ev-form-grid textarea {
    width: 100%;
    min-height: 38px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--black);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 11px;
    outline: none;
}

.ev-form-grid input[type="file"] {
    padding: 8px 10px;
    color: var(--light);
}

.ev-form-grid input:focus,
.ev-form-grid select:focus,
.ev-form-grid textarea:focus {
    border-color: var(--red);
}

/* Native dropdown readability */
.ev-form-grid select,
.ev-detail-page select,
.ul-filter-select,
.ue-select,
.ch-select,
.ev-action-select {
    background-color: var(--black);
    color: var(--white);
}

.ev-form-grid select option,
.ev-detail-page select option,
.ul-filter-select option,
.ue-select option,
.ch-select option,
.ev-action-select option {
    background-color: #151519;
    color: #ffffff;
}

.ev-form-grid select option:checked,
.ev-detail-page select option:checked,
.ul-filter-select option:checked,
.ue-select option:checked,
.ch-select option:checked,
.ev-action-select option:checked {
    background-color: var(--red);
    color: #ffffff;
}

.ev-field-help {
    margin: 6px 0 0;
    color: var(--silver);
    font-size: 11px;
    line-height: 1.45;
}

/* Current venue box */
.ev-current-venue {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(243, 156, 18, 0.35);
    background: rgba(243, 156, 18, 0.06);
}

.ev-current-venue span {
    display: block;
    margin-bottom: 5px;
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.ev-current-venue strong {
    color: var(--white);
    font-size: 13px;
}

/* Event image card */
.ev-image-preview {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--border);
    background: var(--black);
    overflow: hidden;
}

.ev-image-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ev-image-preview__empty {
    height: 100%;
    display: grid;
    place-items: center;
    background: var(--black);
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: 1px dashed var(--border);
}

.ev-image-note {
    margin-top: 10px;
    padding: 10px;
    background: var(--black);
    border: 1px solid var(--border);
    color: var(--silver);
    font-size: 12px;
    line-height: 1.45;
}

/* Event card / Phase 2 area */
.ev-card-builder .ap-module__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ev-builder-section {
    padding: 14px;
    border: 1px solid var(--border);
    background: var(--black);
}

.ev-builder-heading {
    margin-bottom: 10px;
}

.ev-builder-heading h3 {
    margin-top: 0;
    color: var(--white);
    font-family: var(--font-head);
    font-size: 18px;
    letter-spacing: 2px;
}

.ev-builder-heading p {
    margin: 0;
    color: var(--silver);
    font-size: 12px;
    line-height: 1.45;
}

.ev-builder-section textarea {
    width: 100%;
    min-height: 180px;
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--surface);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
}

.ev-builder-section textarea:focus {
    border-color: var(--red);
}

.ev-match-placeholder {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 72px;
    padding: 14px;
    border: 1px dashed var(--border);
    background: var(--surface);
}

.ev-match-placeholder__icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    background: var(--red);
    color: #fff;
    font-family: var(--font-head);
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
}

.ev-match-placeholder strong {
    display: block;
    margin-bottom: 3px;
    color: var(--white);
    font-size: 13px;
}

.ev-match-placeholder span {
    display: block;
    color: var(--silver);
    font-size: 12px;
}

/* Save button */
.ev-sticky-save {
    position: static;
    display: flex;
    justify-content: flex-end;
    padding: 0;
    background: transparent;
}

.ev-save-button {
    min-height: 38px;
    padding: 0 18px;
    border-radius: 0;
    background: var(--red);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: none;
}

.ev-save-button:hover {
    background: var(--red-glow);
}

/* Danger zone */
.ev-danger-card {
    border-color: var(--red-dim);
}

.ev-delete-warning {
    padding: 12px 14px;
    border: 1px solid var(--red-dim);
    background: rgba(204, 0, 0, 0.08);
}

.ev-delete-warning strong {
    display: block;
    margin-bottom: 6px;
    color: var(--white);
    font-size: 13px;
}

.ev-delete-warning p {
    margin: 0;
    color: var(--silver);
    font-size: 12px;
    line-height: 1.5;
}

.ev-danger-form {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.ev-delete-button {
    min-height: 34px;
    padding: 0 14px;
    border-radius: 0;
    background: transparent;
    border: 1px solid var(--red-dim);
    color: var(--red-glow);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: none;
}

.ev-delete-button:hover {
    background: var(--red-dim);
}

/* TinyMCE dark/sharp */
.tox-tinymce {
    border-radius: 0 !important;
    border-color: var(--border) !important;
    overflow: hidden;
}

.tox .tox-toolbar,
.tox .tox-toolbar__primary,
.tox .tox-edit-area__iframe,
.tox .tox-statusbar,
.tox .tox-menubar {
    background: var(--surface) !important;
}

.tox .tox-tbtn,
.tox .tox-mbtn,
.tox .tox-statusbar,
.tox .tox-statusbar a {
    color: var(--white) !important;
}

/* Responsive */
@media (max-width: 1180px) {
    .ev-detail-hero {
        grid-template-columns: 130px minmax(0, 1fr);
    }

    .ev-detail-hero__image {
        width: 130px;
        height: 74px;
    }

    .ev-detail-status {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .ev-detail-grid {
        grid-template-columns: 1fr;
    }

    .ev-image-card {
        order: -1;
    }
}

@media (max-width: 860px) {
    .ev-detail-hero {
        grid-template-columns: 1fr;
    }

    .ev-detail-hero__image {
        width: 100%;
        height: 160px;
    }

    .ev-detail-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ev-form-grid {
        grid-template-columns: 1fr;
    }

    .ev-match-placeholder {
        align-items: flex-start;
    }
}

@media (max-width: 560px) {
    .ev-detail-page {
        gap: 14px;
    }

    .ev-detail-title {
        font-size: 28px;
    }

    .ev-detail-meta span {
        width: 100%;
    }

    .ev-detail-actions {
        flex-direction: column;
    }

    .ev-detail-actions .button,
    .ev-detail-actions .button-red {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .ev-detail-stats {
        grid-template-columns: 1fr;
    }

    .ev-sticky-save {
        justify-content: stretch;
    }

    .ev-save-button {
        width: 100%;
    }
}

/* ─────────────────────────────────────────────────────────────
   Event Detail — final sharp-corner overrides
───────────────────────────────────────────────────────────── */

.ev-detail-page *,
.ev-detail-page *::before,
.ev-detail-page *::after {
    border-radius: 0 !important;
}

/* Top hero should not feel like a giant rounded banner */
.ev-detail-hero {
    min-height: 96px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    background:
        linear-gradient(90deg, rgba(204, 0, 0, 0.18), rgba(10, 10, 11, 0.96) 38%),
        var(--panel);
    box-shadow: none;
}

.ev-detail-hero__image {
    width: 132px;
    height: 74px;
    min-height: 0;
}

.ev-detail-hero__image img {
    min-height: 0;
}

.ev-detail-title {
    font-size: 30px;
    letter-spacing: 3px;
}

.ev-detail-meta {
    margin-top: 8px;
}

.ev-detail-meta span {
    min-height: 22px;
    padding: 3px 7px;
}

/* Stat cards should match the regular admin modules/tables */
.ev-detail-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.ev-detail-stat {
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: var(--panel);
    box-shadow: none;
}

.ev-detail-stat span {
    margin-bottom: 6px;
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.ev-detail-stat strong {
    color: var(--white);
    font-size: 14px;
    line-height: 1.2;
}

/* Keep the edit grid tight */
.ev-detail-grid {
    gap: 16px;
}

.ev-detail-form {
    gap: 16px;
}

.ev-form-grid {
    gap: 14px;
}

.ev-form-grid input,
.ev-form-grid select,
.ev-form-grid textarea {
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 0 !important;
    box-shadow: none;
}

/* Event image sidebar square and compact */
.ev-image-preview {
    border-radius: 0 !important;
    box-shadow: none;
}

.ev-image-note {
    border-radius: 0 !important;
}

/* Status pill becomes a square badge */
.ev-detail-status {
    border-radius: 0 !important;
    box-shadow: none;
}

/* Current venue box square */
.ev-current-venue {
    border-radius: 0 !important;
}

/* Phase 2 boxes square */
.ev-builder-section,
.ev-match-placeholder,
.ev-match-placeholder__icon,
.ev-delete-warning,
.ev-save-button,
.ev-delete-button {
    border-radius: 0 !important;
}

/* ── Event View: Match Card Builder ─────────────────────────────────────── */

.ev-card-builder .ap-module__body {
    display: grid;
    gap: 14px;
}

.ev-builder-collapse {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(135deg, rgba(160, 0, 0, 0.12), transparent 42%),
        #111;
}

.ev-builder-collapse[open] {
    border-color: rgba(204, 0, 0, 0.42);
}

.ev-builder-collapse summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
    border-left: 3px solid #b30000;
}

.ev-builder-collapse summary::-webkit-details-marker {
    display: none;
}

.ev-builder-collapse summary span {
    color: #fff;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ev-builder-collapse summary small {
    color: var(--silver);
    font-size: 12px;
    line-height: 1.35;
    text-align: right;
}

.ev-builder-collapse summary::after {
    content: "+";
    flex: 0 0 auto;
    color: #ff1f1f;
    font-size: 18px;
    font-weight: 900;
}

.ev-builder-collapse[open] summary::after {
    content: "–";
}

.ev-builder-collapse__body {
    padding: 12px 14px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ev-card-main {
    display: grid;
    gap: 14px;
}

.ev-card-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ev-action-tile {
    width: 100%;
    min-height: 94px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1px dashed #cc0000;
    background:
        radial-gradient(circle at 8% 18%, rgba(126, 0, 0, 0.32), transparent 24%),
        linear-gradient(135deg, rgba(120, 0, 0, 0.15), transparent 55%),
        #130d0d;
    color: #fff;
    text-align: left;
    cursor: pointer;
    box-shadow: none;
    border-radius: 0;
}

.ev-action-tile:hover,
.ev-action-tile.is-active {
    border-color: #ff1f1f;
    background:
        radial-gradient(circle at 8% 18%, rgba(180, 0, 0, 0.42), transparent 24%),
        linear-gradient(135deg, rgba(160, 0, 0, 0.2), transparent 55%),
        #170d0d;
}

.ev-action-tile__icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(204, 0, 0, 0.65);
    background: rgba(204, 0, 0, 0.14);
    color: #a985ff;
    font-size: 34px;
    font-weight: 300;
    line-height: 1;
    border-radius: 50%;
}

.ev-action-tile__text {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.ev-action-tile__text strong {
    color: #fff;
    font-family: var(--font-display);
    font-size: 17px;
    line-height: 1;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ev-action-tile__text small {
    color: #b9b6c7;
    font-size: 12px;
    line-height: 1.35;
}

.ev-action-tile__plus {
    color: #ff1f1f;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
}

.ev-card-panel {
    padding: 14px;
    border: 1px solid rgba(204, 0, 0, 0.34);
    background:
        linear-gradient(135deg, rgba(80, 0, 0, 0.18), transparent 50%),
        #101010;
}

.ev-card-panel__head {
    margin-bottom: 14px;
}

.ev-card-panel__head h3 {
    margin: 0;
    color: #fff;
    font-family: var(--font-display);
    font-size: 18px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ev-card-panel__head p {
    margin: 6px 0 0;
    color: var(--silver);
    font-size: 13px;
    line-height: 1.45;
}

.ev-card-panel__actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.ev-field-help {
    margin: 6px 0 0;
    color: var(--silver);
    font-size: 12px;
    line-height: 1.4;
}

.ev-card-list-wrap {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #0f0f0f;
}

.ev-card-list-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #121212;
}

.ev-card-list-head h3 {
    margin: 0;
    color: #fff;
    font-family: var(--font-display);
    font-size: 18px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ev-card-list-head p {
    margin: 5px 0 0;
    color: var(--silver);
    font-size: 12px;
    line-height: 1.35;
}

.ev-card-reorder-note {
    color: #d7b45a;
    font-size: 11px;
    font-weight: 800;
    text-align: right;
    text-transform: uppercase;
}

.ev-card-empty {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    margin: 14px;
    background: rgba(255, 255, 255, 0.025);
}

.ev-card-empty__icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(204, 0, 0, 0.55);
    color: #ff1f1f;
    font-size: 30px;
    line-height: 1;
}

.ev-card-empty strong {
    display: block;
    color: #fff;
    font-size: 14px;
    text-transform: uppercase;
}

.ev-card-empty span {
    display: block;
    margin-top: 3px;
    color: var(--silver);
    font-size: 12px;
}

.ev-card-list {
    display: grid;
}

.ev-card-item {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: stretch;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: #101010;
}

.ev-card-item:last-child {
    border-bottom: 0;
}

.ev-card-item:hover {
    background:
        linear-gradient(90deg, rgba(130, 0, 0, 0.12), transparent 36%),
        #111;
}

.ev-card-item--segment {
    background:
        linear-gradient(90deg, rgba(214, 165, 54, 0.06), transparent 30%),
        #101010;
}

.ev-card-item__order {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ev-card-item__number {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(204, 0, 0, 0.42);
    background: #171717;
    color: #fff;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 900;
}

.ev-card-item__move {
    display: grid;
    gap: 4px;
}

.ev-card-move-btn {
    width: 26px;
    height: 16px;
    min-height: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #1a1a1a;
    color: #fff;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    border-radius: 0;
}

.ev-card-move-btn:hover:not(:disabled) {
    border-color: rgba(204, 0, 0, 0.65);
    background: #250909;
}

.ev-card-move-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.ev-card-item__main {
    min-width: 0;
}

.ev-card-item__topline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.ev-card-type,
.ev-card-status {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 3px 7px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #181818;
    color: #d8d8d8;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ev-card-type--match {
    border-color: rgba(204, 0, 0, 0.5);
    color: #ffb3b3;
}

.ev-card-type--segment {
    border-color: rgba(214, 165, 54, 0.5);
    color: #f0d184;
}

.ev-card-status--reserved {
    color: #b9b6c7;
}

.ev-card-status--draft {
    color: #d7b45a;
}

.ev-card-status--submitted,
.ev-card-status--released {
    color: #8ee59f;
}

.ev-card-status--hidden {
    border-color: rgba(255, 55, 55, 0.45);
    color: #ff9999;
}

.ev-card-item__main h3 {
    margin: 0;
    color: #fff;
    font-size: 16px;
    line-height: 1.25;
}

.ev-card-item__main p {
    margin: 6px 0 0;
    color: var(--silver);
    font-size: 12px;
    line-height: 1.35;
}

.ev-card-item__main p strong {
    color: #fff;
}

.ev-card-item__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.ev-card-locked {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--silver);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.ev-detail-form select option,
.ev-card-panel select option {
    background: #111;
    color: #f4f4f4;
}

.ev-detail-form input,
.ev-detail-form select,
.ev-detail-form textarea,
.ev-card-panel input,
.ev-card-panel select,
.ev-card-panel textarea,
.ev-builder-collapse textarea {
    border-radius: 0;
}

@media (max-width: 860px) {
    .ev-card-actions-grid {
        grid-template-columns: 1fr;
    }

    .ev-card-item {
        grid-template-columns: 56px minmax(0, 1fr);
    }

    .ev-card-item__actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding-left: 68px;
    }
}

@media (max-width: 620px) {
    .ev-builder-collapse summary {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .ev-builder-collapse summary small {
        text-align: left;
    }

    .ev-action-tile {
        grid-template-columns: 38px minmax(0, 1fr) 18px;
        min-height: 82px;
        padding: 12px;
    }

    .ev-action-tile__icon {
        width: 36px;
        height: 36px;
        font-size: 28px;
    }

    .ev-card-list-head {
        display: grid;
    }

    .ev-card-reorder-note {
        text-align: left;
    }

    .ev-card-item {
        grid-template-columns: 48px minmax(0, 1fr);
        gap: 10px;
        padding: 11px;
    }

    .ev-card-item__number {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    .ev-card-item__actions {
        padding-left: 58px;
    }

    .ev-card-item__actions .button {
        width: 100%;
    }
}

/* ── Event Card Editors ─────────────────────────────────────────────────── */

.ev-card-editor-page {
    display: grid;
    gap: 16px;
}

.ev-card-editor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(135deg, rgba(130, 0, 0, 0.16), transparent 46%),
        #101010;
}

.ev-card-editor-header h1 {
    margin: 4px 0 0;
    color: #fff;
    font-family: var(--font-display);
    font-size: 28px;
    line-height: 1.05;
    text-transform: uppercase;
}

.ev-card-editor-header p {
    margin: 7px 0 0;
    color: var(--silver);
    font-size: 13px;
}

.ev-card-editor-form {
    display: grid;
    gap: 16px;
}

.ev-phase-placeholder {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px dashed rgba(214, 165, 54, 0.45);
    background: rgba(214, 165, 54, 0.06);
}

.ev-phase-placeholder strong {
    color: #fff;
    font-size: 13px;
    text-transform: uppercase;
}

.ev-phase-placeholder span {
    color: var(--silver);
    font-size: 12px;
}

.ev-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    color: #fff;
    font-weight: 800;
}

.ev-check-row input {
    width: auto;
}

.ev-bubble-box {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    min-height: 44px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #080808;
}

.ev-bubble-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 6px 9px;
    border: 1px solid rgba(204, 0, 0, 0.4);
    background: rgba(204, 0, 0, 0.12);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.ev-bubble-remove {
    width: 18px;
    height: 18px;
    min-height: 0;
    padding: 0;
    border: 1px solid rgba(255, 120, 120, 0.3);
    background: #260505;
    color: #ffb3b3;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}

.ev-bubble-remove:hover {
    background: #7b1111;
    color: #fff;
}

.ev-results-table-wrap {
    margin-top: 10px;
}

.ev-results-table th,
.ev-results-table td {
    text-align: center;
}

.ev-results-table th:first-child,
.ev-results-table td:first-child {
    text-align: left;
}

.ev-result-choice input {
    width: auto;
}

.ev-preview-row {
    margin: 10px 0 14px;
    display: flex;
    justify-content: flex-start;
}

.ev-card-editor-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #101010;
}

@media (max-width: 760px) {
    .ev-card-editor-header {
        display: grid;
    }

    .ev-card-editor-header .ev-detail-actions {
        justify-content: flex-start;
    }

    .ev-card-editor-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .ev-card-editor-actions .button,
    .ev-card-editor-actions button {
        width: 100%;
    }
}

.ev-readonly-field {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #080808;
    color: #fff;
    font-weight: 800;
}

/* ── Event Detail Sidebar Layout ───────────────────────────────────────── */

.ev-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 16px;
    align-items: start;
}

.ev-detail-form > .ev-card-builder,
.ev-detail-form > .ev-sticky-save,
.ev-detail-page > .ev-danger-card {
    margin-right: 276px;
}

.ev-image-card {
    align-self: start;
}

.ev-image-card .ap-module__body {
    padding: 12px;
}

.ev-image-preview {
    background: #080808;
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
}

.ev-image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.ev-image-note {
    margin-top: 10px;
    padding: 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: var(--silver);
    font-size: 12px;
    line-height: 1.5;
}

/* ── TinyMCE fallback textarea styling ─────────────────────────────────── */

textarea.tinymce,
.ev-builder-collapse textarea,
.ev-card-content-editor {
    width: 100%;
    min-height: 260px;
    background: #090909 !important;
    color: #f4f4f4 !important;
    border: 1px solid rgba(255,255,255,0.14);
    padding: 10px;
    border-radius: 0;
    box-sizing: border-box;
}

.tox.tox-tinymce {
    border-radius: 0 !important;
    border: 1px solid rgba(204, 0, 0, 0.42) !important;
}

.tox .tox-edit-area__iframe {
    background: #111 !important;
}

/* ── Event Card Builder Tiles ──────────────────────────────────────────── */

.ev-card-builder .ap-module__body {
    display: grid;
    gap: 14px;
}

.ev-card-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ev-action-tile {
    width: 100%;
    min-height: 94px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1px dashed #cc0000;
    background:
        radial-gradient(circle at 8% 18%, rgba(126, 0, 0, 0.32), transparent 24%),
        linear-gradient(135deg, rgba(120, 0, 0, 0.15), transparent 55%),
        #130d0d;
    color: #fff;
    text-align: left;
    cursor: pointer;
    box-shadow: none;
    border-radius: 0;
}

.ev-action-tile:hover,
.ev-action-tile.is-active {
    border-color: #ff1f1f;
    background:
        radial-gradient(circle at 8% 18%, rgba(180, 0, 0, 0.42), transparent 24%),
        linear-gradient(135deg, rgba(160, 0, 0, 0.2), transparent 55%),
        #170d0d;
}

.ev-action-tile__icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(204, 0, 0, 0.65);
    background: rgba(204, 0, 0, 0.14);
    color: #a985ff;
    font-size: 34px;
    font-weight: 300;
    line-height: 1;
    border-radius: 50%;
}

.ev-action-tile__text {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.ev-action-tile__text strong {
    color: #fff;
    font-family: var(--font-display);
    font-size: 17px;
    line-height: 1;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ev-action-tile__text small {
    color: #b9b6c7;
    font-size: 12px;
    line-height: 1.35;
}

.ev-action-tile__plus {
    color: #ff1f1f;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
}

/* ── Event Card Panels ─────────────────────────────────────────────────── */

.ev-card-panel {
    padding: 14px;
    border: 1px solid rgba(204, 0, 0, 0.34);
    background:
        linear-gradient(135deg, rgba(80, 0, 0, 0.18), transparent 50%),
        #101010;
}

.ev-card-panel__head {
    margin-bottom: 14px;
}

.ev-card-panel__head h3 {
    margin: 0;
    color: #fff;
    font-family: var(--font-display);
    font-size: 18px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ev-card-panel__head p {
    margin: 6px 0 0;
    color: var(--silver);
    font-size: 13px;
    line-height: 1.45;
}

.ev-card-panel__actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.ev-card-panel__actions .button,
.ev-card-panel__actions button {
    min-width: 150px;
    min-height: 38px;
    padding: 9px 16px;
    border: 1px solid #cc0000;
    background: #cc0000;
    color: #fff !important;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 0;
}

.ev-card-panel__actions .button:hover,
.ev-card-panel__actions button:hover {
    background: #e00000;
    border-color: #ff1f1f;
    color: #fff !important;
}

/* ── Dark multi-select + scrollbars ─────────────────────────────────────── */

.ev-card-panel select[multiple],
.ev-card-panel select[size],
.ev-detail-form select[multiple],
.ev-detail-form select[size] {
    min-height: 120px;
    background: #080808;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.14);
    scrollbar-color: #cc0000 #111;
    scrollbar-width: thin;
}

.ev-card-panel select[multiple] option,
.ev-card-panel select[size] option,
.ev-detail-form select[multiple] option,
.ev-detail-form select[size] option {
    padding: 5px 8px;
    background: #090909;
    color: #fff;
}

.ev-card-panel select[multiple] option:checked,
.ev-card-panel select[size] option:checked,
.ev-detail-form select[multiple] option:checked,
.ev-detail-form select[size] option:checked {
    background: #cc0000;
    color: #fff;
}

.ev-card-panel select[multiple]::-webkit-scrollbar,
.ev-card-panel select[size]::-webkit-scrollbar,
.ev-detail-form select[multiple]::-webkit-scrollbar,
.ev-detail-form select[size]::-webkit-scrollbar {
    width: 10px;
}

.ev-card-panel select[multiple]::-webkit-scrollbar-track,
.ev-card-panel select[size]::-webkit-scrollbar-track,
.ev-detail-form select[multiple]::-webkit-scrollbar-track,
.ev-detail-form select[size]::-webkit-scrollbar-track {
    background: #111;
}

.ev-card-panel select[multiple]::-webkit-scrollbar-thumb,
.ev-card-panel select[size]::-webkit-scrollbar-thumb,
.ev-detail-form select[multiple]::-webkit-scrollbar-thumb,
.ev-detail-form select[size]::-webkit-scrollbar-thumb {
    background: #cc0000;
    border: 2px solid #111;
}

/* ── Match Card List / Submit Buttons / Drag State ─────────────────────── */

.ev-card-list-wrap {
    border: 1px solid rgba(255,255,255,0.08);
    background: #0f0f0f;
}

.ev-card-list-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: #121212;
}

.ev-card-list-head h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    text-transform: uppercase;
}

.ev-card-list-head p {
    margin: 5px 0 0;
    color: var(--silver);
    font-size: 12px;
}

.ev-card-reorder-note {
    color: #d7b45a;
    font-size: 11px;
    font-weight: 900;
    text-align: right;
    text-transform: uppercase;
}

.ev-card-list {
    display: grid;
}

.ev-card-item {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: stretch;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    background: #101010;
}

.ev-card-item--draggable {
    cursor: grab;
}

.ev-card-item--draggable:active,
.ev-card-item.is-dragging {
    cursor: grabbing;
}

.ev-card-item.is-dragging {
    opacity: 0.55;
    outline: 1px dashed #cc0000;
    background: #210808;
}

.ev-card-item:hover {
    background:
        linear-gradient(90deg, rgba(130,0,0,0.12), transparent 36%),
        #111;
}

.ev-card-item--segment {
    background:
        linear-gradient(90deg, rgba(214,165,54,0.06), transparent 30%),
        #101010;
}

.ev-card-item__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.ev-card-item__actions .button {
    min-width: 92px;
    min-height: 34px;
    padding: 8px 13px;
    border: 1px solid #d7b45a;
    background: #d7b45a;
    color: #080808 !important;
    font-size: 12px;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 0;
}

.ev-card-item__actions .button:hover {
    border-color: #ffdc73;
    background: #ffdc73;
    color: #000 !important;
}

.ev-card-item__number {
    width: 34px;
    height: 34px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(204,0,0,0.42);
    background: #171717;
    color: #fff;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 900;
}

.ev-card-move-btn {
    width: 26px;
    height: 16px;
    min-height: 0;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.14);
    background: #1a1a1a;
    color: #fff;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    border-radius: 0;
}

.ev-card-move-btn:hover:not(:disabled) {
    border-color: rgba(204,0,0,0.65);
    background: #250909;
}

.ev-card-move-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ── Collapsible Preview/Conclusion ────────────────────────────────────── */

.ev-builder-collapse {
    border: 1px solid rgba(204,0,0,0.42);
    background:
        linear-gradient(135deg, rgba(160,0,0,0.12), transparent 42%),
        #111;
}

.ev-builder-collapse summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
    border-left: 3px solid #cc0000;
}

.ev-builder-collapse summary::-webkit-details-marker {
    display: none;
}

.ev-builder-collapse summary span {
    color: #fff;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ev-builder-collapse summary small {
    color: var(--silver);
    font-size: 12px;
    line-height: 1.35;
    text-align: right;
}

.ev-builder-collapse summary::after {
    content: "+";
    color: #ff1f1f;
    font-size: 18px;
    font-weight: 900;
}

.ev-builder-collapse[open] summary::after {
    content: "–";
}

.ev-builder-collapse__body {
    padding: 12px 14px 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── Mobile ────────────────────────────────────────────────────────────── */

@media (max-width: 980px) {
    .ev-detail-grid {
        grid-template-columns: 1fr;
    }

    .ev-detail-form > .ev-card-builder,
    .ev-detail-form > .ev-sticky-save,
    .ev-detail-page > .ev-danger-card {
        margin-right: 0;
    }

    .ev-card-actions-grid {
        grid-template-columns: 1fr;
    }

    .ev-card-item {
        grid-template-columns: 56px minmax(0, 1fr);
    }

    .ev-card-item__actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding-left: 68px;
    }
}

@media (max-width: 620px) {
    .ev-action-tile {
        grid-template-columns: 38px minmax(0, 1fr) 18px;
        min-height: 82px;
        padding: 12px;
    }

    .ev-action-tile__icon {
        width: 36px;
        height: 36px;
        font-size: 28px;
    }

    .ev-card-item {
        grid-template-columns: 48px minmax(0, 1fr);
        gap: 10px;
        padding: 11px;
    }

    .ev-card-item__actions {
        padding-left: 58px;
    }

    .ev-card-item__actions .button {
        width: 100%;
    }
}

/* ── Event Card Submit Pages: Match/Segment CSS Cleanup ─────────────────── */

/* Keep editor pages using normal vertical module flow */
.ev-card-editor-page .ap-module__body {
    padding: 16px;
}

.ev-card-editor-form .form-row,
.ev-card-editor-form .form-row--full {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100%;
}

.ev-card-editor-form label {
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* TinyMCE should sit cleanly inside the module */
.ev-card-editor-form .tox.tox-tinymce {
    width: 100% !important;
    min-height: 340px;
    border: 1px solid rgba(204, 0, 0, 0.55) !important;
    background: #0b0b0d !important;
    box-sizing: border-box;
}

.ev-card-editor-form .tox .tox-toolbar,
.ev-card-editor-form .tox .tox-toolbar__overflow,
.ev-card-editor-form .tox .tox-toolbar__primary,
.ev-card-editor-form .tox .tox-menubar {
    background: #11151d !important;
}

.ev-card-editor-form .tox .tox-statusbar {
    background: #090909 !important;
    color: #fff !important;
    border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
}

/* Preview button row */
.ev-preview-row {
    margin: 12px 0 18px;
    display: flex;
    justify-content: flex-start;
}

.ev-preview-row .button {
    min-width: 110px;
    padding: 9px 16px;
    border: 1px solid #d7b45a;
    background: #d7b45a;
    color: #080808 !important;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ev-preview-row .button:hover {
    background: #ffdc73;
    border-color: #ffdc73;
}

/* Internal notes textarea cleanup */
.ev-card-editor-form textarea:not(.tinymce) {
    width: 100%;
    min-height: 120px;
    padding: 10px 12px;
    background: #080808 !important;
    color: #f4f4f4 !important;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0;
    box-sizing: border-box;
    resize: vertical;
}

.ev-card-editor-form textarea:not(.tinymce)::placeholder {
    color: #8f8a9c;
}

/* Results table cleanup */
.ev-results-table-wrap {
    margin-top: 12px;
    overflow-x: auto;
}

.ev-results-table {
    width: 100%;
    border-collapse: collapse;
    background: #090909;
}

.ev-results-table th,
.ev-results-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 13px;
    text-align: center;
    vertical-align: middle;
}

.ev-results-table th {
    color: #d7b45a;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: #111;
}

.ev-results-table th:first-child,
.ev-results-table td:first-child {
    text-align: left;
    font-weight: 900;
}

.ev-result-choice input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #cc0000;
}

/* Bottom action bar — make buttons visible/prominent */
.ev-card-editor-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #101010;
}

.ev-card-editor-actions .button,
.ev-card-editor-actions button {
    min-width: 130px;
    min-height: 38px;
    padding: 9px 16px;
    border-radius: 0;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
    cursor: pointer;
}

.ev-card-editor-actions .button:not(.button-red),
.ev-card-editor-actions button:not(.button-red) {
    border: 1px solid #d7b45a;
    background: #d7b45a;
    color: #080808 !important;
}

.ev-card-editor-actions .button:not(.button-red):hover,
.ev-card-editor-actions button:not(.button-red):hover {
    background: #ffdc73;
    border-color: #ffdc73;
    color: #000 !important;
}

.ev-card-editor-actions .button-red,
.ev-card-editor-actions button.button-red {
    border: 1px solid #cc0000;
    background: #cc0000;
    color: #fff !important;
}

.ev-card-editor-actions .button-red:hover,
.ev-card-editor-actions button.button-red:hover {
    background: #e00000;
    border-color: #ff1f1f;
    color: #fff !important;
}

/* Delete button slightly separated/clear */
.ev-card-editor-actions button[value="delete"] {
    margin-right: auto;
    border-color: rgba(204, 0, 0, 0.8);
    background: #2a0505;
    color: #ffb3b3 !important;
}

.ev-card-editor-actions button[value="delete"]:hover {
    background: #7b1111;
    color: #fff !important;
}

/* Bubble areas on editor pages */
.ev-bubble-box {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    min-height: 42px;
    padding: 8px;
    background: #080808;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.ev-bubble-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 6px 9px;
    border: 1px solid rgba(204, 0, 0, 0.45);
    background: rgba(204, 0, 0, 0.14);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.ev-bubble-remove {
    width: 18px;
    height: 18px;
    min-height: 0;
    padding: 0;
    border: 1px solid rgba(255, 120, 120, 0.3);
    background: #260505;
    color: #ffb3b3;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    border-radius: 0;
}

.ev-bubble-remove:hover {
    background: #7b1111;
    color: #fff;
}

/* Readonly submitter field */
.ev-readonly-field {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #080808;
    color: #fff;
    font-weight: 800;
}

/* Mobile */
@media (max-width: 760px) {
    .ev-card-editor-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .ev-card-editor-actions .button,
    .ev-card-editor-actions button {
        width: 100%;
    }

    .ev-card-editor-actions button[value="delete"] {
        margin-right: 0;
    }

    .ev-results-table th,
    .ev-results-table td {
        padding: 8px;
        font-size: 12px;
    }
}

/* ── Dashboard: Welcome + Upcoming Card Module ─────────────────────────── */

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.dash-welcome-card .ap-module__body {
    padding: 28px 22px;
}

.dash-welcome-title {
    margin: 0 0 10px;
    color: var(--white);
    font-family: var(--font-head);
    font-size: 28px;
    letter-spacing: 3px;
}

.dash-welcome-title span {
    color: var(--red);
}

.dash-welcome-copy {
    max-width: 480px;
    margin: 0;
    color: var(--silver);
    font-size: 13px;
    line-height: 1.7;
}

.dash-welcome-meta {
    margin: 16px 0 0;
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
}

.dash-card-module .ap-module__body {
    display: grid;
    gap: 14px;
    padding: 14px;
}

.dash-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(135deg, rgba(120, 0, 0, 0.15), transparent 50%),
        #101010;
}

.dash-card-kicker {
    margin-bottom: 5px;
    color: #d7b45a;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dash-card-header h2 {
    margin: 0;
    color: #fff;
    font-family: var(--font-display);
    font-size: 22px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dash-card-header p {
    margin: 6px 0 0;
    color: var(--silver);
    font-size: 12px;
    line-height: 1.4;
}

.dash-card-header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.dash-card-header-actions .button {
    min-width: 112px;
    text-align: center;
}

.dash-card-empty {
    display: grid;
    gap: 4px;
    padding: 16px;
    border: 1px dashed rgba(204, 0, 0, 0.45);
    background:
        linear-gradient(135deg, rgba(80, 0, 0, 0.12), transparent 50%),
        #0f0f0f;
}

.dash-card-empty strong {
    color: #fff;
    font-size: 14px;
    text-transform: uppercase;
}

.dash-card-empty span {
    color: var(--silver);
    font-size: 12px;
    line-height: 1.45;
}

.dash-card-list {
    display: grid;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #0f0f0f;
}

.dash-card-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: #101010;
}

.dash-card-row:last-child {
    border-bottom: 0;
}

.dash-card-row:hover {
    background:
        linear-gradient(90deg, rgba(130, 0, 0, 0.12), transparent 36%),
        #111;
}

.dash-card-row--segment {
    background:
        linear-gradient(90deg, rgba(214, 165, 54, 0.06), transparent 30%),
        #101010;
}

.dash-card-row__num {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(204, 0, 0, 0.5);
    background: #171717;
    color: #fff;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 900;
}

.dash-card-row__main {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.dash-card-row__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.dash-card-row__main strong {
    color: #fff;
    font-size: 14px;
    line-height: 1.25;
}

.dash-card-row__main small {
    color: var(--silver);
    font-size: 11px;
    line-height: 1.35;
}

.dash-card-pill {
    display: inline-flex;
    align-items: center;
    min-height: 19px;
    padding: 3px 7px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #181818;
    color: #d8d8d8;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dash-card-pill--match {
    border-color: rgba(204, 0, 0, 0.5);
    color: #ffb3b3;
}

.dash-card-pill--segment {
    border-color: rgba(214, 165, 54, 0.5);
    color: #f0d184;
}

.dash-card-pill--hidden {
    border-color: rgba(255, 55, 55, 0.45);
    color: #ff9999;
}

.dash-card-row__actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.dash-card-row__actions .button {
    min-width: 82px;
    min-height: 32px;
    padding: 7px 11px;
    font-size: 11px;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
}

.dash-card-locked {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--silver);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

@media (max-width: 980px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dash-card-header {
        display: grid;
    }

    .dash-card-header-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 620px) {
    .dash-card-row {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .dash-card-row__actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding-left: 50px;
    }

    .dash-card-row__actions .button,
    .dash-card-locked {
        width: 100%;
        justify-content: center;
    }
}

/* ── Event Card Editor: Assigned Writers + Back Button + Hide Public ───── */

.ev-bubble-box[data-bubble-box="match-writer"] {
    margin-top: 8px;
}

.ev-bubble-box[data-bubble-box="match-writer"] .ev-bubble-tag,
.ev-bubble-box[data-bubble-box="match-writer"] .ev-bubble {
    border-color: rgba(192, 57, 43, 0.55);
}

.ev-back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, .16);
    background: var(--red);
    color: #fff !important;
    box-shadow: 0 0 0 1px rgba(204, 0, 0, .35), 0 8px 18px rgba(0, 0, 0, .35);
}

.ev-back-button:hover {
    background: var(--red-glow);
    color: #fff !important;
}

/*
   IMPORTANT:
   This row must stay as a normal two-column grid item.
   Do NOT use grid-column: 1 / -1 here.
*/
.ev-hide-public-row {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 0;
    padding: 0;
    margin: 0;
    border-top: 0;
    text-align: left;
}

.ev-hide-public-row label,
.ev-hide-public-row .ev-check-row {
    margin: 0;
}

.ev-hide-public-row .ev-field-help {
    margin: 6px 0 0;
    color: var(--silver);
    font-size: 11px;
    line-height: 1.45;
}

/* Current markup version */
.ev-check-row--compact {
    display: inline-flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: auto;
    min-height: 38px;
    margin: 0;
    text-align: left;
}

/* Safety support if older markup still uses --center */
.ev-check-row--center {
    display: inline-flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: auto;
    min-height: 38px;
    margin: 0;
    text-align: left;
}

.ev-check-row--compact input[type="checkbox"],
.ev-check-row--center input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: var(--red);
}

.ev-check-row--compact span,
.ev-check-row--center span {
    display: inline-block;
    margin: 0;
    line-height: 1;
}

.ev-field-help--center {
    text-align: left;
    margin-left: 0;
    margin-right: 0;
}

/* ── Event Card Editor: Bubble Select Dropdowns ─────────────────────────── */

.ev-card-editor-form .ev-character-bubble-select {
    width: 100%;
    min-height: 38px;
    padding: 8px 34px 8px 10px;
    border: 1px solid var(--border);
    border-radius: 0;
    background-color: var(--black);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.2;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--silver) 50%),
        linear-gradient(135deg, var(--silver) 50%, transparent 50%);
    background-position:
        calc(100% - 16px) 16px,
        calc(100% - 11px) 16px;
    background-size:
        5px 5px,
        5px 5px;
    background-repeat: no-repeat;
}

.ev-card-editor-form .ev-character-bubble-select:hover {
    border-color: rgba(204, 0, 0, 0.65);
}

.ev-card-editor-form .ev-character-bubble-select:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.18);
}

.ev-card-editor-form .ev-character-bubble-select option,
.ev-card-editor-form .ev-character-bubble-select optgroup {
    background: #151519;
    color: #ffffff;
    font-family: var(--font-mono);
}

.ev-card-editor-form .ev-character-bubble-select option:checked {
    background: var(--red);
    color: #ffffff;
}

/* ── Site Templates & Pages ──────────────────────────────────────────────── */
.st-token-ref {
    margin-top: 20px;
    border: 1px solid var(--border);
}

.st-token-ref__head {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--silver);
    padding: 8px 14px;
    cursor: pointer;
    background: var(--black);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}

.st-token-ref__body {
    padding: 12px 14px;
    display: none;
}

.st-token-ref__body.is-open {
    display: block;
}

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

.st-token-ref th {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--silver);
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.st-token-ref td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--light);
    vertical-align: top;
}

.st-token-ref td:first-child {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--red-glow);
    white-space: nowrap;
}

.st-token-ref tr:last-child td {
    border-bottom: none;
}

.st-editor-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

.st-editor-tab {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    padding: 8px 20px;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    color: var(--silver);
    background: transparent;
    transition: all .15s;
}

.st-editor-tab:hover {
    color: var(--white);
}

.st-editor-tab.is-active {
    color: var(--white);
    background: var(--panel);
    border-color: var(--border);
    margin-bottom: -1px;
}

.st-editor-panel {
    display: none;
    border: 1px solid var(--border);
    border-top: none;
}

.st-editor-panel.is-active {
    display: block;
}

.CodeMirror {
    min-height: 400px;
    font-family: var(--font-mono);
    font-size: 12px;
}

/* Zone editor */
.sz-zone {
    margin-bottom: 20px;
}

.sz-zone-heading {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--red);
    margin-bottom: 8px;
}

.sz-module-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    margin-bottom: 4px;
}

.sz-module-name {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--light);
}

.sz-module-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.sz-module-actions form {
    margin: 0;
}

.sz-module-actions button,
.sz-module-actions a {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 3px 8px;
    background: var(--black);
    border: 1px solid var(--border);
    color: var(--silver);
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}

.sz-module-actions button:hover,
.sz-module-actions a:hover {
    border-color: var(--red);
    color: var(--white);
}

.sz-empty {
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--border);
    text-align: center;
    border: 1px dashed var(--border);
}

.sz-add-btn {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    padding: 7px 14px;
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--silver);
    cursor: pointer;
    width: 100%;
    transition: all .15s;
    margin-top: 4px;
}

.sz-add-btn:hover {
    border-color: var(--red);
    color: var(--white);
}

/* Module picker */
.sz-module-picker {
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 14px;
    margin-top: 8px;
    display: none;
}

.sz-module-picker.is-open {
    display: block;
}

.sz-module-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.sz-module-card:last-child {
    border-bottom: none;
}

.sz-module-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
}

.sz-module-card-desc {
    font-size: 11px;
    color: var(--silver);
    margin-top: 2px;
}

.sz-module-card-cat {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--border);
    margin-top: 2px;
}

.sz-module-card-info {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--silver);
    cursor: pointer;
    padding: 4px 8px;
    border: 1px solid var(--border);
    background: var(--black);
    transition: all .15s;
}

.sz-module-card-info:hover {
    border-color: var(--silver);
    color: var(--white);
}

/* ── Template Assistant ───────────────────────────────────────────────────── */
.ta-wizard { border: 1px solid var(--border); margin-bottom: 20px; }
.ta-wizard__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--black);
    border-bottom: 1px solid var(--border); cursor: pointer;
}
.ta-wizard__title { font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px; color: var(--silver); }
.ta-wizard__body { padding: 20px; display: none; }
.ta-wizard__body.is-open { display: block; }

.ta-step { display: none; }
.ta-step.is-active { display: block; }
.ta-step-heading { font-family: var(--font-mono); font-size: 9px; letter-spacing: 2px; color: var(--red); margin-bottom: 16px; }
.ta-options { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.ta-option {
    padding: 10px 16px; border: 1px solid var(--border);
    cursor: pointer; font-size: 13px; color: var(--silver); transition: all .15s;
}
.ta-option:hover { border-color: var(--silver); color: var(--white); }
.ta-option.is-selected { border-color: var(--red); color: var(--white); background: var(--red-dim); }
.ta-nav { display: flex; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Module config panel */
.sz-config-panel {
    background: var(--black); border: 1px solid var(--border);
    border-top: none; padding: 12px 14px;
    display: none;
}
.sz-config-panel.is-open { display: block; }
.sz-config-field { margin-bottom: 10px; }
.sz-config-field:last-child { margin-bottom: 0; }
.sz-config-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 1px; color: var(--silver); margin-bottom: 4px; display: block; }

/* Module info panel */
.sz-info-panel {
    background: var(--surface); border: 1px solid var(--border);
    padding: 10px 14px; font-size: 12px; color: var(--silver);
    display: none; margin-top: 4px;
}
.sz-info-panel.is-open { display: block; }
.sz-info-panel code { font-family: var(--font-mono); font-size: 10px; background: var(--black); padding: 1px 5px; color: var(--light); }

/* ── Template Editor Refinement ─────────────────────────────────────────── */

.ap-module + .ap-module,
.ta-wizard + .ap-module,
.ap-module + .ta-wizard {
    margin-top: 18px;
}

.st-help-prompt {
    border-left: 3px solid var(--red);
    background: var(--black);
}

.ta-wizard {
    background: var(--panel);
}

.ta-wizard__head {
    min-height: 58px;
}

.ta-wizard__head .ue-hint {
    margin-top: 4px;
    max-width: 780px;
}

.st-module-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.st-module-card {
    border: 1px solid var(--border);
    background: var(--black);
    padding: 14px;
}

.st-module-card__top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 8px;
}

.st-module-card__name {
    font-size: 15px;
    font-weight: 800;
    color: var(--white);
}

.st-module-card__meta {
    display: inline-block;
    margin-top: 5px;
    padding: 2px 7px;
    background: var(--red-dim);
    color: var(--red-glow);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.st-module-card__token {
    flex-shrink: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--white);
    padding: 5px 8px;
    font-family: var(--font-mono);
    font-size: 10px;
}

.st-module-card__desc {
    color: var(--silver);
    font-size: 12px;
    line-height: 1.5;
}

.st-module-card__details {
    margin-top: 10px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

.st-module-card__details summary {
    cursor: pointer;
    color: var(--red);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.st-module-card__css {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.st-module-card__css code {
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 2px 6px;
    color: var(--light);
    font-size: 9px;
}

@media (max-width: 1000px) {
    .st-module-list {
        grid-template-columns: 1fr;
    }

    .st-module-card__top {
        flex-direction: column;
    }
}

/* ── Public Site Template Editor — Final Override Fixes ─────────────────── */

.st-collapsible-body {
    display: none !important;
}

.st-collapsible-body.is-open {
    display: block !important;
}

[data-template-form] {
    margin-top: 18px;
}

.st-help-prompt {
    display: block;
    max-width: 100%;
    margin-top: 12px;
    padding: 14px 16px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border-left: 3px solid var(--red);
    background: var(--black);
}

.st-help-prompt code {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    line-height: 1.6;
}

/* Native textarea fallback if CodeMirror does not load */
textarea.st-codearea {
    display: block !important;
    width: 100% !important;
    min-height: 520px !important;
    padding: 14px !important;
    background: var(--black) !important;
    border: 1px solid var(--border) !important;
    color: var(--white) !important;
    font-family: var(--font-mono) !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
    resize: vertical !important;
}

/* CodeMirror version */
.st-editor-panel .CodeMirror,
.CodeMirror {
    width: 100% !important;
    min-height: 560px !important;
    height: 560px !important;
    border: 1px solid var(--border) !important;
    background: var(--black) !important;
    font-family: var(--font-mono) !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
}

.st-editor-panel {
    padding: 0;
    background: var(--black);
}

.st-editor-panel.is-active {
    display: block !important;
}

.st-module-list {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.st-module-card {
    border: 1px solid var(--border);
    background: var(--black);
    padding: 14px;
}

.st-module-card__top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 8px;
}

.st-module-card__name {
    font-size: 15px;
    font-weight: 800;
    color: var(--white);
}

.st-module-card__meta {
    display: inline-block;
    margin-top: 5px;
    padding: 2px 7px;
    background: var(--red);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.st-module-card__token {
    flex-shrink: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--white);
    padding: 5px 8px;
    font-family: var(--font-mono);
    font-size: 10px;
}

.st-module-card__desc {
    color: var(--silver);
    font-size: 12px;
    line-height: 1.5;
}

.st-module-card__details {
    margin-top: 10px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

.st-module-card__details summary {
    cursor: pointer;
    color: var(--red-glow);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.st-module-card__css {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.st-module-card__css code {
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 2px 6px;
    color: var(--light);
    font-size: 9px;
}

@media (max-width: 1000px) {
    .st-module-list {
        grid-template-columns: 1fr;
    }

    .st-module-card__top {
        flex-direction: column;
    }
}

/* ── Mobile Zone Editor Fixes ───────────────────────────────────────────── */

@media (max-width: 700px) {
    .sz-module-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        align-items: stretch;
    }

    .sz-module-actions {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        width: 100%;
    }

    .sz-module-actions button,
    .sz-module-actions a {
        width: 100%;
        min-height: 38px;
        margin: 0;
        text-align: center;
        justify-content: center;
    }

    .sz-config-panel {
        width: 100%;
        max-width: 100%;
        grid-column: 1 / -1;
        overflow: visible;
    }

    .sz-config-panel .ue-input,
    .sz-config-panel .ue-select,
    .sz-config-panel .ue-textarea {
        width: 100%;
        min-width: 0;
        font-size: 16px;
    }

    .sz-module-picker {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .sz-module-card {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        align-items: stretch;
    }

    .sz-module-card .ul-action {
        width: 100%;
        min-height: 38px;
        margin: 0;
    }
}

/* ── Zone Editor Compact Layout Fix ─────────────────────────────────────── */

.sz-zone {
    margin-bottom: 16px;
}

.sz-zone [data-zone-list] {
    display: grid;
    gap: 8px;
}

.sz-module-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 0 !important;
    padding: 12px !important;
}

.sz-module-name {
    min-width: 0;
    font-weight: 700;
}

.sz-module-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.sz-config-panel {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    margin-top: 8px;
    padding: 12px;
}

.sz-config-panel.is-open {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.sz-config-field {
    margin: 0;
}

.sz-config-field textarea,
.sz-config-field .ue-textarea {
    min-height: 110px;
}

.sz-config-field:has(textarea),
.sz-config-field:has(.ue-textarea) {
    grid-column: 1 / -1;
}

@media (max-width: 700px) {
    .sz-module-row {
        grid-template-columns: 1fr;
    }

    .sz-module-actions {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
    }

    .sz-config-panel.is-open {
        display: block !important;
    }

    .sz-config-field {
        margin-bottom: 10px;
    }
}

.ap-page-title,
.dashboard-title,
.ap-module__title,
.ev-card-title,
.st-module-card__name,
.sz-module-card-name {
    font-family: Arial, Helvetica, sans-serif !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

/* ── Readable Admin UI Headings ─────────────────────────────────────────── */

.ap-module__title,
.dash-welcome-title,
.dash-card-header h2,
.ev-detail-title,
.ev-builder-collapse summary span,
.ev-action-tile__text strong,
.ev-card-panel__head h3,
.ev-card-list-head h3,
.ev-card-editor-header h1,
.ev-card-item__main h3,
.ev-card-empty strong,
.ev-match-placeholder strong,
.st-module-card__name {
    font-family: Arial, Helvetica, sans-serif !important;
    font-weight: 900;
    letter-spacing: 0.02em;
    line-height: 1.15;
}

.ap-page-title,
.ap-page-title span {
    font-family: var(--font-head);
    letter-spacing: 4px;
}

/* ── Public Site page header spacing only ───────────────────────────────── */

.ps-page-header {
    margin-bottom: 18px;
}

.st-save-spacer {
    margin-top: 16px;
}

/* ── Template Editor Token / Snippet Inserter ───────────────────────────── */

.st-builder-ref {
    margin-top: 18px;
}

.st-builder-ref__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, .8fr);
    gap: 14px;
}

.st-builder-panel {
    border: 1px solid var(--border);
    background: var(--black);
}

.st-builder-panel__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.st-builder-panel__head strong {
    color: var(--white);
    font-size: 13px;
}

.st-builder-panel__head span {
    color: var(--silver);
    font-size: 11px;
}

.st-token-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
}

.st-token-group {
    padding: 12px;
    border-right: 1px solid var(--border);
}

.st-token-group:last-child {
    border-right: none;
}

.st-token-group__title {
    margin-bottom: 9px;
    color: var(--red-glow);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.st-token-item {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.st-token-item:last-child {
    border-bottom: none;
}

.st-token-item code {
    color: var(--white);
    font-size: 11px;
}

.st-token-item span {
    color: var(--silver);
    font-size: 11px;
    line-height: 1.35;
}

.st-token-item .ul-action {
    width: max-content;
    margin-left: 0;
}

.st-snippet-list {
    display: grid;
    gap: 8px;
    padding: 12px;
}

.st-snippet {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--white);
    text-align: left;
    font-size: 12px;
    font-weight: 800;
}

.st-snippet:hover {
    border-color: var(--red);
}

.st-module-card__token-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.is-inserted {
    border-color: var(--green) !important;
    color: var(--green) !important;
}

@media (max-width: 1100px) {
    .st-builder-ref__grid,
    .st-token-grid {
        grid-template-columns: 1fr;
    }

    .st-token-group {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .st-token-group:last-child {
        border-bottom: none;
    }
}

/* ── Template modules collapsed by default ─────────────────────────────── */

#available-template-modules.st-collapsible-body {
    display: none;
}

#available-template-modules.st-collapsible-body.is-open {
    display: block;
}

/* ── Template Help collapsible ─────────────────────────────────────────── */

#template-help-body {
    display: none;
}

#template-help-body.is-open {
    display: block;
}

/* ── Visual Template Assistant polish ───────────────────────────────────── */

.ta-wizard {
    border: 1px solid rgba(204, 0, 0, .55);
    background:
        linear-gradient(135deg, rgba(204, 0, 0, .16), transparent 46%),
        var(--panel);
}

.ta-wizard__head {
    min-height: 72px;
    background:
        linear-gradient(90deg, rgba(204, 0, 0, .22), rgba(10,10,11,.2)),
        var(--black);
    border-left: 3px solid var(--red);
}

.ta-wizard__title {
    color: var(--white);
    font-size: 13px;
    font-weight: 900;
}

.ta-wizard__head .ue-hint {
    margin-top: 6px;
    font-size: 12px;
}

.ta-wizard__head .ul-action {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
    min-height: 34px;
}

.ta-step-heading {
    color: var(--white);
    font-size: 12px;
    font-weight: 900;
    border-left: 3px solid var(--red);
    padding-left: 10px;
}

.ta-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.ta-option {
    min-height: 48px;
    background: var(--black);
    text-align: left;
    font-weight: 800;
}

.ta-option.is-selected {
    background: var(--red-dim);
    border-color: var(--red);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.ta-nav {
    justify-content: space-between;
}

[data-ta-message] {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(39, 174, 96, .45);
    background: rgba(39, 174, 96, .08);
    color: #4ade80;
    font-weight: 800;
}

/* ── Site Page Zone Builder Polish ─────────────────────────────────────── */

.sz-zone {
    border: 1px solid var(--border);
    background: var(--black);
    padding: 12px;
}

.sz-zone-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    color: var(--white);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .04em;
}

.sz-zone-heading::before {
    content: "ZONE";
    margin-right: 8px;
    color: var(--red-glow);
    font-size: 9px;
    font-weight: 900;
}

.sz-zone[data-zone-visibility="main"] {
    border-left: 3px solid var(--red);
}

.sz-zone[data-zone-visibility="sidebar"],
.sz-zone[data-zone-visibility="left"],
.sz-zone[data-zone-visibility="right"] {
    border-left: 3px solid var(--silver);
}

.sz-zone[hidden] {
    display: none !important;
}

.sz-module-row {
    background: var(--surface);
}

.sz-module-row:hover {
    border-color: rgba(204,0,0,.45);
}

.sz-config-panel.is-open {
    background:
        linear-gradient(135deg, rgba(204, 0, 0, .08), transparent 42%),
        var(--black);
}

.sz-add-btn {
    min-height: 42px;
    margin-top: 10px;
    background:
        linear-gradient(135deg, rgba(204, 0, 0, .10), transparent 45%),
        var(--surface);
}

.sz-add-btn::before {
    content: "+ ";
    color: var(--red-glow);
    font-weight: 900;
}

.sz-module-picker {
    background: var(--black);
}

.sz-module-card {
    background: var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 8px;
}

.sz-module-card:last-child {
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
}

.sz-module-card:hover {
    border-color: var(--red);
}

/* ── Zone ordering polish with mobile fallback ─────────────────────────── */

.sz-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-right: 8px;
    border: 1px solid var(--border);
    background: var(--black);
    color: var(--silver);
    font-size: 12px;
    cursor: grab;
}

.sz-module-row:active .sz-drag-handle {
    cursor: grabbing;
}

.sz-module-actions [data-move-up],
.sz-module-actions [data-move-down] {
    min-width: 30px;
    font-weight: 900;
}

@media (max-width: 700px) {
    .sz-drag-handle {
        display: none;
    }

    .sz-module-actions [data-move-up],
    .sz-module-actions [data-move-down] {
        min-height: 38px;
        min-width: 0;
    }
}

/* ── Results compiler ─────────────────────────────────────────────────────── */
.rc-match-block {
    background: var(--panel);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.rc-match-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.rc-match-title {
    font-family: var(--font-head);
    font-size: 18px;
    letter-spacing: 1px;
    color: var(--white);
    flex: 1;
}

.rc-match-body {
    padding: 16px;
}

.rc-participant-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.rc-participant-row:last-child {
    border-bottom: none;
}

.rc-participant-name {
    flex: 1;
    font-size: 14px;
    color: var(--light);
}

.rc-participant-result select {
    font-family: var(--font-mono);
    font-size: 11px;
}

.rc-championship-box {
    margin-top: 12px;
    padding: 12px;
    background: var(--black);
    border: 1px solid var(--red-dim);
}

.rc-championship-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--red-glow);
    margin-bottom: 8px;
}

.rc-publish-section {
    margin-top: 24px;
    padding: 20px;
    background: var(--panel);
    border: 1px solid var(--border);
    text-align: center;
}

/* ── News editor ──────────────────────────────────────────────────────────── */
.ne-status-published {
    color: #4ade80;
}

.ne-status-draft {
    color: var(--silver);
}

.ne-status-scheduled {
    color: #f2c94c;
}

/* ── Event detail action buttons ────────────────────────────────────────── */
.ev-detail-hero {
    min-height: 150px !important;
}

.ev-detail-hero__content {
    position: relative;
    min-width: 0;
}

.ev-detail-actions {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px !important;
    width: 100%;
    position: relative;
    z-index: 20;
}

.ev-action-form {
    display: inline-flex !important;
    align-items: center;
    margin: 0;
    padding: 0;
}

.ev-action-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 14px;
    border: 1px solid var(--border);
    background: var(--black);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1.35px;
    text-transform: uppercase;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.035),
        0 0 14px rgba(0,0,0,0.35);
    transition:
        background .15s ease,
        border-color .15s ease,
        color .15s ease,
        transform .15s ease,
        box-shadow .15s ease;
}

.ev-action-button:hover {
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

.ev-action-button--back,
.ev-action-button--new,
.ev-action-button--save {
    background: #101016;
    border-color: #34343d;
    color: var(--white);
}

.ev-action-button--back:hover,
.ev-action-button--new:hover,
.ev-action-button--save:hover {
    background: var(--red-dim);
    border-color: var(--red);
}

.ev-action-button--stage {
    background: var(--yellow);
    border-color: var(--yellow);
    color: #111;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.18),
        0 0 16px rgba(242,201,76,0.22);
}

.ev-action-button--stage:hover {
    background: #ffd95f;
    border-color: #ffd95f;
    color: #000;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.22),
        0 0 20px rgba(242,201,76,0.34);
}

.ev-action-button--compile {
    background: #f97316;
    border-color: #fb923c;
    color: #111;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.15),
        0 0 16px rgba(249,115,22,0.24);
}

.ev-action-button--compile:hover {
    background: #fb923c;
    border-color: #fdba74;
    color: #000;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.2),
        0 0 20px rgba(249,115,22,0.36);
}

.ev-action-button--publish {
    background: #22c55e;
    border-color: #4ade80;
    color: #06130b;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.15),
        0 0 16px rgba(34,197,94,0.24);
}

.ev-action-button--publish:hover {
    background: #4ade80;
    border-color: #86efac;
    color: #041007;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.2),
        0 0 20px rgba(34,197,94,0.36);
}

.ev-action-button--unpublish {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.08),
        0 0 16px rgba(204,0,0,0.28);
}

.ev-action-button--unpublish:hover {
    background: var(--red-glow);
    border-color: var(--red-glow);
    color: #fff;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.12),
        0 0 22px rgba(204,0,0,0.38);
}

/* Bottom workflow row */
.ev-sticky-save {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.ev-sticky-save .ev-action-button {
    min-height: 36px;
    padding: 0 18px;
    font-size: 10px;
}

/* Mobile */
@media (max-width: 720px) {
    .ev-detail-actions {
        justify-content: flex-start;
    }

    .ev-action-button,
    .ev-action-form {
        width: 100%;
    }

    .ev-action-form .ev-action-button {
        width: 100%;
    }

    .ev-sticky-save {
        align-items: stretch;
    }

    .ev-sticky-save .ev-action-button {
        width: 100%;
    }
}

/* ── Sticky save workflow button color override ─────────────────────────── */
.ev-sticky-save .ev-action-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 36px !important;
    padding: 0 18px !important;
    border-width: 1px !important;
    border-style: solid !important;
    font-family: var(--font-mono) !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    letter-spacing: 1.35px !important;
    text-transform: uppercase !important;
    text-decoration: none !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    cursor: pointer !important;
}

/* Save Event stays standard red */
.ev-sticky-save .ev-action-button--save {
    background: var(--red) !important;
    border-color: var(--red) !important;
    color: #fff !important;
}

/* Stage Show = yellow */
.ev-sticky-save .ev-action-button--stage {
    background: var(--yellow) !important;
    border-color: var(--yellow) !important;
    color: #111 !important;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.18),
        0 0 16px rgba(242,201,76,0.25) !important;
}

.ev-sticky-save .ev-action-button--stage:hover {
    background: #ffd95f !important;
    border-color: #ffd95f !important;
    color: #000 !important;
}

/* Compile Results = orange */
.ev-sticky-save .ev-action-button--compile {
    background: #f97316 !important;
    border-color: #fb923c !important;
    color: #111 !important;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.15),
        0 0 16px rgba(249,115,22,0.28) !important;
}

.ev-sticky-save .ev-action-button--compile:hover {
    background: #fb923c !important;
    border-color: #fdba74 !important;
    color: #000 !important;
}

/* Publish Show = green */
.ev-sticky-save .ev-action-button--publish {
    background: #22c55e !important;
    border-color: #4ade80 !important;
    color: #06130b !important;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.15),
        0 0 16px rgba(34,197,94,0.28) !important;
}

.ev-sticky-save .ev-action-button--publish:hover {
    background: #4ade80 !important;
    border-color: #86efac !important;
    color: #041007 !important;
}

/* Unpublish Show = red */
.ev-sticky-save .ev-action-button--unpublish {
    background: var(--red) !important;
    border-color: var(--red) !important;
    color: #fff !important;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.08),
        0 0 16px rgba(204,0,0,0.3) !important;
}

.ev-sticky-save .ev-action-button--unpublish:hover {
    background: var(--red-glow) !important;
    border-color: var(--red-glow) !important;
    color: #fff !important;
}

.inline-form {
    display: inline;
}

.inline-form {
    display: inline;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    color: var(--silver);
}

.brand-badge__swatch {
    width: 10px;
    height: 10px;
    display: inline-block;
    background: var(--red);
    border: 1px solid var(--border);
}

.brand-badge--cross .brand-badge__swatch {
    background: var(--gold);
}

.brand-badge--none {
    color: var(--border);
}

.ne-list-excerpt {
    margin-top: 6px;
    color: var(--silver);
    font-size: 12px;
    line-height: 1.4;
}

.ne-category-badge {
    margin-left: 8px;
}

.ss-key,
.ss-default {
    font-family: var(--font-mono);
    font-size: 12px;
}

.fm-member-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
}

.fm-add-member-box {
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
    padding: 16px;
}

.fm-scope-note {
    margin-top: 8px;
    color: var(--silver);
    font-size: 12px;
    line-height: 1.4;
}

.fm-member-row--locked {
    opacity: 0.85;
}

.rp-readonly-body {
    margin-top: 18px;
    line-height: 1.65;
}

@media (max-width: 900px) {
    .fm-member-grid {
        grid-template-columns: 1fr;
    }
}

.rp-page .ap-module__body {
    padding: 18px;
}

.rp-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    align-items: start;
}

.rp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.rp-field,
.rp-side-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
}

.rp-field--full {
    grid-column: 1 / -1;
}

.rp-choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 10px 0;
}

.rp-choice {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text);
}

.rp-active-character {
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    padding: 12px;
}

.rp-active-character strong,
.rp-active-character span {
    display: block;
}

.rp-active-character span {
    margin-top: 4px;
    color: var(--silver);
    font-size: 12px;
}

.rp-body-editor {
    min-height: 360px;
}

.rp-submit-stack {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.rp-action-btn {
    width: 100%;
    justify-content: center;
    min-height: 38px;
}

.rp-status-pill {
    display: inline-flex;
    width: fit-content;
    padding: 5px 9px;
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
}

@media (max-width: 1000px) {
    .rp-layout {
        grid-template-columns: 1fr;
    }

    .rp-grid {
        grid-template-columns: 1fr;
    }
}

/* Federation Settings */
.fs-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.fs-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.fs-field--full {
    grid-column: 1 / -1;
}

.fs-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
}

.fs-required {
    color: var(--red);
}

.fs-note,
.fs-hint,
.fm-scope-note {
    color: var(--silver);
    font-size: 12px;
    line-height: 1.45;
}

.fs-input {
    width: 100%;
    min-height: 38px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    background: var(--black);
    color: var(--text);
    font-family: var(--font-body);
}

.fs-input:focus {
    outline: none;
    border-color: var(--red);
}

.fs-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
}

.fs-toggle-label {
    color: var(--text);
    font-weight: 700;
}

.fs-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.fs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    text-decoration: none;
}

.fs-btn--primary {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.fs-btn--secondary {
    background: var(--black);
    color: var(--text);
}

.fm-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid var(--gold);
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.fm-member-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
}

.fm-add-member-box {
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.025);
    padding: 16px;
}

.fm-add-member-box h3 {
    margin: 0 0 12px;
    font-size: 14px;
    text-transform: uppercase;
}

.fm-member-row--locked {
    opacity: 0.8;
}

@media (max-width: 900px) {
    .fs-grid,
    .fm-member-grid {
        grid-template-columns: 1fr;
    }
}

/* ─────────────────────────────────────────────────────────────
   eMS v3 — Finance / Contracts / Store
   ───────────────────────────────────────────────────────────── */

.fin-contract-card {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.025);
    padding: 16px;
    margin-bottom: 16px;
}

.fin-contract-card--offered {
    border-left: 4px solid var(--gold);
}

.fin-contract-card--expiring {
    border-left: 4px solid #f97316;
}

.fin-contract-dates {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--silver);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.fin-contract-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.fin-contract-stat {
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.28);
    padding: 12px;
}

.fin-contract-stat__label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--silver);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 6px;
}

.fin-contract-stat__value {
    font-size: 20px;
    font-weight: 800;
    color: var(--white);
}

.fin-balance-display {
    font-size: clamp(34px, 6vw, 64px);
    line-height: 1;
    font-weight: 900;
    color: #4ade80;
    font-family: var(--font-mono);
    letter-spacing: -0.04em;
}

.fin-balance-display--zero {
    color: var(--silver);
}

.fin-txn-credit {
    color: #4ade80;
    font-weight: 800;
    font-family: var(--font-mono);
}

.fin-txn-debit {
    color: #f87171;
    font-weight: 800;
    font-family: var(--font-mono);
}

.sf-profit {
    color: #4ade80;
    font-weight: 900;
    font-family: var(--font-mono);
}

.sf-loss {
    color: #f87171;
    font-weight: 900;
    font-family: var(--font-mono);
}

.sf-calculator {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    margin-bottom: 90px;
}

.sf-section {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.025);
    padding: 16px;
}

.sf-section-heading {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: .08em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 12px;
    font-weight: 900;
}

.sf-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 14px;
}

.sf-row span {
    color: var(--silver);
}

.sf-row strong {
    color: var(--white);
    font-family: var(--font-mono);
}

.sf-row--indent {
    padding-left: 18px;
    font-size: 13px;
}

.sf-row--total {
    border-top: 1px solid var(--gold);
    border-bottom: 0;
    margin-top: 8px;
    padding-top: 14px;
    font-weight: 900;
}

.sf-row--total span,
.sf-row--total strong {
    color: var(--gold);
}

.sf-sell-slider-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 90px;
    gap: 12px;
    align-items: center;
}

.sf-sell-slider-wrap input[type="range"] {
    width: 100%;
    accent-color: var(--red);
}

.sf-sell-pct-input {
    text-align: center;
}

.sf-net-row {
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.32);
    margin-top: 18px;
    padding: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.sf-net-label {
    font-family: var(--font-mono);
    color: var(--silver);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .06em;
}

#sf-net {
    font-size: 34px;
    line-height: 1;
}

.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.store-card {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.025);
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.store-card__image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 46px;
}

.store-card__body {
    padding: 14px;
    flex: 1;
}

.store-card__name {
    font-size: 18px;
    font-weight: 900;
    color: var(--white);
    margin: 10px 0 6px;
}

.store-card__desc {
    color: var(--silver);
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 12px;
}

.store-card__price {
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: 900;
    color: var(--gold);
    margin: 12px 0;
}

.store-card__meta {
    font-size: 12px;
    color: var(--silver);
    margin-top: 5px;
}

.store-card__actions {
    border-top: 1px solid var(--border);
    padding: 14px;
}

.store-card__actions .ue-btn {
    width: 100%;
    justify-content: center;
}

.store-card__actions .ue-btn:disabled,
.store-card__actions .ue-btn[disabled] {
    opacity: .45;
    cursor: not-allowed;
    filter: grayscale(1);
}

.store-badge-vanity,
.store-badge-usable {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 900;
    padding: 4px 7px;
    border: 1px solid var(--border);
}

.store-badge-vanity {
    background: rgba(96, 165, 250, .12);
    color: #93c5fd;
}

.store-badge-usable {
    background: rgba(242, 201, 76, .12);
    color: var(--gold);
}

@media (max-width: 900px) {
    .fin-contract-grid,
    .sf-calculator {
        grid-template-columns: 1fr;
    }

    .sf-sell-slider-wrap {
        grid-template-columns: 1fr;
    }

    #sf-net {
        font-size: 26px;
    }
}

@media (max-width: 640px) {
    .fin-contract-stat__value,
    .store-card__price {
        font-size: 22px;
    }

    .sf-net-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* ─────────────────────────────────────────────────────────────
   eMS v3 — Show Finances Overview Cleanup
   ───────────────────────────────────────────────────────────── */

.ap-main .ap-module .ul-filters {
    display: grid;
    grid-template-columns: 180px 180px minmax(220px, 1fr) auto auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
    padding: 12px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.22);
}

.ap-main .ap-module .ul-filter-field {
    min-width: 0;
}

.ap-main .ap-module .ul-filter-field label {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 6px;
}

.ap-main .ap-module .ul-filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ap-main .ap-module .ul-filter-actions .ue-btn,
.ap-main .ap-module .ul-filter-actions .button,
.ap-main .ap-module .ul-filter-actions button,
.ap-main .ap-module .ul-filter-actions a {
    height: 40px;
    min-width: 78px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    text-decoration: none;
}

.ap-main .ap-module .table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.25);
}

.ap-main .ap-module .admin-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
    table-layout: auto;
}

.ap-main .ap-module .admin-table th {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.035);
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 900;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}

.ap-main .ap-module .admin-table td {
    padding: 13px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--white);
    font-size: 13px;
    line-height: 1.45;
    vertical-align: top;
}

.ap-main .ap-module .admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.035);
}

.ap-main .ap-module .admin-table tbody tr:last-child td {
    border-bottom: 0;
}

.ap-main .ap-module .admin-table td strong {
    display: block;
    color: var(--white);
    font-size: 14px;
    font-weight: 900;
    margin-bottom: 3px;
}

.ap-main .ap-module .venue-note {
    display: block;
    margin-top: 3px;
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.35;
}

.ap-main .ap-module .ap-tag {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 4px 7px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: .06em;
    white-space: nowrap;
}

.ap-main .ap-module .ap-status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    vertical-align: middle;
    background: var(--silver);
}

.ap-main .ap-module .ap-status-dot--on {
    background: #4ade80;
}

.ap-main .ap-module .ap-status-dot--off {
    background: var(--silver);
}

.ap-main .ap-module .ul-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 6px 9px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .05em;
    text-decoration: none;
    white-space: nowrap;
}

.ap-main .ap-module .ul-action:hover {
    border-color: var(--red);
    background: var(--red);
    color: var(--white);
}

.ap-main .ap-module .ul-action--edit {
    border-color: rgba(96, 165, 250, 0.45);
    color: #93c5fd;
}

.ap-main .ap-module .ul-action--edit:hover {
    border-color: #60a5fa;
    background: #60a5fa;
    color: var(--black);
}

.ap-main .ap-module .sf-profit {
    color: #4ade80;
    font-family: var(--font-mono);
    font-weight: 900;
}

.ap-main .ap-module .sf-loss {
    color: #f87171;
    font-family: var(--font-mono);
    font-weight: 900;
}

/* Show finances overview-specific column breathing room */
.ap-main .ap-module .admin-table th:nth-child(1),
.ap-main .ap-module .admin-table td:nth-child(1) {
    min-width: 190px;
}

.ap-main .ap-module .admin-table th:nth-child(3),
.ap-main .ap-module .admin-table td:nth-child(3) {
    min-width: 260px;
}

.ap-main .ap-module .admin-table th:nth-child(4),
.ap-main .ap-module .admin-table td:nth-child(4) {
    min-width: 120px;
}

.ap-main .ap-module .admin-table th:nth-child(5),
.ap-main .ap-module .admin-table td:nth-child(5),
.ap-main .ap-module .admin-table th:nth-child(6),
.ap-main .ap-module .admin-table td:nth-child(6),
.ap-main .ap-module .admin-table th:nth-child(7),
.ap-main .ap-module .admin-table td:nth-child(7) {
    min-width: 120px;
    white-space: nowrap;
}

.ap-main .ap-module .admin-table th:nth-child(8),
.ap-main .ap-module .admin-table td:nth-child(8) {
    min-width: 115px;
}

.ap-main .ap-module .admin-table th:nth-child(9),
.ap-main .ap-module .admin-table td:nth-child(9) {
    min-width: 105px;
    text-align: right;
}

/* Filters on smaller screens */
@media (max-width: 1100px) {
    .ap-main .ap-module .ul-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ap-main .ap-module .ul-filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .ap-main .ap-module .ul-filters {
        grid-template-columns: 1fr;
    }

    .ap-main .ap-module .ul-filter-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .ap-main .ap-module .ul-filter-actions .ue-btn,
    .ap-main .ap-module .ul-filter-actions .button,
    .ap-main .ap-module .ul-filter-actions button,
    .ap-main .ap-module .ul-filter-actions a {
        width: 100%;
    }
}

/* ─────────────────────────────────────────────────────────────
   eMS v3 — Site Modules Manager
   ───────────────────────────────────────────────────────────── */

.sm-editor-panel {
    margin-bottom: 18px;
}

.sm-editor-summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 18px;
    cursor: pointer;
    list-style: none;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.025);
}

.sm-editor-summary::-webkit-details-marker {
    display: none;
}

.sm-editor-summary__icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.28);
    font-size: 22px;
}

.sm-editor-summary__text strong {
    display: block;
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.sm-editor-summary__text em {
    display: block;
    color: var(--silver);
    font-size: 13px;
    font-style: normal;
    margin-top: 4px;
}

.sm-editor-summary__plus {
    color: var(--gold);
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
}

.sm-editor-panel[open] .sm-editor-summary__plus {
    transform: rotate(45deg);
}

.sm-editor-body {
    border-top: 1px solid var(--border);
}

.sm-module-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sm-editor-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 14px;
}

.sm-module-filters {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 220px auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
    padding: 12px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.22);
}

.sm-category-list {
    display: grid;
    gap: 18px;
}

.sm-category-group {
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.16);
}

.sm-category-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.035);
}

.sm-category-heading span {
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.sm-category-heading em {
    color: var(--silver);
    font-size: 12px;
    font-style: normal;
}

.sm-module-list {
    display: grid;
    gap: 10px;
    padding: 12px;
}

.sm-module-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.025);
}

.sm-module-card__title {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    color: var(--white);
    font-size: 16px;
    font-weight: 900;
}

.sm-module-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 11px;
}

.sm-module-card__desc {
    margin-top: 9px;
    color: var(--silver);
    font-size: 13px;
    line-height: 1.45;
}

.sm-module-card__classes {
    margin-top: 10px;
}

.sm-module-card__classes summary {
    cursor: pointer;
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.sm-module-card__classes code {
    display: block;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.32);
    color: var(--silver);
    white-space: normal;
    line-height: 1.5;
}

.sm-module-card__actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sm-module-card__actions form {
    margin: 0;
}

@media (max-width: 900px) {
    .sm-module-form-grid,
    .sm-module-filters,
    .sm-module-card {
        grid-template-columns: 1fr;
    }

    .sm-module-card__actions {
        justify-content: flex-start;
    }
}

/* ─────────────────────────────────────────────────────────────
   eMS v3 — Template Edit Module Browser
   ───────────────────────────────────────────────────────────── */

.st-module-filters {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 220px auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
    padding: 12px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.22);
}

.st-module-category-list {
    display: grid;
    gap: 18px;
}

.st-module-category-group {
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.16);
}

.st-module-category-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.035);
}

.st-module-category-heading span {
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.st-module-category-heading em {
    color: var(--silver);
    font-size: 12px;
    font-style: normal;
}

.st-module-category-group .st-module-list {
    display: grid;
    gap: 12px;
    padding: 12px;
}

.st-module-category-group .st-module-card {
    margin: 0;
}

.st-module-card__token-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.st-module-card__token {
    max-width: 100%;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .st-module-filters {
        grid-template-columns: 1fr;
    }

    .st-module-card__top {
        align-items: flex-start;
        flex-direction: column;
    }

    .st-module-card__token-wrap {
        justify-content: flex-start;
    }
}

/* ─────────────────────────────────────────────────────────────
   eMS v3 — Configurable Template Modules / Page Module Picker
   ───────────────────────────────────────────────────────────── */

.st-module-config {
    margin-top: 12px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.24);
}

.st-module-config summary {
    cursor: pointer;
    padding: 10px 12px;
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.st-module-config__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;
    border-top: 1px solid var(--border);
}

.st-module-config__actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px;
    border-top: 1px solid var(--border);
}

.st-module-config__preview {
    display: inline-block;
    max-width: 100%;
    padding: 7px 9px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.32);
    color: var(--silver);
    overflow-wrap: anywhere;
}

.sz-module-picker-filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 220px;
    gap: 10px;
    margin-bottom: 12px;
}

.sz-module-picker-category {
    border: 1px solid var(--border);
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.16);
}

.sz-module-picker-category__heading {
    padding: 9px 11px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.035);
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.sz-module-picker-category .sz-module-card {
    margin: 10px;
}

@media (max-width: 760px) {
    .st-module-config__grid,
    .sz-module-picker-filters {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   eMS v3 Admin — Forums
   ============================================================ */

.fa-category-block {
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 14px;
}

.fa-category-block:last-child {
  margin-bottom: 0;
}

.fa-category-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 12px;
  background:
    linear-gradient(90deg, rgba(204, 0, 0, 0.12), rgba(0, 0, 0, 0)),
    var(--panel);
  border-bottom: 1px solid var(--border);
  color: var(--white);
  font-family: var(--font-head);
  font-size: 16px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.fa-category-head > span:first-child {
  color: var(--silver);
  font-family: var(--font-mono);
  font-size: 12px;
}

.fa-forum-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto auto auto auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border-top: 1px solid var(--border);
  color: var(--light);
}

.fa-forum-row:first-of-type {
  border-top: 0;
}

.fa-forum-row:hover {
  background: var(--black);
}

.fa-forum-row > span:first-child {
  color: var(--silver);
  font-family: var(--font-mono);
  font-size: 11px;
}

.fa-forum-row__name {
  min-width: 0;
  color: var(--white);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

.fa-forum-row__name .ue-hint {
  margin: 4px 0 0;
  color: var(--silver);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
}

.fa-forum-row__count {
  color: var(--silver);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}

.fa-lock-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  margin-left: 6px;
  padding: 2px 6px;
  background: var(--red-dim);
  border: 1px solid rgba(255, 26, 26, 0.35);
  color: var(--red-glow);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1;
  vertical-align: middle;
}

.fa-inline-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.fa-prefix-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.ap-module .fa-prefix-pill {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Forum admin form button spacing */
.ap-module__body > .ul-filters + .ue-grid {
  margin-top: 14px;
}

.ue-field .ue-toggle-wrap + .ue-toggle-wrap {
  margin-top: 8px;
}

/* Mobile forum admin */
@media (max-width: 900px) {
  .fa-category-head {
    align-items: flex-start;
    flex-wrap: wrap;
    min-height: 0;
  }

  .fa-forum-row {
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px 10px;
  }

  .fa-forum-row__count,
  .fa-forum-row .ul-action,
  .fa-forum-row .fa-inline-form {
    grid-column: 2;
  }

  .fa-inline-form {
    display: inline-flex;
  }
}

@media (max-width: 600px) {
  .fa-category-head {
    font-size: 14px;
    letter-spacing: 1px;
  }

  .fa-lock-badge {
    margin-left: 0;
    margin-top: 4px;
  }

  .fa-forum-row {
    padding: 12px 10px;
  }

  .fa-forum-row__name {
    font-size: 13px;
  }
}

/* ============================================================
   eMS v3 Admin — Forum Structure Text Fixes
   ============================================================ */

.fa-category-block {
  overflow: hidden;
}

.fa-category-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
  align-items: center;
  gap: 8px;
}

.fa-category-title-wrap {
  min-width: 0;
}

.fa-category-title {
  color: var(--white);
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 1.1;
  text-transform: uppercase;
}

.fa-category-desc {
  display: block;
  max-width: 720px;
  margin-top: 5px;
  color: var(--silver);
  font-family: var(--font-main);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.45;
  text-transform: none;
  white-space: normal;
}

.fa-category-count {
  color: var(--silver);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}

.fa-forum-row__name {
  overflow-wrap: anywhere;
}

.fa-forum-row__name .ue-hint,
.fa-forum-row__desc,
.fa-category-block .ue-hint {
  color: var(--silver);
  font-family: var(--font-main);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.45;
  text-transform: none;
}

@media (max-width: 900px) {
  .fa-category-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .fa-category-head .ul-action,
  .fa-category-head .fa-inline-form,
  .fa-category-count {
    grid-column: 2;
  }

  .fa-category-desc {
    max-width: none;
  }
}

/* ============================================================
   eMS v3 Admin Forums — Phase 2 Reports/Stats Addendum
   ============================================================ */

.fa-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.fa-stat-box {
  display: grid;
  gap: 4px;
  padding: 14px 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.012)),
    rgba(0,0,0,0.38);
  border: 1px solid rgba(255,255,255,0.11);
  min-width: 0;
}

.fa-stat-box__num {
  color: var(--white);
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 950;
  line-height: 1;
}

.fa-stat-box__label {
  color: var(--silver);
  font-family: var(--font-main);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.2px;
  line-height: 1.25;
  text-transform: uppercase;
}

.fa-report-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px;
  background: rgba(180,0,0,0.52);
  border: 1px solid rgba(255,80,80,0.38);
  color: var(--white);
  font-family: var(--font-main);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.fa-report-list {
  display: grid;
  gap: 12px;
}

.fa-report-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.012)),
    rgba(0,0,0,0.36);
  border: 1px solid rgba(255,255,255,0.12);
}

.fa-report-item__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.fa-report-item__head strong {
  display: block;
  color: var(--white);
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 950;
  letter-spacing: 1px;
  line-height: 1.2;
  text-transform: uppercase;
}

.fa-report-item__head span {
  display: block;
  margin-top: 3px;
  color: var(--silver);
  font-family: var(--font-main);
  font-size: 11px;
  line-height: 1.35;
}

.fa-report-item__meta {
  color: var(--silver);
  font-family: var(--font-main);
  font-size: 11px;
  line-height: 1.5;
}

.fa-report-item__meta strong {
  color: var(--white);
}

.fa-report-item__reason,
.fa-report-item__excerpt {
  color: rgba(255,255,255,0.78);
  font-family: var(--font-main);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.fa-report-item__reason {
  padding: 10px;
  background: rgba(140,0,0,0.16);
  border: 1px solid rgba(255,255,255,0.09);
}

.fa-report-item__reason strong {
  color: var(--white);
}

.fa-report-item__excerpt {
  padding: 10px;
  background: rgba(0,0,0,0.3);
  border-left: 3px solid rgba(255,255,255,0.16);
}

.fa-report-item__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.fa-report-item__actions .fa-inline-form {
  margin: 0;
}

@media (max-width: 900px) {
  .fa-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fa-report-item__head {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .fa-stats-grid {
    grid-template-columns: 1fr;
  }

  .fa-report-item__actions,
  .fa-report-item__actions .fa-inline-form,
  .fa-report-item__actions .ul-action {
    width: 100%;
  }

  .fa-report-item__actions .ul-action {
    justify-content: center;
  }
}

/* ============================================================
   eMS v3 Admin — Final Mobile / Stability Polish
   Append at VERY BOTTOM of admin.css
   ============================================================ */

/* Variable aliases for older/newer CSS blocks */
:root {
  --font-main: var(--font-body);
  --text-muted: var(--silver);
  --input-bg: var(--black);
}

/* Stronger layout safety */
.ap-shell,
.ap-header,
.ap-main,
.ap-module,
.ap-module__body,
.dashboard-grid,
.ue-layout,
.ue-grid,
.ev-detail-page,
.ev-detail-grid,
.ev-card-editor-page,
.st-module-list,
.sz-module-row,
.venue-layout,
.venue-top-grid,
.msg-layout,
.doc-layout {
  min-width: 0;
}

/* Avoid unexpected horizontal bleed from long names, URLs, slugs, tokens */
.ap-main,
.ap-module__body,
.ue-field,
.ul-table td,
.ap-table td,
.ev-card-item__main,
.ev-card-panel,
.ev-builder-collapse,
.st-help-prompt,
.st-module-card,
.sz-module-name,
.doc-article,
.msg-bubble-body,
.nc-message {
  overflow-wrap: anywhere;
}

/* Tables should scroll horizontally without forcing the whole admin shell wider */
.table-wrap,
.ap-table-wrap,
.ul-table-wrap,
.mt-table-wrap,
.venue-table-wrap,
.ev-results-table-wrap,
.st-token-ref__body,
.ap-module__body:has(table),
.ap-module__body:has(.ul-table),
.ap-module__body:has(.ap-table) {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Keep tables readable inside scroll wrappers */
.ap-table,
.ul-table,
.mt-table,
.venue-table,
.ev-results-table,
.st-token-ref table {
  width: 100%;
  min-width: 720px;
}

/* Smaller utility tables do not always need the full 720px width */
.st-token-ref table,
.ev-results-table {
  min-width: 560px;
}

/* Let dropdowns/popovers breathe unless a module is intentionally a scroll wrapper */
.ap-module {
  overflow: visible;
}

.ap-module__body {
  max-width: 100%;
}

/* But keep code/editor/table-heavy bodies from visually spilling */
.ap-module__body:has(.CodeMirror),
.ap-module__body:has(.tox-tinymce),
.ap-module__body:has(table) {
  overflow-x: auto;
}

/* Improve focus visibility across admin controls */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
.ue-input:focus-visible,
.ue-select:focus-visible,
.ue-textarea:focus-visible,
.ul-filter-input:focus-visible,
.ul-filter-select:focus-visible,
.ev-action-select:focus-visible,
.ev-character-bubble-select:focus-visible {
  outline: 2px solid var(--red-glow);
  outline-offset: 2px;
}

/* Touch target consistency */
.ul-action,
.nc-btn,
.ue-btn,
.ul-filter-btn,
.ul-filter-clear,
.ap-module__action,
.ev-card-move-btn,
.ev-card-item__actions .button,
.dash-card-row__actions .button,
.ev-card-editor-actions .button,
.ev-card-editor-actions button {
  touch-action: manipulation;
}

/* Select2 and dropdown layers should always appear above modules */
.select2-container,
.select2-dropdown,
.ap-user-menu,
.ap-fed-switcher__dropdown,
.ap-char-switcher__dropdown {
  z-index: 500;
}

/* Prevent iOS 100vh issues while keeping the admin app-shell feel */
.ap-shell {
  height: 100vh;
  height: 100dvh;
}

.ap-main {
  min-height: 0;
}

/* Mobile: stronger page-level comfort */
@media (max-width: 700px) {
  .ap-shell {
    grid-template-rows: var(--header-h) minmax(0, 1fr) var(--footer-h);
  }

  .ap-main {
    padding: 16px 12px 28px;
  }

  .ap-header {
    min-width: 0;
  }

  .ap-logo {
    min-width: 0;
  }

  .ap-logo__name {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 17px;
    letter-spacing: 2px;
  }

  .ap-user-menu {
    right: 10px;
    max-width: calc(100vw - 20px);
  }

  .ap-char-switcher__dropdown,
  .ap-fed-switcher__dropdown {
    right: 0;
    left: auto;
    width: min(320px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
  }

  .ap-page-title {
    font-size: clamp(32px, 12vw, 48px);
    letter-spacing: 2px;
  }

  .ap-section-heading {
    align-items: flex-start;
    font-size: 16px;
    letter-spacing: 2px;
  }

  .ap-section-heading::after {
    margin-top: 14px;
  }

  .ap-module__head {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
  }

  .ap-module__action {
    margin-left: 0;
  }

  .ap-module__title {
    font-size: 18px;
    letter-spacing: 2px;
    line-height: 1.1;
  }

  .ap-notice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
  }

  .ap-notice__dismiss {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 34px;
  }

  .ap-footer {
    padding: 0 10px;
    gap: 8px;
    font-size: 8px;
  }

  .ap-footer > * {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ue-meta-bar {
    grid-template-columns: 1fr;
  }

  .ue-toggle-wrap,
  .ch-primary-wrap,
  .ev-check-row {
    align-items: flex-start;
    line-height: 1.35;
  }

  .ue-toggle-wrap input[type="checkbox"],
  .ch-primary-wrap input,
  .ev-check-row input[type="checkbox"] {
    margin-top: 2px;
    flex: 0 0 auto;
  }

  .ul-pagination {
    gap: 8px;
    flex-wrap: wrap;
  }

  .ul-page-btn {
    flex: 1 1 120px;
    text-align: center;
  }

  .ul-page-info {
    width: 100%;
    text-align: center;
  }

  .ul-action,
  .nc-btn {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .nc-actions,
  .ev-actions,
  .dash-card-header-actions,
  .ev-detail-actions,
  .ev-card-editor-actions,
  .ta-nav {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .nc-actions > *,
  .ev-actions > *,
  .dash-card-header-actions > *,
  .ev-detail-actions > *,
  .ev-card-editor-actions > *,
  .ta-nav > * {
    width: 100%;
  }

  .CodeMirror,
  .st-editor-panel .CodeMirror,
  textarea.st-codearea {
    min-height: 420px !important;
    height: 420px !important;
  }

  .tox.tox-tinymce {
    min-height: 360px;
  }
}

/* Very small phones */
@media (max-width: 420px) {
  .ap-main {
    padding-left: 10px;
    padding-right: 10px;
  }

  .ap-logo__img {
    max-width: 104px;
  }

  .ap-char-switcher__current {
    max-width: 150px;
  }

  .ap-char-switcher__name {
    max-width: 92px;
  }

  .ap-module__body {
    padding: 12px;
  }

  .ue-input,
  .ue-select,
  .ue-textarea {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* Optional sharp-corner consistency pass.
   Keep this because eMS v3 admin is supposed to be sharp-edged. */
.ap-module,
.ap-module__head,
.ap-module__body,
.ap-settings-card,
.ue-input,
.ue-select,
.ue-textarea,
.ue-btn,
.ul-action,
.ul-filter-input,
.ul-filter-select,
.ul-filter-btn,
.ul-filter-clear,
.notice,
.notice-dismiss,
.ap-notice,
.ap-hdr-icon,
.ap-user-menu,
.ap-fed-switcher__current,
.ap-fed-switcher__dropdown,
.ap-char-switcher__current,
.ap-char-switcher__dropdown,
.br-file-label,
.br-file-name,
.it-config-warning,
.it-empty-config,
.ch-roster-preview,
.ch-roster-empty,
.ch-roster-notes,
.cr-panel,
.venue-add-card__summary,
.venue-residency-item,
.ev-detail-page *,
.ev-card-editor-page * {
  border-radius: 0 !important;
}

/* ============================================================
   eMS v3 Phase 7
   Character Statuses · Analytics · Registration/Admin Polish
   ============================================================ */

/* ── Character Status Manager ───────────────────────────────────────────── */

.cs-color-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border: 1px solid rgba(255,255,255,.28);
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0,0,0,.55);
}

.cs-perm-grid {
  display: grid;
  gap: 8px;
}

.cs-perm-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 10px 11px;
  border: 1px solid var(--border);
  background: var(--black);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.cs-perm-item:hover {
  border-color: var(--red-dim);
  background: rgba(255,255,255,.025);
}

.cs-perm-item input {
  margin-top: 2px;
  accent-color: var(--red);
}

.cs-perm-label {
  display: block;
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.cs-perm-desc {
  display: block;
  margin-top: 3px;
  color: var(--silver);
  font-size: 11px;
  line-height: 1.35;
}

.ch-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,.18);
}

/* ── Inline forms used by status/actions tables ─────────────────────────── */

.inline-form {
  display: inline;
}

/* ── Analytics Dashboard ────────────────────────────────────────────────── */

.an-online-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid rgba(74, 222, 128, .32);
  background: rgba(74, 222, 128, .08);
  color: #4ade80;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1;
}

.an-online-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  box-shadow: 0 0 10px rgba(74, 222, 128, .65);
}

.an-overview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.an-stat-card {
  position: relative;
  overflow: hidden;
  min-height: 106px;
  padding: 16px;
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(255,255,255,.045), rgba(255,255,255,0)),
    var(--panel);
}

.an-stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--border);
}

.an-stat-card--highlight::before {
  background: var(--red);
}

.an-stat-card--online::before {
  background: #4ade80;
}

.an-stat-card__num {
  display: block;
  color: var(--white);
  font-family: var(--font-head);
  font-size: 34px;
  letter-spacing: 2px;
  line-height: 1;
}

.an-stat-card__label {
  display: block;
  margin-top: 9px;
  color: var(--silver);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .16em;
  line-height: 1.35;
  text-transform: uppercase;
}

/* CSS-only bar chart */

.an-bar-chart {
  display: grid;
  gap: 8px;
}

.an-bar-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 42px;
  gap: 9px;
  align-items: center;
}

.an-bar-label,
.an-bar-val {
  color: var(--silver);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.an-bar-val {
  text-align: right;
}

.an-bar-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 18px;
  padding: 3px;
  border: 1px solid var(--border);
  background: var(--black);
}

.an-bar {
  height: 10px;
  min-width: 0;
  background: var(--blue-hi);
}

.an-bar--bot {
  background: var(--red);
}

/* Device breakdown */

.an-device-bar {
  display: flex;
  width: 100%;
  min-height: 38px;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--black);
}

.an-device-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .05em;
  line-height: 1;
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
}

.an-device-seg--desktop {
  background: var(--blue-hi);
}

.an-device-seg--mobile {
  background: var(--red);
}

.an-device-seg--tablet {
  background: var(--yellow);
  color: #111;
}

.an-device-seg--bot {
  background: #4a1120;
}

.an-device-seg + .an-device-seg {
  border-left: 1px solid rgba(255,255,255,.16);
}

/* ── Email settings polish ──────────────────────────────────────────────── */

#smtp_password[value="••••••••"] {
  letter-spacing: .18em;
}

/* ── Responsive Phase 7 additions ───────────────────────────────────────── */

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

@media (max-width: 760px) {
  .an-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .an-stat-card {
    min-height: 94px;
    padding: 14px;
  }

  .an-stat-card__num {
    font-size: 28px;
  }

  .an-bar-row {
    grid-template-columns: 48px minmax(0, 1fr) 34px;
    gap: 7px;
  }

  .cs-perm-item {
    padding: 11px;
  }
}

@media (max-width: 480px) {
  .an-overview-grid {
    grid-template-columns: 1fr;
  }

  .an-online-badge {
    margin-top: 10px;
  }

  .an-bar-label,
  .an-bar-val {
    font-size: 9px;
  }

  .an-device-bar {
    min-height: 32px;
  }

  .an-device-seg {
    font-size: 8px;
  }
}

/* ── Application Template Builder ─────────────────────────────────────────── */

.ab-field-panel {
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.ab-field-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--black);
    color: var(--silver);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 2px;
}

.ab-field-panel__body {
    padding: 12px 14px;
}

.ab-field-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    cursor: default;
}

.ab-field-row.ab-dragging {
    opacity: 0.5;
    border-style: dashed;
}

.ab-drag-handle {
    flex-shrink: 0;
    color: var(--border);
    cursor: grab;
    font-size: 14px;
}

.ab-field-info {
    flex: 1;
    min-width: 0;
}

.ab-field-name {
    display: block;
    margin-bottom: 4px;
    color: var(--light);
    font-size: 12px;
}

.ab-label-override {
    padding: 3px 8px;
    font-size: 11px;
}

.ab-required-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--silver);
    font-size: 11px;
    white-space: nowrap;
}

.ab-required-toggle input[type="checkbox"] {
    accent-color: var(--red);
}

.ab-field-actions {
    display: flex;
    flex-shrink: 0;
    gap: 4px;
}

.ab-field-actions button {
    padding: 3px 8px;
    border: 1px solid var(--border);
    background: var(--black);
    color: var(--silver);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 10px;
}

.ab-field-actions button:hover {
    border-color: var(--silver);
    color: var(--white);
}

.ab-field-actions button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ab-remove {
    border-color: var(--red-dim) !important;
    color: var(--red) !important;
}

.ab-add-btn {
    margin: 2px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--silver);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 10px;
    transition: all .15s;
}

.ab-add-btn:hover {
    border-color: var(--red);
    color: var(--white);
}

.ab-empty {
    padding: 12px;
    border: 1px dashed var(--border);
    color: var(--border);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 10px;
}

.ab-locked-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    background: var(--black);
    opacity: 0.6;
}

.ab-locked-badge {
    padding: 2px 6px;
    background: var(--border);
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 1px;
}

.ab-field-picker {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.ab-field-picker-title {
    margin-bottom: 6px;
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.ab-builder-note {
    margin-bottom: 12px;
    color: var(--silver);
    font-size: 12px;
    line-height: 1.5;
}

.ab-builder-fixed {
    margin-bottom: 10px;
}

.ab-builder-fixed-title {
    margin-bottom: 6px;
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.ab-builder-list {
    min-height: 42px;
}

/* Application review page */

.app-review-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.app-review-section:last-child {
    border-bottom: none;
}

.app-review-label {
    display: block;
    margin-bottom: 4px;
    color: var(--silver);
    text-transform: uppercase;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 2px;
}

.app-review-value {
    color: var(--light);
    font-size: 14px;
    line-height: 1.5;
}

.app-review-value--pre {
    white-space: pre-wrap;
}

.app-field-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.app-member-card {
    margin-bottom: 10px;
    border: 1px solid var(--border);
}

.app-member-card__head {
    padding: 8px 12px;
    background: var(--black);
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 10px;
}

.app-member-card__body {
    padding: 12px;
}

.app-review-actions {
    display: grid;
    gap: 8px;
}

.app-review-actions .ue-btn {
    width: 100%;
}

.app-review-split-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.app-review-form + .app-review-form {
    margin-top: 10px;
}

.app-review-warning {
    margin: 10px 0;
    padding: 10px 12px;
    border: 1px solid rgba(243, 156, 18, 0.35);
    background: rgba(243, 156, 18, 0.08);
    color: var(--yellow);
    font-size: 12px;
    line-height: 1.5;
}

.app-review-muted {
    color: var(--silver);
    font-size: 12px;
    line-height: 1.5;
}

.app-review-link {
    color: var(--red-glow);
    text-decoration: none;
}

.app-review-link:hover {
    color: var(--white);
}

/* Pending badge in sidebar */

.ap-nav__badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--red);
    color: #fff;
    vertical-align: middle;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
}

/* Application status badges */

.app-status-pending,
.app-status-accepted,
.app-status-rejected,
.app-status-saved {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.app-status-pending {
    color: #60a5fa;
}

.app-status-accepted {
    color: #4ade80;
}

.app-status-rejected {
    color: var(--red);
}

.app-status-saved {
    color: #f2c94c;
}

.app-status-pill {
    display: inline-block;
    padding: 3px 8px;
    border: 1px solid currentColor;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.app-status-pill--pending {
    color: #60a5fa;
}

.app-status-pill--accepted {
    color: #4ade80;
}

.app-status-pill--rejected {
    color: var(--red);
}

.app-status-pill--saved {
    color: #f2c94c;
}

/* Application list/template table helpers */

.app-applicant-name {
    display: block;
    color: var(--white);
    font-weight: 700;
}

.app-applicant-handler {
    display: block;
    margin-top: 2px;
    color: var(--silver);
    font-size: 11px;
}

.app-template-name {
    display: block;
    color: var(--white);
    font-weight: 700;
}

.app-template-slug {
    display: block;
    margin-top: 2px;
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 10px;
}

.app-count-pair {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 10px;
}

.app-count-pair strong {
    color: var(--white);
    font-size: 13px;
}

.app-template-badge {
    display: inline-block;
    padding: 2px 7px;
    border: 1px solid var(--border);
    color: var(--silver);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.app-template-badge--group {
    border-color: var(--red-dim);
    color: var(--red-glow);
}

.app-template-badge--single {
    color: var(--silver);
}

/* Responsive */

@media (max-width: 900px) {
    .ab-field-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .ab-field-info {
        flex: 1 1 calc(100% - 32px);
    }

    .ab-required-toggle {
        margin-left: 22px;
    }

    .ab-field-actions {
        width: 100%;
        margin-left: 22px;
    }

    .ab-field-actions button {
        flex: 1;
        padding: 8px 10px;
    }

    .app-review-split-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .app-field-grid {
        grid-template-columns: 1fr;
    }

    .ab-field-panel__head {
        padding: 12px;
    }

    .ab-field-panel__body {
        padding: 12px;
    }

    .ab-add-btn {
        width: 100%;
        margin: 3px 0;
        padding: 9px 10px;
        text-align: left;
    }

    .ab-locked-row {
        flex-wrap: wrap;
        padding: 10px;
    }
}

/* ── Application Builder Field Row Fix / Narrow Column Polish ────────────── */

#app-field-builder .ab-field-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
}

#app-field-builder .ab-drag-handle {
    grid-column: 1;
    align-self: center;
    text-align: center;
}

#app-field-builder .ab-field-info {
    grid-column: 2;
    min-width: 0;
}

#app-field-builder .ab-field-name {
    display: block;
    width: 100%;
    margin-bottom: 6px;
    color: var(--white);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    word-break: normal;
    overflow-wrap: anywhere;
}

#app-field-builder .ab-label-override {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

#app-field-builder .ab-required-toggle {
    grid-column: 3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    white-space: nowrap;
}

#app-field-builder .ab-field-actions {
    grid-column: 4;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    width: auto;
    margin: 0;
}

#app-field-builder .ab-field-actions button {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    line-height: 1;
}

/* Locked rows should match the same readable layout */
#app-field-builder .ab-locked-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
}

#app-field-builder .ab-locked-row .ab-field-name {
    margin-bottom: 0;
}

#app-field-builder .ab-locked-badge {
    justify-self: end;
    white-space: nowrap;
}

/* Medium/narrow builder columns */
@media (max-width: 1200px) {
    #app-field-builder .ab-field-row {
        grid-template-columns: 22px minmax(0, 1fr);
        align-items: start;
    }

    #app-field-builder .ab-drag-handle {
        grid-column: 1;
        grid-row: 1 / span 2;
        padding-top: 4px;
    }

    #app-field-builder .ab-field-info {
        grid-column: 2;
        grid-row: 1;
    }

    #app-field-builder .ab-required-toggle {
        grid-column: 2;
        grid-row: 2;
        margin-top: 6px;
    }

    #app-field-builder .ab-field-actions {
        grid-column: 2;
        grid-row: 3;
        justify-content: flex-start;
        margin-top: 8px;
    }
}

/* Very narrow/mobile: big tap targets and no crushed labels */
@media (max-width: 700px) {
    #app-field-builder .ab-field-panel__body {
        padding: 10px;
    }

    #app-field-builder .ab-field-row {
        grid-template-columns: 24px minmax(0, 1fr);
        gap: 8px;
        padding: 12px;
    }

    #app-field-builder .ab-field-name {
        font-size: 13px;
        line-height: 1.3;
    }

    #app-field-builder .ab-required-toggle {
        font-size: 12px;
    }

    #app-field-builder .ab-field-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    #app-field-builder .ab-field-actions button {
        width: 100%;
        min-height: 36px;
        padding: 8px 10px;
    }

    #app-field-builder .ab-label-override {
        font-size: 13px;
        padding: 9px 10px;
    }

    #app-field-builder .ab-locked-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    #app-field-builder .ab-locked-badge {
        justify-self: start;
    }
}

/* ─────────────────────────────────────────────────────────────
   Application Template Builder — Final Field Layout Override
   Fixes crushed one-letter-per-line labels in narrow side panel
───────────────────────────────────────────────────────────── */

#app-field-builder .ab-builder-list,
#app-field-builder [data-field-list],
#app-field-builder .ab-field-panel,
#app-field-builder .ab-field-panel__body {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: visible !important;
}

#app-field-builder .ab-field-row {
    position: relative !important;
    display: grid !important;
    grid-template-columns: 22px minmax(0, 1fr) !important;
    grid-template-areas:
        "drag info"
        "drag required"
        "drag actions" !important;
    align-items: start !important;
    gap: 8px 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 0 8px !important;
    padding: 12px !important;
    border: 1px solid var(--border) !important;
    background: var(--panel) !important;
    overflow: visible !important;
}

#app-field-builder .ab-drag-handle {
    grid-area: drag !important;
    width: 22px !important;
    min-width: 22px !important;
    max-width: 22px !important;
    padding-top: 4px !important;
    text-align: center !important;
    color: var(--border) !important;
}

#app-field-builder .ab-field-info {
    grid-area: info !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: visible !important;
}

#app-field-builder .ab-field-name {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 0 8px !important;
    color: var(--white) !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1.25 !important;
    letter-spacing: 0 !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
}

#app-field-builder .ab-label-override {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 34px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
}

#app-field-builder .ab-required-toggle {
    grid-area: required !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 7px !important;
    width: max-content !important;
    max-width: 100% !important;
    margin: 0 !important;
    color: var(--silver) !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
}

#app-field-builder .ab-required-toggle input[type="checkbox"] {
    width: 14px !important;
    height: 14px !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
}

#app-field-builder .ab-field-actions {
    grid-area: actions !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 2px 0 0 !important;
}

#app-field-builder .ab-field-actions button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    font-size: 12px !important;
    line-height: 1 !important;
}

/* Locked fields at the top of the builder */
#app-field-builder .ab-locked-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 10px 12px !important;
    overflow: visible !important;
}

#app-field-builder .ab-locked-row .ab-field-name {
    margin: 0 !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
}

#app-field-builder .ab-locked-badge {
    white-space: nowrap !important;
}

/* The Add buttons below each panel */
#app-field-builder .ab-field-picker {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

#app-field-builder .ab-add-btn {
    display: inline-flex !important;
    align-items: center !important;
    width: auto !important;
    max-width: 100% !important;
    white-space: normal !important;
    line-height: 1.25 !important;
}

/* Extra narrow side-panel fallback */
@media (max-width: 1300px) {
    #app-field-builder .ab-field-row {
        grid-template-columns: 18px minmax(0, 1fr) !important;
        gap: 8px !important;
        padding: 10px !important;
    }

    #app-field-builder .ab-drag-handle {
        width: 18px !important;
        min-width: 18px !important;
        max-width: 18px !important;
    }

    #app-field-builder .ab-field-name {
        font-size: 12px !important;
    }

    #app-field-builder .ab-field-actions button {
        width: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        height: 30px !important;
        min-height: 30px !important;
    }
}

/* ── X-Connect admin ──────────────────────────────────────────────────────── */
.xc-admin-platform-section { margin-bottom: 28px; padding-bottom: 28px; border-bottom: 1px solid var(--border); }
.xc-admin-platform-section:last-child { border-bottom: none; }
.xc-admin-platform-title { font-family: var(--font-mono); font-size: 11px; letter-spacing: 3px; color: var(--silver); text-transform: uppercase; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.xc-admin-platform-title--blue  .xc-admin-dot { background: #60a5fa; }
.xc-admin-platform-title--black .xc-admin-dot { background: #e0e0e0; }
.xc-admin-platform-title--red   .xc-admin-dot { background: #f87171; }
.xc-admin-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--red); }

  border-radius: 0 !important;
}
/* ══════════════════════════════════════════════════════════════════════════ */
/* V2 IMPORTER                                                                */
/* ══════════════════════════════════════════════════════════════════════════ */

/* Step indicator */
.imp-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 28px;
    border: 1px solid var(--border);
    overflow: hidden;
}
.imp-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    font-size: 12px;
    flex: 1;
    border-right: 1px solid var(--border);
    opacity: 0.4;
    background: var(--black);
}
.imp-step:last-child { border-right: none; }
.imp-step--active {
    opacity: 1;
    background: var(--panel);
    color: var(--white);
}
.imp-step--done {
    opacity: 0.7;
    color: #4ade80;
}
.imp-step__num {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    width: 24px;
    height: 24px;
    border: 1px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.imp-step--active .imp-step__num { border-color: var(--red); color: var(--red); }
.imp-step--done  .imp-step__num  { border-color: #4ade80; background: rgba(74,222,128,0.1); }
.imp-step__label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 2px; text-transform: uppercase; }

/* Card */
.imp-card {
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 20px;
}
.imp-card__title {
    font-family: var(--font-head);
    font-size: 20px;
    letter-spacing: 2px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* Intro text */
.imp-intro {
    font-size: 13px;
    color: var(--silver);
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Safety box */
.imp-safety-box {
    border-left: 3px solid #f2c94c;
    background: rgba(242,201,76,0.06);
    padding: 14px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.6;
}
.imp-safety-box strong { color: #f2c94c; display: block; margin-bottom: 6px; }
.imp-safety-box--info { border-left-color: #60a5fa; background: rgba(96,165,250,0.06); }
.imp-safety-box--info strong { color: #60a5fa; }
.imp-safety-box ul { margin: 8px 0 0 16px; padding: 0; }
.imp-safety-box li { margin-bottom: 4px; }
.imp-safety-box code {
    font-family: var(--font-mono);
    font-size: 10px;
    background: rgba(255,255,255,0.08);
    padding: 2px 6px;
}

/* Preflight checks */
.imp-preflight {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 20px;
}
.imp-section-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 3px;
    color: var(--silver);
    text-transform: uppercase;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.imp-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 12px;
    font-size: 12px;
    background: var(--black);
    border: 1px solid var(--border);
}
.imp-check--ok      { border-left: 3px solid #4ade80; }
.imp-check--warning { border-left: 3px solid #f2c94c; }
.imp-check--error   { border-left: 3px solid var(--red); }
.imp-check--info    { border-left: 3px solid #60a5fa; }
.imp-check__icon {
    font-family: var(--font-mono);
    font-weight: 700;
    flex-shrink: 0;
    width: 16px;
}
.imp-check--ok      .imp-check__icon { color: #4ade80; }
.imp-check--warning .imp-check__icon { color: #f2c94c; }
.imp-check--error   .imp-check__icon { color: var(--red-glow); }
.imp-check--info    .imp-check__icon { color: #60a5fa; }

/* Piece selection grid */
.imp-pieces-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}
.imp-piece-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background: var(--black);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 12px;
    transition: border-color .15s;
}
.imp-piece-item:hover { border-color: var(--red); }
.imp-piece-item input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; }
.imp-dry-run .imp-piece-item { border-color: rgba(242,201,76,0.3); background: rgba(242,201,76,0.05); }

/* Summary grid */
.imp-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--black);
    border: 1px solid var(--border);
}
.imp-summary-grid > div { font-size: 13px; }
.imp-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--silver);
    margin-bottom: 4px;
}

/* Piece ordered list */
.imp-piece-list {
    margin: 0 0 20px 20px;
    padding: 0;
    font-size: 13px;
    color: var(--light);
    line-height: 2;
}

/* Results */
.imp-result-totals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.imp-result-total {
    padding: 20px;
    text-align: center;
    background: var(--black);
    border: 1px solid var(--border);
}
.imp-result-total strong {
    display: block;
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 4px;
}
.imp-result-total span {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--silver);
    text-transform: uppercase;
}
.imp-result-total--ok    strong { color: #4ade80; }
.imp-result-total--skip  strong { color: #f2c94c; }
.imp-result-total--error strong { color: var(--red-glow); }
