.roster-page {
  background: #11130f;
}

.login-view {
  display: grid;
  min-height: calc(100vh - 65px);
  place-items: center;
  border-bottom: 1px solid var(--line);
  background: #121510;
}

.login-layout {
  display: grid;
  padding-block: 64px;
  grid-template-columns: minmax(0, 1fr) 390px;
  align-items: center;
  gap: 90px;
}

.login-context h1 {
  margin: 0;
  font-size: 38px;
}

.login-context > p:not(.eyebrow) {
  max-width: 560px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.security-note {
  display: flex;
  max-width: 540px;
  margin-top: 28px;
  padding-top: 18px;
  align-items: flex-start;
  gap: 10px;
  border-top: 1px solid var(--line);
  color: #c1c8bd;
  font-size: 13px;
}

.security-note svg {
  width: 18px;
  flex: 0 0 auto;
  color: var(--success);
}

.login-panel {
  display: grid;
  padding: 28px;
  gap: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-panel header h2 {
  margin: 0;
  font-size: 20px;
}

.login-panel header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 46px;
}

.password-field .icon-button {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 40px;
  height: 40px;
}

.login-submit {
  width: 100%;
  margin-top: 4px;
}

.register-link {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.register-link a {
  color: var(--teal);
}

.register-link a:hover {
  text-decoration: underline;
}

.form-error {
  margin: 0;
  padding: 9px 11px;
  border-left: 3px solid var(--danger);
  color: #ffd5d1;
  background: var(--danger-soft);
  font-size: 12px;
}

.roster-header {
  padding: 38px 0 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.roster-header-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.roster-header h1 {
  margin: 0;
  font-size: 30px;
}

.roster-header p:not(.eyebrow) {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.roster-stats {
  display: grid;
  margin-top: 28px;
  grid-template-columns: repeat(3, minmax(0, 210px));
  gap: 0;
}

.roster-stats > div {
  display: flex;
  padding: 17px 20px;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line);
  border-bottom: 0;
}

.roster-stats > div + div {
  border-left: 0;
}

.roster-stats .stat-icon {
  width: 34px;
  height: 34px;
}

.roster-stats span:last-child {
  display: grid;
  gap: 2px;
}

.roster-stats small {
  color: var(--muted);
  font-size: 11px;
}

.roster-stats strong {
  font-size: 17px;
}

.member-binding-band {
  border-bottom: 1px solid var(--line);
  background: #171a16;
}

.member-binding-row {
  display: flex;
  min-height: 76px;
  padding-block: 15px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.member-binding-heading {
  display: flex;
  min-width: 190px;
  align-items: center;
  gap: 11px;
}

.member-binding-heading > span:last-child {
  display: grid;
  gap: 1px;
}

.member-binding-heading small {
  color: var(--muted);
  font-size: 11px;
}

.member-binding-heading strong {
  font-size: 15px;
}

.member-binding-icon {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #4f5f50;
  border-radius: var(--radius);
  color: #b9d8c0;
  background: #202820;
}

.member-binding-icon svg {
  width: 19px;
  height: 19px;
}

.member-binding-form {
  display: grid;
  width: min(100%, 560px);
  grid-template-columns: minmax(230px, 1fr) auto auto;
  gap: 7px;
}

.member-binding-form select {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 9px 34px 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: #111410;
}

.member-binding-form select:focus {
  border-color: #a7894d;
  outline: 2px solid rgba(212, 170, 85, 0.16);
}

.member-binding-form select:disabled {
  color: #878d84;
  background: #1b1e1a;
}

.member-binding-form .button,
.member-binding-form .icon-button {
  height: 42px;
}

.member-binding-form .button svg {
  width: 16px;
  height: 16px;
}

.roster-content {
  padding-block: 30px 64px;
}

.roster-toolbar {
  display: flex;
  margin-bottom: 14px;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.filter-row {
  display: flex;
  gap: 8px;
}

.compact-field {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.compact-field select {
  min-height: 40px;
  padding: 7px 30px 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
}

.roster-table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}

.roster-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

.roster-table th {
  height: 42px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  background: #141713;
  font-size: 11px;
  font-weight: 650;
  text-align: left;
}

.roster-table th:nth-child(1) { width: 20%; }
.roster-table th:nth-child(2) { width: 11%; }
.roster-table th:nth-child(3) { width: 53%; }
.roster-table th:nth-child(4) { width: 9%; }
.roster-table th:nth-child(5) { width: 7%; }

.roster-table td {
  height: 72px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 13px;
}

.role-group-row {
  --role-accent: #747b70;
}

.role-group-row td {
  height: 36px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line-strong);
  background: #11140f;
}

.role-group-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-group-heading::before {
  width: 2px;
  height: 14px;
  flex: 0 0 auto;
  background: var(--role-accent);
  content: "";
}

.role-group-heading strong {
  color: var(--role-accent);
  font-size: 12px;
}

.role-group-heading span {
  color: var(--muted);
  font-size: 11px;
}

.role-group-tank { --role-accent: #6c9bd2; }
.role-group-healer { --role-accent: #71bd80; }
.role-group-melee { --role-accent: #d78272; }
.role-group-ranged { --role-accent: #c5a55e; }

.roster-table tbody tr:last-child td {
  border-bottom: 0;
}

.roster-table tbody tr:hover {
  background: #1d211c;
}

.member-cell {
  min-width: 0;
}

.member-cell strong,
.member-cell small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-cell small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.role-badge {
  display: inline-flex;
  min-height: 25px;
  padding: 3px 8px;
  align-items: center;
  border-left: 2px solid var(--teal);
  color: #d5ddd2;
  background: #1b2420;
  font-size: 11px;
}

.role-tank { border-color: #6c9bd2; }
.role-healer { border-color: #71bd80; }
.role-melee { border-color: #d78272; }
.role-ranged { border-color: #c5a55e; }

.character-pills {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px;
}

.character-pill {
  --character-accent: #747b70;
  display: inline-grid;
  min-width: 205px;
  max-width: 100%;
  min-height: 46px;
  padding: 6px;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #d2d7ce;
  background: linear-gradient(90deg, color-mix(in srgb, var(--character-accent) 15%, #121511) 0%, #121511 72%);
  font-size: 11px;
}

.character-spec-icon,
.character-spec-fallback {
  width: 28px;
  height: 28px;
  border: 1px solid var(--character-accent);
  border-radius: 3px;
  background: #0d0f0c;
}

.character-spec-icon {
  display: block;
  object-fit: cover;
}

.character-spec-fallback {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.character-pill-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.character-pill-heading {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 5px;
}

.character-pill-heading strong,
.character-pill-heading span,
.character-pill-build {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-pill-heading strong {
  color: var(--character-accent);
  font-size: 12px;
  font-weight: 650;
}

.character-pill-heading span {
  color: var(--muted);
  font-size: 10px;
}

.character-pill-build {
  display: block;
  color: #c8cec4;
  font-size: 10px;
}

.character-class-death-knight { --character-accent: #c41e3a; }
.character-class-demon-hunter { --character-accent: #a330c9; }
.character-class-druid { --character-accent: #ff7c0a; }
.character-class-evoker { --character-accent: #33937f; }
.character-class-hunter { --character-accent: #aad372; }
.character-class-mage { --character-accent: #3fc7eb; }
.character-class-monk { --character-accent: #00ff98; }
.character-class-paladin { --character-accent: #f48cba; }
.character-class-priest { --character-accent: #ffffff; }
.character-class-rogue { --character-accent: #fff468; }
.character-class-shaman { --character-accent: #0070dd; }
.character-class-warlock { --character-accent: #8788ee; }
.character-class-warrior { --character-accent: #c69b6d; }

.character-pill-main {
  border-color: #766238;
  box-shadow: inset 0 0 0 1px rgba(240, 204, 128, 0.08);
}

.character-pill-inactive {
  opacity: 0.58;
  color: #737a70;
}

.claimed-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.claimed-indicator svg {
  width: 14px;
  color: var(--success);
}

.table-action {
  display: flex;
  justify-content: flex-end;
}

.table-action .icon-button {
  width: 34px;
  height: 34px;
}

.roster-loading {
  display: grid;
  padding: 12px;
  gap: 8px;
}

.roster-loading .skeleton {
  min-height: 62px;
}

.member-dialog,
.confirm-dialog {
  max-width: none;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
}

.member-dialog {
  width: min(1040px, calc(100vw - 32px));
}

.member-dialog::backdrop,
.confirm-dialog::backdrop {
  background: rgba(4, 6, 4, 0.78);
  backdrop-filter: blur(4px);
}

.dialog-shell,
.confirm-shell {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dialog-header {
  display: flex;
  min-height: 74px;
  padding: 16px 20px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: #151814;
}

.dialog-header .eyebrow {
  margin-bottom: 4px;
  font-size: 10px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 20px;
}

.dialog-body {
  max-height: min(70vh, 720px);
  overflow-y: auto;
  padding: 22px 20px;
}

.dialog-footer {
  display: flex;
  padding: 13px 20px;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: #151814;
}

.dialog-spacer {
  flex: 1;
}

.character-editor {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.character-editor-heading {
  display: flex;
  margin-bottom: 12px;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.character-editor-heading h3 {
  margin: 0;
  font-size: 15px;
}

.character-editor-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.character-list {
  display: grid;
  gap: 7px;
}

.character-row {
  display: grid;
  padding: 10px;
  grid-template-columns: minmax(110px, 1fr) minmax(140px, 1.1fr) minmax(120px, 0.8fr) minmax(120px, 0.8fr) 110px 40px;
  align-items: end;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #141713;
}

.character-meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
}

.character-empty {
  padding: 22px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.confirm-dialog {
  width: min(430px, calc(100vw - 32px));
}

.confirm-shell {
  display: grid;
  padding: 24px;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 14px;
}

.confirm-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #75423d;
  border-radius: 50%;
  color: var(--danger);
  background: var(--danger-soft);
}

.confirm-icon svg {
  width: 19px;
}

.confirm-shell h2 {
  margin: 0;
  font-size: 18px;
}

.confirm-shell p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.confirm-actions {
  display: flex;
  margin-top: 8px;
  grid-column: 1 / -1;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 820px) {
  .login-layout {
    grid-template-columns: 1fr;
    gap: 38px;
  }

  .login-context {
    max-width: 620px;
  }

  .roster-header-row,
  .roster-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .roster-header-row,
  .roster-toolbar {
    display: flex;
  }

  .roster-header-actions {
    justify-content: flex-start;
  }

  .roster-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .member-binding-row {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .member-binding-form {
    width: 100%;
  }

  .filter-row {
    flex-wrap: wrap;
  }
}

@media (max-width: 620px) {
  .login-layout {
    padding-block: 38px;
  }

  .login-context h1 {
    font-size: 30px;
  }

  .login-panel {
    padding: 21px 17px;
  }

  .roster-header {
    padding-top: 28px;
  }

  .roster-header-actions .button-primary {
    flex: 1;
  }

  .roster-stats > div {
    padding: 12px 9px;
    align-items: flex-start;
    flex-direction: column;
  }

  .roster-stats .stat-icon {
    width: 30px;
    height: 30px;
  }

  .member-binding-row {
    padding-block: 14px;
  }

  .member-binding-form {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .member-binding-form .button {
    padding-inline: 11px;
  }

  .compact-field {
    flex: 1;
  }

  .compact-field select {
    min-width: 0;
    flex: 1;
  }

  .roster-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .roster-table {
    display: block;
    min-width: 0;
  }

  .roster-table thead {
    display: none;
  }

  .roster-table tbody {
    display: grid;
    gap: 8px;
  }

  .roster-table tbody tr {
    display: grid;
    padding: 13px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px 12px;
    border: 1px solid var(--line);
    background: var(--surface);
  }

  .roster-table td {
    display: block;
    height: auto;
    padding: 0;
    border: 0;
  }

  .roster-table td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .roster-table td:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }

  .roster-table td:nth-child(3) {
    padding-top: 10px;
    grid-column: 1 / -1;
    grid-row: 3;
    border-top: 1px solid var(--line);
  }

  .roster-table td:nth-child(4) {
    grid-column: 1;
    grid-row: 2;
  }

  .roster-table td:nth-child(5) {
    grid-column: 2;
    grid-row: 2;
  }

  .roster-table tbody tr.role-group-row {
    display: block;
    padding: 10px 2px 0;
    border: 0;
    background: transparent;
  }

  .roster-table tbody tr.role-group-row:first-child {
    padding-top: 0;
  }

  .roster-table .role-group-row td {
    display: block;
    height: auto;
    padding: 0 0 6px;
    border-bottom: 1px solid var(--line-strong);
    background: transparent;
  }

  .roster-table .character-pills {
    padding-right: 4px;
  }

  .character-pill {
    width: 100%;
    min-width: 0;
  }

  .dialog-body {
    padding-inline: 14px;
  }

  .dialog-header,
  .dialog-footer {
    padding-inline: 14px;
  }

  .dialog-footer {
    flex-wrap: wrap;
  }

  .dialog-footer .button-danger {
    order: 3;
  }

  .character-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px;
  }

  .character-row > .field:first-child,
  .character-row .realm-field,
  .character-row .class-field,
  .character-row .spec-field,
  .character-row .status-field {
    grid-column: 1 / 3;
  }
}
