:root {
  --bg: #f5f7f6;
  --panel: #ffffff;
  --border: #e5ebe7;
  --text: #17211c;
  --muted: #69756e;
  --green: #0b9638;
  --green-dark: #06752a;
  --green-soft: #eaf8ee;
  --blue-soft: #edf6ff;
  --orange-soft: #fff3e6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: #f5f7f6;
}

.login-panel {
  width: 380px;
  display: grid;
  gap: 16px;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(18, 36, 26, 0.1);
}

.login-panel .brand-mark {
  color: #fff;
}

.login-panel h1 {
  margin: 4px 0 0;
  font-size: 24px;
}

.login-panel p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 14px;
}

#app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  padding: 28px 22px;
  background: #102118;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 34px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
}

.brand p,
.eyebrow,
.muted {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.sidebar .brand p {
  color: rgba(255, 255, 255, 0.62);
}

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

.nav-item {
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
  text-align: left;
  padding: 0 14px;
}

.nav-item.active {
  background: rgba(11, 150, 56, 0.18);
  color: #fff;
  font-weight: 700;
}

.main {
  padding: 28px;
}

.topbar,
.panel-head,
.inline-actions,
.form-actions,
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  margin-bottom: 24px;
}

.topbar h2 {
  margin: 4px 0 0;
  font-size: 26px;
}

.view {
  display: grid;
  gap: 20px;
}

.hidden {
  display: none !important;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(18, 36, 26, 0.05);
  padding: 20px;
}

.panel h3 {
  margin: 0;
  font-size: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: #55615a;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fbfdfc;
  color: var(--text);
  padding: 0 12px;
}

input,
select {
  height: 40px;
}

textarea {
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  outline: 0;
}

.form-actions {
  grid-column: span 4;
  justify-content: flex-end;
}

.rule-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.primary-button,
.ghost-button {
  height: 38px;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 700;
}

.primary-button {
  border: 0;
  background: var(--green);
  color: #fff;
}

.primary-button:hover {
  background: var(--green-dark);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.primary-button:disabled:hover {
  background: var(--green);
}

.ghost-button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

.table {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.table-row {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 1fr 0.8fr 0.8fr 110px;
  align-items: center;
  min-height: 58px;
  border-top: 1px solid var(--border);
}

.table-row:first-child {
  border-top: 0;
}

.table-row.head {
  min-height: 42px;
  background: #f2f5f3;
  color: #607068;
  font-size: 13px;
  font-weight: 800;
}

.table-cell {
  padding: 10px 14px;
}

.status-pill,
.level-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.summary-grid,
.level-grid,
.group-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.summary-grid {
  grid-template-columns: repeat(4, 1fr);
}

.summary-card,
.level-card,
.group-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  color: var(--green);
}

.level-grid {
  grid-template-columns: repeat(3, 1fr);
}

.level-card h4,
.group-card h4 {
  margin: 0;
}

.level-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.subgroup-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-height: 92px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #eef2ef;
  border-radius: 8px;
  background: #fbfdfc;
}

.subgroup-card {
  min-height: 78px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 10px;
  border: 1px solid #dce9e0;
  border-radius: 8px;
  background: var(--green-soft);
}

.subgroup-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.subgroup-card-head span {
  color: #6e7b73;
  font-weight: 700;
}

.subgroup-empty {
  min-height: 30px;
  display: grid;
  place-items: center;
  border: 1px dashed #b9d9c2;
  border-radius: 6px;
  color: #7f8b84;
  font-size: 12px;
}

.subgroup-members {
  display: grid;
  gap: 6px;
}

.subgroup-member {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.subgroup-member .avatar {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

.subgroup-empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 68px;
  border: 1px dashed #d0dad4;
  border-radius: 8px;
  color: #89958e;
  font-size: 13px;
}

.manual-group-trigger {
  width: 92px;
  height: 34px;
  padding: 0;
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(10, 20, 14, 0.42);
}

.modal {
  width: 420px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  padding: 20px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-head h3 {
  margin: 0;
}

.icon-button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: #f2f5f3;
  color: #5b6861;
  font-size: 22px;
  line-height: 1;
}

.modal-form {
  display: grid;
  gap: 14px;
}

.modal-form input:disabled {
  background: #f2f5f3;
  color: #6e7b73;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.signup-item,
.member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid #eef2ef;
}

.signup-item:first-of-type,
.member-item:first-of-type {
  border-top: 0;
}

.player-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef4f0;
}

.name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.group-grid {
  grid-template-columns: repeat(3, 1fr);
}

.toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #102118;
  color: #fff;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
}
