:root {
  color-scheme: light;
  --bg: #f5f7f3;
  --panel: #ffffff;
  --soft: #edf2ea;
  --line: #d9dfd4;
  --text: #1d241b;
  --muted: #687264;
  --accent: #2f6f4e;
  --accent-strong: #234f3b;
  --danger: #a6372d;
  --warn: #8a5b14;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sidebar {
  background: #183527;
  color: #fff;
  padding: 24px 18px;
}

.brand {
  display: grid;
  gap: 6px;
  margin-bottom: 28px;
}

.brand-logo {
  display: block;
  width: min(170px, 100%);
  max-height: 96px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 6px;
}

.brand strong {
  font-size: 20px;
}

.brand span {
  color: #c9d8cf;
  font-size: 14px;
}

nav {
  display: grid;
  gap: 8px;
}

button,
input,
select,
textarea {
  font: inherit;
}

.nav,
.primary,
.secondary,
.danger {
  border: 0;
  border-radius: 6px;
  min-height: 38px;
  padding: 8px 12px;
  cursor: pointer;
}

.nav {
  width: 100%;
  text-align: left;
  color: #eef6f1;
  background: transparent;
}

.nav.active,
.nav:hover {
  background: #2f6f4e;
}

main {
  min-width: 0;
  padding: 24px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-menu {
  position: relative;
}

.account-trigger {
  width: 46px;
  height: 46px;
  min-height: 46px;
  border-radius: 999px;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.account-trigger img,
.profile-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.account-trigger span {
  font-weight: 800;
}

.account-dropdown {
  position: absolute;
  right: 0;
  top: 52px;
  min-width: 170px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgb(20 32 24 / 14%);
  padding: 6px;
  z-index: 10;
}

.account-dropdown button {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
}

.auth-panel {
  max-width: 460px;
}

.forgot-form {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.error {
  color: var(--danger);
  font-weight: 650;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 20px;
  margin-bottom: 14px;
}

h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

#message {
  min-height: 24px;
  color: var(--warn);
}

.grid {
  display: grid;
  gap: 18px;
}

.cols {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.users-grid {
  grid-template-columns: minmax(0, 1fr);
}

.user-editor-panel {
  max-width: 820px;
}

.stats {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  padding: 18px;
}

.card {
  padding: 14px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
}

form {
  display: grid;
  gap: 12px;
}

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

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 38px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
}

.check input {
  width: 18px;
  min-height: 18px;
}

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

td.actions {
  display: table-cell;
  white-space: nowrap;
}

td.actions button + button {
  margin-left: 8px;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.secondary {
  background: #e7ece4;
  color: var(--text);
}

.danger {
  background: #f5dddd;
  color: var(--danger);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

th {
  color: var(--muted);
  font-weight: 650;
}

.total-row td {
  background: var(--soft);
  font-weight: 700;
}

.club-logo-preview {
  display: block;
  max-width: 320px;
  max-height: 180px;
  object-fit: contain;
  margin-bottom: 18px;
}

.profile-preview {
  width: 140px;
  height: 140px;
  border-radius: 999px;
  background: var(--soft);
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: 18px;
  font-size: 48px;
  font-weight: 800;
  color: var(--accent-strong);
}

#permission-editor input[type="checkbox"] {
  width: 13px;
  min-height: 13px;
  padding: 0;
}

.permissions-table {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
  font-size: 13px;
}

.permissions-table th,
.permissions-table td {
  padding: 8px 10px;
  vertical-align: middle;
}

.permissions-table th:not(:first-child),
.permissions-table td:not(:first-child) {
  width: 76px;
  text-align: center;
}

.permissions-table th:first-child,
.permissions-table td:first-child {
  width: auto;
}

.permissions-table input[type="checkbox"] {
  margin: 0 auto;
}

.sort-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  min-height: 28px;
  padding: 0;
  text-align: left;
}

.sort-button:hover {
  color: var(--accent-strong);
}

.right {
  text-align: right;
}

.muted {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  background: #edf2ea;
  color: #31513f;
  font-size: 12px;
}

.select-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.select-list label {
  color: var(--text);
}

.rate-select-grid {
  display: grid;
  gap: 12px;
}

.search-field {
  margin-bottom: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-grid div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfa;
}

.summary-grid strong {
  font-size: 14px;
}

.invoice-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.invoice-duplex {
  align-self: end;
  min-height: 38px;
  padding-bottom: 6px;
}

.legend {
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.legend h3 {
  color: var(--text);
  margin-bottom: 6px;
}

.legend p {
  margin: 4px 0;
}

.rate-groups {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.rate-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.group-header {
  width: 100%;
  border: 0;
  min-height: 48px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f1f5ee;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.group-header span:first-child {
  display: grid;
  gap: 2px;
}

.group-header span span {
  color: var(--muted);
  font-size: 13px;
}

.group-body {
  padding: 10px 12px 12px;
}

.group-print-text {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  padding: 10px;
  margin-bottom: 10px;
}

.group-print-text p {
  margin: 4px 0 0;
  white-space: normal;
}

.group-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

.total {
  font-weight: 700;
  font-size: 18px;
}

@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 16px;
  }

  nav {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  main {
    padding: 16px;
  }

  header,
  .cols,
  .form-row,
  .stats {
    grid-template-columns: 1fr;
  }

  header {
    display: grid;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
