:root {
  color-scheme: dark;
  --bg: #080808;
  --panel: #171717;
  --panel-soft: #101010;
  --ink: #f4f4f4;
  --muted: #a6a6a6;
  --line: #333333;
  --brand: #d71920;
  --accent: #ff4b55;
  --soft: #241012;
  --green: #56c271;
  --shadow: 0 16px 36px rgba(0, 0, 0, .35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
}

.button-link {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

button:hover,
.button-link:hover {
  border-color: var(--brand);
  background: #241012;
}

button:disabled {
  cursor: wait;
  opacity: .6;
}

.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 900;
}

.wide {
  width: 100%;
}

.topbar {
  min-height: 84px;
  padding: 18px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(0, 0, 0, .92);
  border-bottom: 1px solid var(--line);
}

.topbar h1,
.topbar p {
  margin: 0;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  flex: 0 0 auto;
}

.hidden-admin-button {
  width: 150px;
  height: 18px;
  min-height: 18px;
  margin-top: 4px;
  padding: 0;
  display: block;
  border: 0;
  background: transparent;
  opacity: 0;
}

.hidden-admin-button:hover {
  border: 0;
  background: transparent;
}

.eyebrow {
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: calc(100vh - 84px);
}

.setup-panel {
  border-right: 1px solid var(--line);
  background: rgba(13, 13, 13, .9);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setup-panel section,
.summary-strip,
.payments-list,
.details-band {
  background: rgba(23, 23, 23, .9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.setup-panel section,
.details-band {
  padding: 15px;
}

h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #050505;
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.42;
}

.status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.status.ok {
  color: var(--green);
}

.status.error {
  color: var(--accent);
}

.main-panel {
  padding: 20px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.admin-layout {
  padding: 20px;
  display: grid;
  gap: 18px;
}

.login-layout {
  min-height: 100vh;
  padding: 22px;
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(420px, 100%);
  background: rgba(23, 23, 23, .94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-logo {
  width: 128px;
  height: 128px;
  object-fit: contain;
  display: block;
  margin-bottom: 12px;
}

.login-panel h1 {
  margin: 0 0 18px;
  font-size: 26px;
  line-height: 1.15;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
}

.summary-strip div {
  padding: 15px;
  border-right: 1px solid var(--line);
}

.summary-strip div:last-child {
  border-right: 0;
}

.summary-strip strong {
  display: block;
  font-size: 25px;
}

.summary-strip span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.content-grid,
.team-payment-grid {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(320px, 1.2fr);
  gap: 12px;
  align-items: start;
}

.section-head,
.payment-row,
.report-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-head {
  margin-bottom: 10px;
}

.payment-row,
.report-row {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  padding: 10px;
}

.team-payment-panel {
  min-width: 0;
  background: rgba(23, 23, 23, .9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.team-payment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  background: var(--soft);
  border-bottom: 1px solid #6d1a20;
}

.team-payment-head h3,
.team-payment-head p {
  margin: 0;
}

.team-payment-head h3 {
  font-size: 18px;
}

.team-payment-head p {
  color: var(--muted);
  font-size: 13px;
}

.team-payment-head strong {
  font-size: 22px;
  white-space: nowrap;
}

.team-player-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.payment-name,
.report-title {
  font-weight: 900;
}

.payment-meta,
.report-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.payment-amount,
.score {
  font-weight: 900;
  color: #fff;
}

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

.print-sheet {
  display: none;
}

.detail {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #101010;
}

.detail span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.detail strong {
  overflow-wrap: anywhere;
}

.empty {
  color: var(--muted);
  padding: 10px;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.admin-table td:nth-child(2),
.admin-table td:nth-child(3) {
  white-space: nowrap;
}

.admin-table td:first-child {
  font-weight: 900;
}

.admin-request-list {
  display: grid;
  gap: 8px;
}

.admin-request {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  padding: 10px;
  display: grid;
  gap: 3px;
}

.admin-request strong {
  font-size: 15px;
}

.admin-request span,
.admin-request small {
  color: var(--muted);
}

.admin-password-form {
  max-width: 460px;
}

.admin-password-form button {
  margin-top: 4px;
}

.admin-login-dialog {
  width: min(380px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 18px;
}

.admin-login-dialog::backdrop {
  background: rgba(0, 0, 0, .72);
}

.admin-login-dialog h2 {
  margin-bottom: 14px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 900px) {
  .layout,
  .content-grid,
  .team-payment-grid,
  .details-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .setup-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-logo {
    width: 82px;
    height: 82px;
  }

  .summary-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: #fff;
    color: #111;
  }

  .topbar {
    min-height: auto;
    padding: 0 0 14px;
    background: #fff;
    color: #111;
    border-bottom: 2px solid #111;
  }

  .top-actions,
  .setup-panel,
  .status,
  .summary-strip,
  .details-band,
  .content-grid,
  .team-payment-grid {
    display: none !important;
  }

  .topbar {
    display: none;
  }

  .layout {
    display: block;
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .main-panel {
    display: block;
    padding: 0;
  }

  .print-sheet {
    display: block;
    position: relative;
    background: transparent;
    color: #111;
    font-size: 12px;
  }

  .print-sheet::before {
    content: "";
    position: fixed;
    inset: 31mm 18mm auto;
    height: 150mm;
    background: url("assets/darts-kassel-logo.png") center / contain no-repeat;
    opacity: .08;
    pointer-events: none;
    z-index: 0;
  }

  .print-title,
  .print-teams,
  .print-players {
    position: relative;
    z-index: 1;
  }

  .print-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid #111;
    padding-bottom: 4px;
    margin-bottom: 10px;
  }

  .print-title h2,
  .print-title p {
    margin: 0;
  }

  .print-title h2 {
    font-size: 18px;
  }

  .print-brand {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .print-brand img {
    width: 26mm;
    max-height: 16mm;
    object-fit: contain;
  }

  .print-title p {
    font-size: 12px;
    text-align: right;
  }

  .print-teams {
    margin-bottom: 12px;
  }

  .print-sheet h3 {
    margin: 0 0 6px;
    font-size: 13px;
  }

  .print-team-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .print-team-total {
    border: 1px solid #999;
    padding: 7px 9px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .print-team-total span {
    font-weight: 700;
  }

  .print-team-total strong {
    font-size: 15px;
    white-space: nowrap;
  }

  .print-sheet table {
    width: 100%;
    border-collapse: collapse;
  }

  .print-sheet td {
    border-bottom: 1px solid #d0d0d0;
    padding: 4px 0;
    line-height: 1.2;
    vertical-align: top;
  }

  .print-sheet td:last-child {
    width: 82px;
    text-align: right;
    font-weight: 700;
    white-space: nowrap;
  }

  .print-player-team td {
    padding-top: 8px;
    border-bottom: 1px solid #111;
    font-weight: 800;
  }

  .print-sheet tr:last-child td {
    border-bottom: 0;
  }

  .print-sheet,
  .print-sheet * {
    box-shadow: none !important;
  }

  button {
    display: none;
  }

  @page {
    size: A4 portrait;
    margin: 8mm;
  }
}
