/* ============================================================
   Admin / CMS — extends the participant design system.
   Same dark theme + red/gold/green semantics, but denser.
   Distinguished by a steel-blue operator accent on chrome only.
   ============================================================ */

:root {
  --steel:     #5b8def;   /* admin chrome accent (chrome only, not actions) */
  --steel-dim: #2b3b5e;
  --adm-side:  #0e1016;
}

/* admin sidebar gets a cool steel top-glow instead of red */
.app.admin {
  background:
    radial-gradient(1100px 520px at 82% -12%, rgba(91,141,239,.10), transparent 60%),
    var(--bg);
}
.app.admin .side { background: linear-gradient(180deg, #0d0f15, var(--bg)); }
.app.admin .brand-mark { background: linear-gradient(145deg, #6f9bf0, #2b3b5e); box-shadow: 0 0 0 1px rgba(91,141,239,.4), 0 8px 30px -8px rgba(91,141,239,.5); }
.app.admin .brand-name span { color: var(--steel); }
.app.admin .nav-item.active::before { background: var(--steel); }

/* operator pill in admin topbar */
.adm-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--steel); background: rgba(91,141,239,.12); border: 1px solid rgba(91,141,239,.3);
  padding: 4px 10px; border-radius: 7px;
}

.app.admin .main-inner { max-width: 1280px; padding-left: 24px; padding-right: 24px; }

/* ---------------- admin dense stat cards ---------------- */
.adm-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
@media (max-width: 980px){ .adm-stats { grid-template-columns: repeat(2,1fr);} }
@media (max-width: 560px){ .adm-stats { grid-template-columns: 1fr;} }
.adm-stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px 16px; display: flex; align-items: center; gap: 14px;
}
.adm-stat .ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.adm-stat .v { font-family: var(--font-num); font-weight: 800; font-size: 26px; line-height: 1; }
.adm-stat .k { font-size: 12px; color: var(--txt-2); margin-top: 4px; }
.adm-stat.warn { border-color: rgba(242,179,57,.3); }
.adm-stat.danger { border-color: rgba(255,93,93,.3); }

/* ---------------- toolbar ---------------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; min-width: 0; }
.toolbar .grow { flex: 1; min-width: 120px; }
.search {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; max-width: 360px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 0 12px;
}
.search input { background: none; border: none; outline: none; color: var(--txt); font-family: var(--font-body); font-size: 14px; padding: 11px 0; width: 100%; }
.search input::placeholder { color: var(--txt-3); }
.search svg { width: 17px; height: 17px; color: var(--txt-3); flex: none; }

.select-wrap { position: relative; max-width: 100%; }
.select {
  appearance: none; background: var(--surface); border: 1px solid var(--line); color: var(--txt);
  font-family: var(--font-body); font-size: 13.5px; font-weight: 500;
  padding: 10px 32px 10px 13px; border-radius: 11px; cursor: pointer; outline: none;
  max-width: 100%;
}
.select:hover { border-color: var(--line-2); }
.select-wrap::after { content: '⌄'; position: absolute; right: 12px; top: 7px; color: var(--txt-3); pointer-events: none; font-size: 15px; }
.btn-sm { padding: 9px 14px; font-size: 13.5px; border-radius: 10px; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 10px; }

/* ---------------- data table ---------------- */
.dtable-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.dtable-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.dtable { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.25; min-width: 640px; }
.dtable th, .dtable td { box-sizing: border-box; }
.dtable thead th {
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--txt-3); padding: 12px 14px; background: var(--bg-2); border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
.dtable tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dtable tbody tr:last-child td { border-bottom: none; }
.dtable tbody tr { transition: background .12s; }
.dtable tbody tr:hover { background: var(--surface); }
.dtable .num { font-family: var(--font-num); font-weight: 700; }
.dtable .right { text-align: right; }
.dtable .center { text-align: center; }
.dtable td.center, .dtable th.center { display: table-cell; text-align: center; vertical-align: middle; }
.dtable td.tight, .dtable th.tight { width: 1%; white-space: nowrap; }

.cell-team { display: flex; align-items: center; gap: 8px; max-width: 100%; min-width: 0; white-space: nowrap; }
.cell-team .disp { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.cell-name { font-weight: 600; }
.cell-sub { font-size: 11.5px; color: var(--txt-3); margin-top: 1px; }

.av-sm { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-family: var(--font-disp); font-weight: 700; font-size: 12px; background: linear-gradient(145deg,#2b3340,#1b212b); border: 1px solid var(--line-2); color: #fff; flex: none; }

/* row action buttons */
.row-actions { display: inline-flex; align-items: center; gap: 4px; flex-wrap: nowrap; white-space: nowrap; }
.row-actions .btn, .row-actions .ico-btn, .row-actions .inline-action-form { flex: none; }
.ico-btn {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--txt-2); cursor: pointer;
  transition: .14s;
}
.ico-btn:hover { color: #fff; border-color: var(--line-2); background: var(--surface-2); }
.ico-btn svg { width: 15px; height: 15px; }
.ico-btn.danger:hover { color: var(--neg); border-color: rgba(255,93,93,.4); }

/* status badges (admin) */
.sb { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 24px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 7px; letter-spacing: .02em; vertical-align: middle; white-space: nowrap; }
.sb .dot { width: 6px; height: 6px; border-radius: 50%; }
.sb-sched { color: var(--blue); background: rgba(74,140,255,.13); }
.sb-live  { color: #fff; background: var(--red); }
.sb-live .dot { background:#fff; animation: pulse 1.3s infinite; }
.sb-fin   { color: var(--txt-2); background: rgba(255,255,255,.06); }
.sb-cancel{ color: var(--neg); background: rgba(255,93,93,.12); }
.sb-post  { color: var(--gold); background: rgba(242,179,57,.12); }
.sb-on    { color: var(--green); background: rgba(25,195,125,.13); }
.sb-off   { color: var(--txt-3); background: rgba(255,255,255,.05); }
.sb-pending{ color: var(--gold); background: rgba(242,179,57,.12); }
.sb-running{ color: var(--steel); background: rgba(91,141,239,.14); }
.sb-running .dot { background: var(--steel); animation: pulse 1.1s infinite; }
.sb-success{ color: var(--green); background: rgba(25,195,125,.13); }
.sb-failed { color: var(--neg); background: rgba(255,93,93,.13); }
.sb-partial{ color: var(--gold); background: rgba(242,179,57,.12); }
.sb-win   { color: var(--green); background: rgba(25,195,125,.13); }
.sb-lose  { color: var(--neg); background: rgba(255,93,93,.12); }
.sb-push  { color: var(--txt-2); background: rgba(255,255,255,.06); }
.sb-star  { color: var(--gold); background: rgba(242,179,57,.13); }

.src-tag { font-size: 11px; font-weight: 600; color: var(--txt-2); background: var(--bg-2); border: 1px solid var(--line); padding: 3px 8px; border-radius: 6px; white-space: nowrap; }

/* ---------------- section / page header ---------------- */
.adm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.adm-head .t { font-family: var(--font-disp); font-weight: 700; font-size: 24px; letter-spacing: .01em; }
.adm-head .d { font-size: 13px; color: var(--txt-3); margin-top: 2px; }
.adm-head .acts { display: flex; gap: 8px; flex-wrap: wrap; }

.adm-block { margin-bottom: 26px; }
.adm-block-h { display:flex; align-items:center; gap:10px; margin-bottom: 12px; }
.adm-block-h .t { font-family: var(--font-disp); font-weight:700; font-size:18px; }
.adm-block-h .ln { flex:1; height:1px; background: var(--line); }

/* table meta footer */
.table-foot { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--txt-3); }
.pager { display: flex; gap: 4px; }
.pager .pg { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--txt-2); display: grid; place-items: center; cursor: pointer; font-size: 13px; }
.pager .pg.active { background: var(--raise); color: #fff; border-color: var(--line-2); }

/* ============================================================
   MODAL / DRAWER
   ============================================================ */
.modal-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 50; display: grid; place-items: center; padding: 24px; animation: mfade .18s var(--ease); }
@keyframes mfade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 540px; max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); animation: mpop .22s var(--ease);
}
.modal.wide { max-width: 680px; }
@keyframes mpop { from { transform: translateY(14px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-h .t { font-family: var(--font-disp); font-weight: 700; font-size: 20px; }
.modal-h .d { font-size: 12.5px; color: var(--txt-3); margin-top: 2px; }
.modal-b { padding: 20px 22px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.x-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--txt-2); display: grid; place-items: center; cursor: pointer; flex: none; }
.x-btn:hover { color: #fff; }

/* ---------------- form fields ---------------- */
.field { margin-bottom: 15px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--txt-2); margin-bottom: 7px; }
.field .hint { font-size: 11.5px; color: var(--txt-3); margin-top: 6px; line-height: 1.4; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px){ .field-row { grid-template-columns: 1fr; } }
.inp, .field select, textarea.inp {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px;
  color: var(--txt); font-family: var(--font-body); font-size: 14px; padding: 11px 13px; outline: none;
  transition: border-color .15s;
}
.inp:focus, .field select:focus, textarea.inp:focus { border-color: var(--steel); }
.field select { appearance: none; cursor: pointer; }
textarea.inp { resize: vertical; min-height: 72px; }

/* segmented radio (Home/Away etc) */
.seg-radio { display: flex; gap: 8px; }
.seg-radio .opt {
  flex: 1; text-align: center; padding: 11px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--line-2); background: var(--bg-2); font-size: 14px; font-weight: 600; color: var(--txt-2);
  transition: .14s;
}
.seg-radio .opt:hover { border-color: var(--txt-3); }
.seg-radio .opt.on { border-color: var(--red); background: rgba(224,56,59,.12); color: #fff; }
.seg-radio.steel .opt.on { border-color: var(--steel); background: rgba(91,141,239,.14); }
.seg-radio.gold .opt.on { border-color: var(--gold); background: rgba(242,179,57,.13); color: var(--gold); }

/* inline toggle field */
.toggle-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg-2); }
.toggle-field .tt { font-size: 13.5px; font-weight: 600; }
.toggle-field .ts { font-size: 11.5px; color: var(--txt-3); margin-top: 2px; }

/* gen-password row */
.genpw { display: flex; gap: 8px; }
.genpw .inp { flex: 1; font-family: var(--font-num); letter-spacing: .04em; }

/* ---------------- import action cards ---------------- */
.import-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; }
@media (max-width: 720px){ .import-grid { grid-template-columns: 1fr; } }
.import-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer;
  transition: .15s;
}
.import-card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow-card); }
.import-card .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.import-card .t { font-weight: 700; font-size: 14.5px; }
.import-card .d { font-size: 12px; color: var(--txt-3); margin-top: 2px; }
.import-card .go { margin-left: auto; color: var(--txt-3); }

/* admin actions quick panel */
.qa-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 10px; }
@media (max-width: 980px){ .qa-grid { grid-template-columns: repeat(2,1fr);} }
.qa {
  display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center;
  padding: 16px 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  transition: .15s; font-size: 12.5px; font-weight: 600; color: var(--txt);
}
.qa:hover { border-color: var(--line-2); background: var(--surface-2); transform: translateY(-2px); }
.qa .ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; }

.admin-dashboard-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  align-items: start;
}

.admin-score-input-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}

/* config helper note */
.note {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px;
  background: rgba(242,179,57,.07); border: 1px solid rgba(242,179,57,.25); font-size: 12.5px; color: var(--txt-2); line-height: 1.5;
}
.note svg { width: 17px; height: 17px; color: var(--gold); flex: none; margin-top: 1px; }
.note.steel { background: rgba(91,141,239,.07); border-color: rgba(91,141,239,.25); }
.note.steel svg { color: var(--steel); }

/* mini progress (job records) */
.recbar { display: flex; align-items: center; gap: 8px; }
.recbar .track { width: 70px; height: 6px; border-radius: 20px; background: var(--bg-2); overflow: hidden; border: 1px solid var(--line); }
.recbar .fill { height: 100%; background: var(--green); }
.recbar .fill.part { background: var(--gold); }
.recbar .fill.fail { background: var(--neg); }

/* responsive: stack admin head actions */
@media (max-width: 880px){
  .app.admin .main-inner { padding-bottom: 110px; }
  /* hide the operator chrome tag on mobile so the topbar never crowds */
  .app.admin .adm-tag { display: none; }
  .app.admin .topbar .pill-stat > div:last-child { display: none; }
  .app.admin .topbar .pill-stat { padding: 7px; }
  .admin-dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .toolbar { align-items: stretch; }
  .toolbar .search,
  .toolbar .select-wrap,
  .toolbar .btn {
    flex: 1 1 100%;
    max-width: none;
  }
  .toolbar .grow,
  .toolbar > div[style*="flex:1"],
  .toolbar > div[style*="flex: 1"] {
    display: none;
  }
  .select { width: 100%; }
  .table-foot { align-items: flex-start; flex-direction: column; gap: 8px; }
  .adm-block-h { align-items: flex-start; flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .app.admin .main-inner { padding-left: 16px; padding-right: 16px; }
  .modal-scrim { padding: 12px; align-items: end; }
  .modal { max-height: calc(100vh - 24px); border-radius: var(--r); }
  .modal-h,
  .modal-b,
  .modal-f { padding-left: 16px; padding-right: 16px; }
  .modal-f { flex-wrap: wrap; }
  .modal-f .btn { flex: 1 1 140px; }
  .seg-radio { flex-direction: column; }
  .toggle-field { align-items: flex-start; }
  .admin-score-input-grid { grid-template-columns: 1fr auto 1fr; gap: 10px; }
}

@media (max-width: 420px) {
  .admin-score-input-grid { grid-template-columns: 1fr; align-items: stretch; }
  .admin-score-input-grid > .disp { padding-bottom: 0 !important; text-align: center; }
  .import-card { padding: 14px; }
  .qa-grid { grid-template-columns: 1fr; }
}

/* team information editor */
.team-rf-manager {
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(91,141,239,.06);
}
.rf-empty {
  font-size: 12.5px; color: var(--txt-3);
  border: 1px dashed var(--line-2); border-radius: 10px;
  padding: 14px; text-align: center; margin-bottom: 12px; background: var(--bg-2);
}
.rf-list { display: flex; flex-direction: column; gap: 9px; }
.rf-editor {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px 4px;
  background: var(--bg-2);
}
.rf-editor .inp { background: var(--surface); }
.rf-edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 4px 0 12px; }
.rf-add { margin-top: 12px; }
.team-public-toggle { margin-bottom: 18px; }
