:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #111827;
  --muted: #667085;
  --line: #dde4ee;
  --line-strong: #c7d2df;
  --primary: #087f8c;
  --primary-strong: #075e68;
  --primary-soft: #dff7f8;
  --accent: #7c3aed;
  --danger: #c2413f;
  --running: #16814a;
  --stopped: #64748b;
  --warning: #b7791f;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.06);
}

html {
  font-size: 16px;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background:
    linear-gradient(180deg, #eef4ff 0, var(--bg) 310px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.navbar,
footer {
  display: none;
}

.container {
  max-width: none;
  padding: 0;
}

.dashboard-shell {
  padding: 30px;
}

.dashboard-header {
  align-items: end;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 18px 20px;
}

.eyebrow {
  color: var(--primary-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: 2.15rem;
  line-height: 1.1;
}

h2 {
  font-size: 1.02rem;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-strip span {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #344054;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 12px;
}

.status-strip a,
.button-link {
  align-items: center;
  background: #101828;
  border: 1px solid #101828;
  border-radius: 999px;
  color: #ffffff;
  display: inline-flex;
  font-size: 0.85rem;
  font-weight: 800;
  min-height: 38px;
  padding: 8px 12px;
  text-decoration: none;
}

.logout-inline {
  margin: 0;
}

.logout-inline button {
  border-radius: 999px;
  min-height: 38px;
}

.login-shell {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  max-width: 420px;
  padding: 24px;
  width: min(100%, 420px);
}

.login-card h1 {
  font-size: 2rem;
}

.status-strip a:hover,
.button-link:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

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

.nodes-grid {
  grid-template-columns: minmax(0, 2fr) minmax(320px, 0.8fr);
}

.match-grid {
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 2fr);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  min-width: 0;
  padding: 20px;
}

.panel-wide {
  grid-column: span 2;
}

.panel-full {
  grid-column: 1 / -1;
}

.panel-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.88rem;
}

.match-server-panel {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(260px, 360px) minmax(0, 1fr);
  padding: 14px 18px;
}

.match-server-panel .panel-heading {
  border-bottom: 0;
  margin: 0;
  padding-bottom: 0;
}

.match-server-panel .stacked-form {
  margin: 0;
}

.match-server-panel label {
  grid-template-columns: auto minmax(220px, 1fr);
  align-items: center;
  margin: 0;
}

html[data-live-refresh="error"] .dashboard-header {
  border-bottom-color: #ead6b5;
}

.stacked-form {
  display: grid;
  gap: 12px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 6px;
}

input,
select,
textarea {
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  min-width: 0;
  padding: 10px 11px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 127, 140, 0.14);
  outline: 0;
}

textarea {
  resize: vertical;
}

.plugin-picker {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.plugin-picker > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.plugin-group {
  display: grid;
  gap: 7px;
}

.plugin-group strong {
  font-size: 0.82rem;
}

.check-row {
  align-items: start;
  color: var(--ink);
  display: grid;
  font-weight: 700;
  gap: 8px;
  grid-template-columns: 18px 1fr;
}

.check-row input {
  margin-top: 3px;
  min-width: auto;
  padding: 0;
}

.check-row small {
  color: var(--muted);
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
}

.form-split {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

button {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 38px;
  padding: 8px 12px;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 140ms ease;
}

button:hover {
  background: var(--panel-soft);
  border-color: var(--line-strong);
  box-shadow: 0 5px 12px rgba(15, 23, 42, 0.06);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(8, 127, 140, 0.18);
}

button.primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: #ffffff;
}

.modal-footer button {
  min-width: 96px;
}

button.danger {
  color: var(--danger);
}

button.danger:hover {
  background: #fff1f1;
  border-color: #f3b7b6;
  color: #9f302f;
}

button.text-action {
  background: transparent;
  border: 0;
  color: var(--primary);
  justify-content: flex-start;
  min-height: 0;
  padding: 0;
  text-align: left;
}

button.text-action:hover {
  background: transparent;
  color: var(--primary-strong);
  text-decoration: underline;
}

.server-table,
.command-table,
.node-list {
  display: grid;
  gap: 10px;
}

.server-table {
  overflow-x: auto;
}

.table-row {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(230px, 1.2fr) minmax(230px, max-content) minmax(180px, 0.9fr) minmax(140px, 0.8fr) 80px 88px 72px;
  min-height: 48px;
  min-width: 1120px;
  padding: 9px 12px;
}

.table-head {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  min-height: 32px;
  text-transform: uppercase;
}

.strong {
  font-weight: 800;
}

.status-cell {
  display: grid;
  gap: 5px;
}

.progress-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.mini-progress {
  background: #e9eef5;
  border-radius: 999px;
  display: block;
  height: 7px;
  overflow: hidden;
  width: min(130px, 100%);
}

.mini-progress span {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  display: block;
  height: 100%;
}

.actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-start;
  min-width: max-content;
}

.connect-cell,
.icon-action {
  align-items: center;
  background: #f7fbff;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--primary-strong);
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  height: 38px;
  padding: 0;
  width: 38px;
}

.connect-cell:hover,
.connect-cell:focus,
.icon-action:hover,
.icon-action:focus {
  background: #e9f6f5;
  color: var(--primary);
  outline: 2px solid rgba(20, 184, 166, 0.35);
  outline-offset: 1px;
}

.connect-cell[data-copy-state="copied"] {
  background: #e7f8ef;
  border-color: #abe4c3;
  color: var(--running);
  text-align: center;
}

.connect-cell svg,
.icon-action svg {
  fill: none;
  height: 17px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 17px;
}

.icon-action svg path,
.icon-action svg rect {
  fill: none;
}

.icon-action:first-child svg path[d="M8 5v14l11-7z"] {
  fill: currentColor;
  stroke: none;
}

.actions form {
  margin: 0;
}

.command-bar {
  align-items: center;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(150px, 0.35fr) minmax(0, 1fr);
  margin-top: 14px;
  padding: 14px;
}

.command-bar > div {
  display: grid;
  gap: 2px;
}

.command-bar strong {
  font-size: 0.88rem;
}

.command-bar span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.command-bar form {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(180px, 1.1fr) minmax(180px, 1fr) minmax(130px, 0.8fr) minmax(150px, 1fr) auto;
  margin: 0;
}

.command-table {
  overflow-x: auto;
}

.command-row {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 86px minmax(150px, 1fr) minmax(110px, 0.7fr) 80px minmax(240px, 2fr) auto;
  min-height: 46px;
  padding: 8px 12px;
}

.command-head {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  min-height: 32px;
  text-transform: uppercase;
}

.output-preview {
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 14px;
}

.detail-list div {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.command-output {
  background: #101828;
  border-radius: 6px;
  color: #d1faff;
  font-size: 0.82rem;
  margin: 0;
  max-height: 60vh;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

.match-summary {
  align-items: center;
  border-left: 1px solid var(--line);
  display: grid;
  gap: 6px 12px;
  grid-template-columns: auto minmax(0, 1fr);
  margin: 0;
  min-width: 0;
  padding-left: 14px;
}

.match-summary p {
  color: var(--muted);
  display: -webkit-box;
  font-size: 0.88rem;
  grid-column: 2;
  line-height: 1.35;
  margin: 0;
  max-height: 1.35em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.match-summary strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.scoreboard div {
  background: #101828;
  border: 1px solid #1d2939;
  border-radius: 6px;
  color: #ffffff;
  display: grid;
  gap: 4px;
  min-height: 90px;
  place-items: center;
}

.scoreboard span {
  color: #9fb3c8;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.scoreboard strong {
  color: #ffffff;
  font-size: 2.15rem;
}

.match-facts {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 12px 0 8px;
}

.match-facts div {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
}

.match-facts span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.match-facts strong {
  color: #1d2939;
  font-size: 0.98rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-table {
  margin-top: 12px;
  overflow-x: auto;
}

.player-row {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1.4fr) 100px 100px 80px 90px 80px 80px auto;
  min-height: 44px;
  padding: 7px 10px;
}

.player-head {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  min-height: 32px;
  text-transform: uppercase;
}

.inline-form {
  margin: 0;
}

.round-stat-table {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.weapon-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.2;
  margin: 8px 0 14px;
  max-height: 58px;
  overflow: hidden;
}

.weapon-chip {
  background: var(--primary-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--primary-strong);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 8px;
  white-space: nowrap;
}

.modal-section-title {
  font-size: 0.9rem;
  margin: 12px 0 6px;
}

.round-stat-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: 90px repeat(6, minmax(70px, 1fr));
  min-height: 38px;
}

.round-stat-head {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.history-table {
  display: grid;
  gap: 6px;
  overflow-x: auto;
}

.history-row {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  display: grid;
  gap: 12px;
  grid-template-columns: 110px 130px 80px 130px minmax(240px, 1fr) 90px;
  min-height: 42px;
  min-width: 820px;
  padding: 8px 12px;
  text-decoration: none;
}

.history-head {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  min-height: 32px;
  text-transform: uppercase;
}

.history-link:hover {
  background: #f8fbff;
  color: inherit;
}

.simulate-form {
  display: flex;
  gap: 8px;
}

.simulate-form input {
  width: 82px;
}

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

.match-detail-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.match-detail-summary div {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
  display: grid;
  gap: 4px;
  padding: 12px;
}

.match-detail-summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.history-player-table {
  display: grid;
  gap: 6px;
  overflow-x: auto;
}

.history-player-row {
  min-width: 860px;
}

.history-player-head,
.history-player-detail summary {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1fr) 70px 90px 70px 120px minmax(300px, 1.4fr);
}

.history-player-head {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  min-height: 32px;
  text-transform: uppercase;
}

.history-player-detail {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.history-player-detail summary {
  cursor: pointer;
  list-style: none;
  min-height: 44px;
  padding: 6px 0;
}

.history-player-detail summary::-webkit-details-marker {
  display: none;
}

.history-player-detail summary:hover {
  background: #f8fbff;
}

.history-player-extra {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.2fr);
  padding: 10px 0 14px;
}

.history-player-extra h3 {
  font-size: 0.92rem;
  margin: 0 0 8px;
}

.match-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.match-actions form {
  margin: 0;
}

.rollback-form {
  display: flex;
  gap: 8px;
}

.rollback-form input {
  width: 110px;
}

.rollback-points {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
}

.rollback-points strong {
  font-size: 0.86rem;
}

.rollback-points > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rollback-points form {
  margin: 0;
}

.rollback-points span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.notice {
  background: #fff8e6;
  border: 1px solid #f4d28c;
  border-radius: 6px;
  color: #674b1a;
  margin-bottom: 12px;
  padding: 10px 12px;
}

.state {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  justify-content: center;
  min-width: 78px;
  padding: 6px 10px;
}

.state-running {
  background: #e7f8ef;
  color: var(--running);
}

.state-stopped {
  background: #eef2f7;
  color: var(--stopped);
}

.state-provisioning,
.state-starting,
.state-stopping,
.state-updating {
  background: #fff4d6;
  color: var(--warning);
}

.state-error {
  background: #ffe8e7;
  color: var(--danger);
}

.empty-state {
  background: #f8fbff;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 20px;
}

.empty-state.compact {
  padding: 10px 12px;
}

.node-item {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px;
}

.node-item div {
  min-width: 0;
}

.node-item span {
  color: var(--muted);
  display: block;
  overflow-wrap: anywhere;
}

.user-table {
  display: grid;
  gap: 10px;
  overflow-x: auto;
}

.user-row {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1fr) 90px 110px 130px minmax(520px, max-content);
  min-height: 50px;
  min-width: 1040px;
  padding: 10px 12px;
}

.user-head {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  min-height: 32px;
  text-transform: uppercase;
}

.user-row small {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
}

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

.user-actions form {
  align-items: center;
  display: flex;
  gap: 6px;
  margin: 0;
}

.user-actions input {
  width: 150px;
}

.app-modal {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.app-modal .modal-header,
.app-modal .modal-footer {
  border-color: var(--line);
}

.app-modal .modal-header {
  align-items: center;
  padding: 16px 18px;
}

.app-modal .modal-body {
  padding: 18px;
}

.app-modal .modal-footer {
  padding: 14px 18px;
}

@media (max-width: 1100px) {
  .dashboard-grid,
  .nodes-grid,
  .match-grid {
    grid-template-columns: 1fr 1fr;
  }

  .match-server-panel {
    grid-template-columns: 1fr;
  }

  .match-server-panel .panel-heading {
    margin-bottom: 2px;
  }

  .match-summary {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 10px;
  }

  .match-summary p {
    grid-column: 1 / -1;
    max-height: 2.7em;
    -webkit-line-clamp: 2;
  }

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

@media (max-width: 780px) {
  .dashboard-shell {
    padding: 16px;
  }

  .dashboard-header,
  .panel-heading {
    align-items: start;
    flex-direction: column;
  }

  .dashboard-grid,
  .nodes-grid,
  .match-grid,
  .form-split {
    grid-template-columns: 1fr;
  }

  .panel-wide,
  .panel-full {
    grid-column: auto;
  }

  .match-detail-summary,
  .history-player-extra {
    grid-template-columns: 1fr;
  }

  .match-facts {
    grid-template-columns: 1fr 1fr;
  }

  .match-server-panel label {
    grid-template-columns: 1fr;
  }

  .table-row {
    align-items: start;
    grid-template-columns: 1fr;
    padding: 12px 0;
  }

  .table-head {
    display: none;
  }

  .actions {
    flex-wrap: wrap;
    justify-content: start;
  }

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

  .command-row {
    align-items: start;
    grid-template-columns: 1fr;
    padding: 12px 0;
  }

  .command-head {
    display: none;
  }

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