:root {
  --bg: #0b1220;
  --card: #121b2e;
  --border: #26334d;
  --text: #e7ecf5;
  --muted: #a9b3c4;
  --primary: #3b82f6;
  --primary-600: #2563eb;
  --danger: #ef4444;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Noto Sans, Ubuntu, Cantarell, Helvetica Neue, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}

.container { max-width: 1400px; margin: 0 auto; padding: 20px; }
header h1 { margin: 16px 0 12px; font-weight: 700; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

label { display: flex; flex-direction: column; gap: 6px; }
label span { color: var(--muted); font-size: 13px; }
input {
  background: #0f1729;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.4;
}
select {
  background: #0f1729;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(59,130,246,0.15); }
input::placeholder { color: var(--muted); opacity: 0.8; }
select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(59,130,246,0.15); }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.actions { margin-top: 12px; display: flex; gap: 8px; }
button {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-600));
  cursor: pointer;
  font-weight: 600;
}
button.secondary { background: #1f2a44; }
button.danger { background: var(--danger); }
button:disabled { opacity: 0.6; cursor: not-allowed; }
button:hover:not(:disabled) { filter: brightness(1.05); }
button:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(59,130,246,0.25); }

.table-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.table-header .controls { display: flex; align-items: center; gap: 8px; }
.table-header input { width: 320px; max-width: 50vw; }

.stats-bar { display: flex; justify-content: flex-end; margin: 6px 0 10px; }
.stats {
  display: inline-flex; align-items: center; gap: 14px;
  background: #0f1729; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; font-weight: 700;
}
.stats .live { color: #10b981; }
.stats .die { color: #ef4444; }
.stats .other { color: var(--muted); }

.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 10px 0; }
.pager #page-info { color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { border-bottom: 1px solid var(--border); padding: 10px 12px; text-align: left; vertical-align: top; }
td[data-col="note"], th[data-col="note"] {
  white-space: normal;
  word-break: break-word;
}
thead th { position: sticky; top: 0; background: var(--card); z-index: 1; }
thead th[data-sort]::after {
  content: attr(data-sort-dir);
  font-size: 0.75em;
  color: var(--muted);
  margin-left: 6px;
  text-transform: uppercase;
}
tbody tr:nth-child(odd) { background: rgba(255,255,255,0.02); }
tbody tr:hover { background: rgba(255,255,255,0.05); }
td .row-actions { display: flex; gap: 6px; }

.small { color: var(--muted); font-size: 12px; text-align: center; }

/* Row status coloring */
tbody tr.row-live { background: rgba(16, 185, 129, 0.08); }
tbody tr.row-live:hover { background: rgba(16, 185, 129, 0.15); }
tbody tr.row-die { background: rgba(239, 68, 68, 0.08); }
tbody tr.row-die:hover { background: rgba(239, 68, 68, 0.15); }

.cols-panel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 16px; padding: 8px 0; }
.cols-panel .check { display: flex; align-items: center; gap: 10px; background: #0f1729; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.cols-panel .check:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.cols-panel .check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
.cols-panel .check span { font-weight: 600; }

/* Modal */
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 9999; }
.modal.show { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); z-index: 0; }
.modal-dialog {
  position: relative; width: min(720px, 92vw);
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  z-index: 1;
}
.modal-header, .modal-footer { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; font-size: 18px; }
.modal-footer { border-top: 1px solid var(--border); border-bottom: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.modal-body { padding: 16px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; }
.close-btn { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.muted { color: var(--muted); margin: 0 0 8px; }

/* Column resizer */
thead th { position: sticky; }
thead th .col-resizer {
  position: absolute;
  right: 0;
  top: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
}
thead th .col-resizer:hover {
  background: linear-gradient(to left, rgba(59,130,246,0.35), rgba(59,130,246,0));
}
body.col-resizing {
  cursor: col-resize !important;
}

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  .table-header { flex-direction: column; align-items: stretch; }
  .table-header input { width: 100%; max-width: 100%; }
}


