/**
 * Site-admin additions on top of the vendored game admin.css (which is never edited here, see
 * VENDORED.md). Only fixes for content the game panel does not have: longer RO status lines
 * and 3-up tiles that overflow a 375px screen. Uses the game's own tokens; adds no colors.
 */

/* Status rows: let a long detail wrap instead of being clipped. */
.row-list .row { flex-wrap: wrap; }
.row-list .row .row__text { min-width: 0; }
.row-list .row .hint { min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 759px) {
  /* name + badge on the first line, the detail text under it */
  .row-list .row--tall .badge { order: 3; margin-left: auto; }
  .row-list .row--tall .hint { order: 4; flex: 1 1 100%; padding-left: 20px; }
  .tile-grid--3 { grid-template-columns: 1fr; }
}

/* Data pages: filter rows, the save box and the detail table */
.filter-form { flex-direction: column; align-items: stretch; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; margin-top: 8px; }
.filter-row .select, .filter-row .input { min-width: 0; width: 100%; }
.save-form { align-items: flex-end; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.kv-table th { text-align: left; font-weight: 600; color: var(--cb-text-secondary); padding-right: 16px; white-space: nowrap; vertical-align: top; }
.kv-table td { overflow-wrap: anywhere; }
.chip .inline-form { display: inline; margin-left: 6px; }
@media (max-width: 759px) { .filter-row { grid-template-columns: 1fr; } }


/* Step 3: flags, signals, erasure */
.flag-form { display: grid; gap: 10px; }
.flag-form .select, .flag-form .input { width: 100%; }
.signal-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.checkbox-row { display: flex; gap: 8px; align-items: flex-start; }
.confirm-panel .note-box { margin: 12px 0; }
.confirm-panel ul { padding-left: 18px; }

/* ---------------------------------------------------------------------------------------------- */
/* Wide tables: always visible scrollbar, edge fades, pinned columns, truncated long values         */
/* ---------------------------------------------------------------------------------------------- */
.data-table th, .data-table td { white-space: nowrap; }
.trunc { display: inline-block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

.tw { position: relative; timeline-scope: --twx; border-radius: var(--cb-r-xl); background: var(--cb-surface-1); border: 1px solid var(--cb-border-weak); }
.table-scroll--wide { overflow-x: scroll; overflow-y: hidden; scroll-timeline: --twx inline; scrollbar-width: auto; border: 0; background: transparent; }

/* The scrollbar is never the auto-hiding overlay kind: it always shows a track and a thumb. */
.table-scroll--wide::-webkit-scrollbar { height: 14px; width: 14px; display: block; }
.table-scroll--wide::-webkit-scrollbar-track { background: var(--cb-surface-2); border-radius: 0 0 var(--cb-r-xl) var(--cb-r-xl); }
.table-scroll--wide::-webkit-scrollbar-thumb { background: var(--cb-border-strong); border-radius: 8px; border: 3px solid var(--cb-surface-2); }
.table-scroll--wide::-webkit-scrollbar-thumb:hover { background: var(--cb-text-label); }
@supports not selector(::-webkit-scrollbar) { .table-scroll--wide { scrollbar-color: var(--cb-border-strong) var(--cb-surface-2); } }

.data-table--pinned { border-collapse: separate; border-spacing: 0; }
.data-table--pinned th, .data-table--pinned td { background: var(--cb-surface-1); }
.col-check, .col-id, .col-actions { position: sticky; z-index: 2; }
.data-table--pinned thead th { position: relative; }
.data-table--pinned thead th.col-check, .data-table--pinned thead th.col-id, .data-table--pinned thead th.col-actions { position: sticky; z-index: 3; }
.col-check { left: 0; width: 44px; min-width: 44px; max-width: 44px; text-align: center; padding-left: 0; padding-right: 0; }
.col-id { left: 44px; width: 220px; min-width: 220px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; box-shadow: 1px 0 0 var(--cb-border-weak); font-weight: 700; }
.col-actions { right: 0; min-width: 132px; text-align: right; box-shadow: -1px 0 0 var(--cb-border-weak); }
.col-check input { width: 18px; height: 18px; accent-color: var(--cb-cyan); cursor: pointer; }
.data-table tr.is-selected td { background: color-mix(in srgb, var(--cb-surface-1), var(--cb-cyan) 9%); }
.btn--sm { min-height: 30px; padding: 0 10px; font-size: 12px; }

/* Fade on the edge that has more content. Scroll-driven where supported (Chromium, Safari 26); elsewhere only
   a static fade on the right, so there is always a hint that the table continues. */
.tw__fade { position: absolute; top: 0; bottom: 14px; width: 36px; pointer-events: none; z-index: 4; }
.tw__fade--l { left: 264px; background: linear-gradient(to right, rgba(0, 0, 0, 0.38), rgba(0, 0, 0, 0)); opacity: 0; }
.tw__fade--r { right: 132px; background: linear-gradient(to left, rgba(0, 0, 0, 0.38), rgba(0, 0, 0, 0)); opacity: 1; }
.tw--plain .tw__fade--l { left: 0; }
.tw--plain .tw__fade--r { right: 0; }
@keyframes tw-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tw-fade-out { from { opacity: 1; } to { opacity: 0; } }
@supports (animation-timeline: scroll()) {
  .tw__fade--l { animation: tw-fade-in linear both; animation-timeline: --twx; animation-range: 0px 48px; }
  .tw__fade--r { animation: tw-fade-out linear both; animation-timeline: --twx; animation-range: calc(100% - 48px) 100%; }
}

/* Selection bar and columns menu */
.selection-bar { margin: 10px 0; padding: 10px 14px; }
.selection-bar__status { font-size: 13px; }
.selection-bar__row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.selection-bar__actions { padding-top: 8px; border-top: 1px solid var(--cb-border-weak); }
.selection-bar .field__label { margin: 0 4px 0 0; }
.input--inline { width: auto; min-width: 200px; flex: 1 1 200px; min-height: 30px; padding-top: 0; padding-bottom: 0; font-size: 12px; }
.select--inline { width: auto; min-height: 30px; padding-top: 0; padding-bottom: 0; font-size: 12px; }

/* List pages: the table may use the whole content width, everything else keeps the normal reading width. */
.content__inner--wide { max-width: none; }
.content__inner--wide > *:not(.sel-form):not(.pager):not(.tw) { max-width: 1120px; width: 100%; }
.hint--warn { color: var(--cb-orange); }
.list-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.columns-menu { position: relative; }
.columns-menu > summary { list-style: none; cursor: pointer; }
.columns-menu > summary::-webkit-details-marker { display: none; }
.columns-menu__panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(680px, 92vw); padding: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
.columns-menu__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 14px; margin-bottom: 12px; }

/* The global button/input rules in admin.css are more specific than the plain size classes; these win by order. */
.sel-form .selection-bar .selection-bar__row button.btn.btn--sm, .list-tools .columns-menu > summary.btn.btn--sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.selection-bar input.input--inline, .selection-bar select.select--inline { min-height: 30px; padding-top: 0; padding-bottom: 0; font-size: 12px; }

@media (max-width: 759px) { .list-tools .columns-menu { display: none; } }

/* Analytics overview */
.range-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 759px) { .two-col { grid-template-columns: 1fr; } }
.analytics-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 4px; }
.two-col .row__text { min-width: 0; flex: 1; }
