/* Shared UI components for the dashboards, the player site and the landing page (dashboard-only styles: dashboard.css). */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --border: #e2e5ee;
  --text: #1b1f2a;
  --muted: #687087;
  --brand: #5b4cf0;
  --brand-ink: #ffffff;
  --ok: #138a52;
  --ok-bg: #e3f6ec;
  --warn: #9a6200;
  --warn-bg: #fff3d6;
  --bad: #c42b3c;
  --bad-bg: #fde7ea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1117; --surface: #171a23; --surface-2: #1e2230; --border: #2a2f40; --text: #e8eaf2; --muted: #8b93a9;
    --brand: #8577ff; --ok: #3ecf8e; --ok-bg: #12301f; --warn: #f0b44c; --warn-bg: #352812; --bad: #ff6b7b; --bad-bg: #3a1820;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1117; --surface: #171a23; --surface-2: #1e2230; --border: #2a2f40; --text: #e8eaf2; --muted: #8b93a9;
  --brand: #8577ff; --ok: #3ecf8e; --ok-bg: #12301f; --warn: #f0b44c; --warn-bg: #352812; --bad: #ff6b7b; --bad-bg: #3a1820;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); }
.tick, .cross { display: inline-flex; align-items: center; justify-content: center; width: 1.25em; height: 1.25em; border-radius: 50%; font-size: 0.8em; font-weight: 800; line-height: 1; flex: none; }
.tick { color: var(--ok); background: var(--ok-bg); }
.cross { color: var(--bad); background: var(--bad-bg); }

/* scrollbars: thin and themed everywhere */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 40%, transparent) transparent; }
*:hover { scrollbar-color: color-mix(in srgb, var(--muted) 65%, transparent) transparent; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.right { text-align: right; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card, .card + .grid-2, .grid-2 + .card, .grid-2 + .grid-2 { margin-top: 16px; }
.stats > .card, .grid-2 > .card, .games > * { margin-top: 0; }
td.date { white-space: nowrap; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--brand); }
.btn.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.btn.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.btn.sm { padding: 4px 10px; font-size: 0.85rem; }
.btn.block { width: 100%; }
.link { background: none; border: none; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }

/* forms */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 0.85rem; }
.field .hint { font-size: 0.8rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); width: 100%;
  border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 50%, transparent); border-color: var(--brand); }
input[type="checkbox"] { width: auto; }
input[type="color"] { padding: 2px; height: 38px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; margin-bottom: 14px; }
.form-grid { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.error-text { color: var(--bad); font-size: 0.85rem; min-height: 1.2em; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--ok); } .neg { color: var(--bad); }
.empty { text-align: center; color: var(--muted); padding: 30px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 0.75rem; font-weight: 700; text-transform: capitalize; background: var(--surface-2); color: var(--muted); }
.badge.pending { background: var(--warn-bg); color: var(--warn); }
.badge.approved, .badge.active, .badge.on { background: var(--ok-bg); color: var(--ok); }
.badge.rejected, .badge.suspended, .badge.off { background: var(--bad-bg); color: var(--bad); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a, .tabs button { padding: 9px 14px; border: none; background: none; color: var(--muted); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs .active { color: var(--brand); border-bottom-color: var(--brand); }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }

/* modal */
dialog.modal { border: none; border-radius: 16px; padding: 0; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
dialog.modal.wide { width: min(820px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10, 12, 20, 0.55); }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; flex: 1; }
.modal-body { padding: 20px; max-height: 70vh; overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; max-width: calc(100vw - 32px); }
.toast { padding: 12px 16px; border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-weight: 600; transition: opacity 0.4s, transform 0.4s; }
.toast.error { background: var(--bad); color: #fff; }
.toast.success { background: var(--ok); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.stat .value { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }

.copy { font-family: ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 2px 8px; border-radius: 6px; cursor: pointer; border: 1px dashed var(--border); }
.copy:hover { border-color: var(--brand); }

/* data tables */
.dt-bar { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 12px; }
.dt-bar .filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.dt-bar .filters input, .dt-bar .filters select { width: auto; min-width: 150px; padding: 7px 10px; }
.dt-bar .filters input[type="search"] { min-width: 210px; }
.date-f { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.date-f input { min-width: 0 !important; }
.dt-body { transition: opacity 0.15s; min-height: 60px; }
.dt-body.loading { opacity: 0.5; }
.dt-size { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.dt-size select { width: auto; padding: 4px 8px; }
.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 0.75rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.chip.on { background: color-mix(in srgb, var(--brand) 15%, transparent); border-color: color-mix(in srgb, var(--brand) 40%, transparent); color: var(--brand); }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; border: 1px solid var(--border); }
.perm-group { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.perm-group h4 { margin: 0 0 6px; font-size: 0.85rem; display: flex; align-items: center; gap: 8px; }
.perm-group .check { margin-bottom: 4px; font-size: 0.9rem; }

.lang-select { width: auto; padding: 4px 8px; font: inherit; font-size: 0.85rem; }
.lang-select.block { width: 100%; margin-bottom: 6px; }
.check input[type=radio], .check input[type=checkbox] { width: auto; flex: 0 0 auto; margin: 0; }


