:root {
  --bg: #0d1421;
  --panel: #172235;
  --panel-2: #1f2d44;
  --line: #31415c;
  --text: #ecf3ff;
  --muted: #9daec7;
  --green: #42d87a;
  --blue: #6bb4ff;
  --red: #ff6972;
  --yellow: #f4c95d;
  --orange: #ff9f43;
  --purple: #b58cff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top left, #183d2e 0, transparent 28rem), var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a {
  color: var(--blue);
  text-decoration: none;
}

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  align-self: start;
  border-right: 1px solid var(--line);
  background: rgba(12, 19, 31, 0.9);
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: 28px 20px;
  position: sticky;
  top: 0;
}

.brand {
  color: var(--green);
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
}

.nav {
  display: grid;
  flex: 1;
  gap: 10px;
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.nav a,
.button,
button {
  -webkit-tap-highlight-color: transparent;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  min-height: 42px;
  padding: 10px 16px;
  text-decoration: none;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.button:hover,
button:hover {
  background: rgba(35, 50, 74, 0.96);
  border-color: rgba(107, 180, 255, 0.58);
  box-shadow: 0 12px 28px rgba(31, 111, 235, 0.18);
  color: #f8fbff;
  transform: translateY(-1px);
}

.button:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(47, 126, 255, 0.48);
  outline-offset: 2px;
}

.button:active,
button:active {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
  transform: translateY(0);
}

.button:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.button:disabled:hover,
button:disabled:hover {
  background: var(--panel-2);
  border-color: var(--line);
  box-shadow: none;
  color: var(--text);
}

.page-back-button {
  align-items: center;
  background: rgba(31, 45, 68, 0.86);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  display: inline-flex;
  height: 44px;
  justify-content: center;
  margin-bottom: 16px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
  width: 44px;
}

.page-back-button:hover,
.page-back-button:focus-visible {
  background: rgba(107, 180, 255, 0.14);
  border-color: rgba(107, 180, 255, 0.45);
  color: #d9ecff;
  outline: 0;
  transform: translateX(-2px);
}

.page-back-icon {
  height: 22px;
  width: 22px;
}

.nav a {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  justify-content: flex-start;
  position: relative;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav a:hover {
  background: rgba(107, 180, 255, 0.09);
  border-color: rgba(107, 180, 255, 0.24);
  color: var(--text);
  transform: translateX(2px);
}

.nav a.nav__item--active {
  background: rgba(66, 216, 122, 0.14);
  border-color: rgba(66, 216, 122, 0.48);
  color: #d9ffe6;
  box-shadow: 0 12px 28px rgba(66, 216, 122, 0.1);
}

.nav a.nav__item--active::before {
  background: var(--green);
  border-radius: 999px;
  bottom: 10px;
  content: "";
  left: -9px;
  position: absolute;
  top: 10px;
  width: 4px;
}

.sidebar__footer {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(157, 174, 199, 0.18);
  border-radius: 18px;
  display: flex;
  flex-shrink: 0;
  gap: 12px;
  margin-top: auto;
  padding: 12px;
}

.sidebar__logo {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  flex: 0 0 auto;
  height: 44px;
  object-fit: contain;
  padding: 5px;
  width: 44px;
}

.sidebar__footer-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.sidebar__footer-subtitle {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-top: 2px;
}

.button.primary,
button.primary {
  background: linear-gradient(135deg, #2ec76b, #21a85a);
  border-color: #3ce17a;
  color: #06120a;
}

.button.primary:hover,
button.primary:hover {
  background: linear-gradient(135deg, #49e184, #2fc76b);
  border-color: #73f59c;
  box-shadow: 0 16px 34px rgba(46, 199, 107, 0.28);
  color: #05130a;
}

.button.danger,
button.danger {
  background: rgba(255, 105, 114, 0.12);
  border-color: rgba(255, 105, 114, 0.45);
  color: #ffb5ba;
}

.button.danger:hover,
button.danger:hover {
  background: rgba(255, 105, 114, 0.2);
  border-color: rgba(255, 129, 137, 0.72);
  box-shadow: 0 14px 32px rgba(255, 105, 114, 0.18);
  color: #ffd3d6;
}

.content {
  padding: 32px;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
}

.unit-topbar,
.level-topbar {
  align-items: stretch;
}

.unit-title-form,
.level-title-form {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(280px, 1fr) auto;
  width: 100%;
}

.unit-title-main,
.level-title-main {
  min-width: 0;
}

.unit-title-heading,
.level-title-heading {
  margin: 4px 0;
  max-width: 720px;
}

.unit-title-field,
.level-title-field {
  display: block;
}

.unit-title-input,
.level-title-input {
  background: rgba(17, 26, 42, 0.72);
  border-color: rgba(107, 180, 255, 0.24);
  border-radius: 16px;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.2;
  padding: 8px 12px;
}

.unit-title-input:focus,
.level-title-input:focus {
  border-color: rgba(66, 216, 122, 0.68);
  box-shadow: 0 0 0 3px rgba(66, 216, 122, 0.12);
  outline: 0;
}

.unit-title-actions,
.level-title-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

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

h2 {
  font-size: 20px;
  margin: 0 0 16px;
}

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

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

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

.card {
  background: rgba(23, 34, 53, 0.88);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.level-create-action {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
}

.stat {
  font-size: 34px;
  font-weight: 800;
  margin-top: 8px;
}

.dashboard-user-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.dashboard-user-metric {
  background: rgba(9, 18, 32, 0.34);
  border: 1px solid rgba(157, 174, 199, 0.14);
  border-radius: 16px;
  padding: 16px;
}

.message {
  align-items: flex-start;
  background: rgba(66, 216, 122, 0.12);
  border: 1px solid rgba(66, 216, 122, 0.45);
  border-radius: 14px;
  color: #aef3c6;
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
  padding: 14px 16px;
}

.message strong {
  color: #eafff1;
  font-size: 15px;
  font-weight: 800;
}

.message--success {
  box-shadow: 0 14px 32px rgba(66, 216, 122, 0.12);
}

.dashboard-version-status {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 18px;
}

.dashboard-version-status__card {
  background: rgba(9, 18, 32, 0.34);
  border: 1px solid rgba(157, 174, 199, 0.14);
  border-radius: 18px;
  min-width: 0;
  padding: 16px;
}

.dashboard-version-status__card--highlight {
  background: rgba(66, 216, 122, 0.1);
  border-color: rgba(66, 216, 122, 0.34);
  box-shadow: 0 16px 40px rgba(66, 216, 122, 0.1);
}

.dashboard-version-status__label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dashboard-version-status__value {
  font-size: 26px;
  font-weight: 800;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.dashboard-version-status__meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 8px;
}

.dashboard-version-next {
  color: #d8fbe4;
  margin: 14px 0 0;
}

.dashboard-action-form {
  display: inline-flex;
  margin: 0;
}

.dashboard-action-form button:disabled {
  cursor: wait;
  opacity: 0.72;
}

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

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

th {
  color: var(--muted);
  font-size: 13px;
}

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

.users-table-wrap {
  background: rgba(10, 18, 31, 0.42);
  border: 1px solid rgba(157, 174, 199, 0.16);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.users-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1260px;
  table-layout: fixed;
}

.users-table th,
.users-table td {
  border-bottom-color: rgba(157, 174, 199, 0.18);
  padding: 12px 14px;
}

.users-table td {
  font-size: 14px;
}

.users-table th {
  background: rgba(13, 20, 33, 0.96);
  color: #b9c9de;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.users-table tbody tr {
  transition: background 160ms ease;
}

.users-table tbody tr:hover {
  background: rgba(107, 180, 255, 0.055);
}

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

.users-col-account {
  width: 190px;
}

.users-col-email {
  width: 210px;
}

.users-col-study {
  width: 150px;
}

.users-col-login {
  width: 170px;
}

.users-col-device {
  width: 210px;
}

.users-col-session {
  width: 210px;
}

.users-col-created {
  width: 170px;
}

.users-col-action {
  width: 74px;
}

.name-cell,
.stack-cell,
.device-cell {
  display: grid;
  gap: 4px;
  line-height: 1.45;
  min-width: 0;
}

.name-cell strong,
.stack-cell strong,
.device-cell strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.date-value,
.users-table td:nth-child(4) .muted,
.users-table td:nth-child(7) .muted {
  white-space: nowrap;
}

.name-cell .pill {
  justify-self: start;
  margin-top: 2px;
}

.email-cell {
  color: #d8e5f6;
  display: inline-block;
  font-weight: 700;
  max-width: 220px;
  overflow-wrap: anywhere;
}

.ip-chip {
  background: rgba(107, 180, 255, 0.1);
  border: 1px solid rgba(107, 180, 255, 0.24);
  border-radius: 999px;
  color: #cde6ff;
  display: inline-block;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  justify-self: start;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 3px 9px;
  white-space: normal;
}

.ip-chip--empty {
  background: rgba(157, 174, 199, 0.1);
  border-color: rgba(157, 174, 199, 0.18);
  color: var(--muted);
  font-family: inherit;
}

.session-details {
  border-top: 0;
  margin-top: 4px;
  padding-top: 0;
}

.session-details summary {
  color: #b9dfff;
  font-size: 12px;
  font-weight: 800;
}

.session-details[open] {
  background: rgba(17, 26, 42, 0.8);
  border: 1px solid rgba(107, 180, 255, 0.18);
  border-radius: 12px;
  padding: 8px 10px;
}

.session-details dl {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
}

.session-details dl > div {
  display: grid;
  gap: 3px;
}

.session-details dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.session-details dd {
  color: #d8e5f6;
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
  max-width: 320px;
  overflow-wrap: anywhere;
}

.login-history {
  border-top: 1px solid rgba(157, 174, 199, 0.12);
  margin-top: 6px;
  padding-top: 6px;
}

.login-history summary {
  color: #b9dfff;
  font-size: 12px;
  font-weight: 800;
}

.login-history[open] {
  background: rgba(17, 26, 42, 0.66);
  border: 1px solid rgba(157, 174, 199, 0.16);
  border-radius: 12px;
  margin-top: 8px;
  padding: 8px 10px;
}

.login-history__list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 2px;
}

.login-history__item {
  border-top: 1px solid rgba(157, 174, 199, 0.12);
  display: grid;
  gap: 4px;
  padding-top: 8px;
}

.login-history__item:first-child {
  border-top: 0;
  padding-top: 0;
}

.login-history__top,
.login-history__meta {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-width: 0;
}

.login-history__top strong {
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}

.login-history__meta {
  color: var(--muted);
  font-size: 12px;
}

.login-history__meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.login-history .pill {
  flex: 0 0 auto;
  font-size: 11px;
  padding: 2px 7px;
}

.login-history__empty {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.table-link-button {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: #b9dfff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  justify-content: flex-start;
  min-height: 0;
  padding: 0;
  text-align: left;
  transform: none;
}

.table-link-button span {
  color: var(--muted);
  font-weight: 700;
  margin-left: 6px;
}

.table-link-button:hover,
.table-link-button:focus-visible {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: #d9ecff;
  outline: 0;
  text-decoration: underline;
  transform: none;
}

.users-table .row-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.users-table .button {
  border-radius: 12px;
  font-size: 13px;
  min-height: 36px;
  padding: 8px 12px;
}

.admin-avatar {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  min-width: 104px;
}

.admin-avatar__image,
.admin-avatar__placeholder {
  border: 2px solid rgba(236, 243, 255, 0.72);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  flex: 0 0 auto;
  height: 38px;
  width: 38px;
}

.admin-avatar__image {
  background: rgba(236, 243, 255, 0.12);
  object-fit: cover;
}

.admin-avatar__placeholder {
  align-items: center;
  background: linear-gradient(135deg, #42d87a, #6bb4ff);
  color: #06120a;
  display: inline-flex;
  font-size: 16px;
  font-weight: 900;
  justify-content: center;
}

.admin-avatar__status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

input,
select,
textarea {
  background: #111a2a;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
  width: 100%;
}

select {
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.5 6.75L9 11.25L13.5 6.75' stroke='%23ECF3FF' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 18px 18px;
  padding-right: 42px;
}

select::-ms-expand {
  display: none;
}

textarea {
  font-family: "SFMono-Regular", Consolas, monospace;
  min-height: 150px;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.level-manage-cell {
  min-width: 190px;
}

.level-actions {
  align-items: start;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: start;
}

.level-actions .button,
.level-actions button {
  border-radius: 12px;
  font-size: 14px;
  min-height: 38px;
  padding: 8px 12px;
}

.level-row-button,
.level-save-button {
  min-width: 88px;
}

.level-save-button {
  background: linear-gradient(135deg, #42d87a, #2ec76b);
  border-color: rgba(66, 216, 122, 0.7);
  box-shadow: 0 12px 24px rgba(66, 216, 122, 0.12);
  color: #06120a;
  display: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  visibility: hidden;
}

.level-save-button--visible {
  display: inline-flex;
  min-height: 38px;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  visibility: visible;
}

.level-save-button--visible:hover,
.level-save-button--visible:focus-visible {
  border-color: rgba(120, 245, 166, 0.92);
  box-shadow: 0 14px 28px rgba(66, 216, 122, 0.18);
  outline: 0;
}

.level-save-button--visible:active {
  transform: translateY(1px);
}

.level-filter-form {
  align-items: end;
  border-top: 1px solid rgba(157, 174, 199, 0.14);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: flex-start;
  margin: 18px 0;
  padding-top: 18px;
}

.level-filter-field {
  max-width: 340px;
  width: 100%;
}

.level-filter-field select {
  background-position: right 18px center;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 800;
  min-height: 58px;
  padding-left: 18px;
  padding-right: 54px;
}

.level-filter-summary {
  align-items: center;
  background: rgba(17, 26, 42, 0.72);
  border: 1px solid rgba(157, 174, 199, 0.18);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 800;
  gap: 8px;
  min-height: 42px;
  padding: 8px 14px;
}

.level-filter-summary__label {
  color: var(--green);
}

.level-unit-list {
  color: var(--text);
  line-height: 1.6;
  min-width: 180px;
  max-width: 320px;
}

.unit-create-form {
  display: grid;
  gap: 8px;
  grid-template-columns: auto;
  justify-content: end;
}

.unit-create-form button,
.unit-picker__button {
  white-space: nowrap;
}

.unit-picker {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(157, 174, 199, 0.14);
  border-radius: 16px;
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-width: 560px;
  padding: 12px;
}

.unit-picker__head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.unit-picker__label {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.unit-picker__count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.unit-picker__row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(220px, 1fr) auto;
}

.unit-picker__select {
  min-width: 0;
}

.unit-picker--empty {
  align-items: center;
  min-height: 54px;
}

.course-units-card {
  margin-top: 18px;
}

.unit-tabs {
  border-bottom: 1px solid rgba(157, 174, 199, 0.16);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-bottom: 10px;
}

.unit-tab {
  align-items: center;
  background: rgba(17, 26, 42, 0.82);
  border: 1px solid rgba(157, 174, 199, 0.2);
  border-radius: 14px;
  color: var(--muted);
  display: inline-flex;
  gap: 10px;
  min-height: 44px;
  padding: 9px 14px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.unit-tab:hover,
.unit-tab:focus-visible {
  background: rgba(107, 180, 255, 0.12);
  border-color: rgba(107, 180, 255, 0.38);
  color: var(--text);
  outline: 0;
  transform: translateY(-1px);
}

.unit-tab--active {
  background: rgba(66, 216, 122, 0.14);
  border-color: rgba(66, 216, 122, 0.56);
  box-shadow: inset 0 -2px 0 rgba(66, 216, 122, 0.9);
  color: #d9ffe6;
}

.unit-tab__name {
  font-weight: 800;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-tab__status {
  background: rgba(255, 105, 114, 0.14);
  border-radius: 999px;
  color: #ffb5ba;
  font-size: 11px;
  font-weight: 900;
  padding: 3px 8px;
}

.unit-tab__status--enabled {
  background: rgba(66, 216, 122, 0.16);
  color: #aef3c6;
}

.unit-panel {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.embedded-unit-form {
  align-items: end;
  background: rgba(17, 26, 42, 0.5);
  border: 1px solid rgba(157, 174, 199, 0.16);
  border-radius: 18px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 1fr) auto;
  padding: 16px;
}

.embedded-unit-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.embedded-unit-main .field {
  max-width: 520px;
}

.embedded-unit-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.unit-panel-section {
  border-top: 1px solid rgba(157, 174, 199, 0.16);
  padding-top: 18px;
}

.pill {
  background: rgba(157, 174, 199, 0.14);
  border: 1px solid rgba(157, 174, 199, 0.18);
  border-radius: 999px;
  color: #dbe6f3;
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
}

.pill.ERROR,
.pill--deleted {
  background: rgba(255, 105, 114, 0.18);
  border-color: rgba(255, 105, 114, 0.28);
  color: #ffb5ba;
}

.pill.WARNING,
.pill--warning {
  background: rgba(244, 201, 93, 0.16);
  border-color: rgba(244, 201, 93, 0.26);
  color: #ffe39a;
}

.pill.INFO {
  background: rgba(107, 180, 255, 0.16);
  color: #b9dfff;
}

.pill.SUCCESS,
.pill--success {
  background: rgba(66, 216, 122, 0.16);
  border-color: rgba(66, 216, 122, 0.28);
  color: #b5f5cd;
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.guide {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.guide-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.guide-item {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  display: inline-flex;
  gap: 10px;
  padding: 10px 14px;
}

.guide-item strong {
  color: var(--green);
}

.difficulty-guide {
  align-items: flex-start;
}

.difficulty-guide h2 {
  margin-bottom: 6px;
}

.difficulty-guide__list {
  max-width: 620px;
}

.difficulty-editor {
  display: grid;
  gap: 8px;
  min-width: 168px;
}

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

.difficulty-badge {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  min-height: 28px;
  padding: 5px 10px;
  white-space: nowrap;
}

.difficulty-badge--unset {
  background: rgba(157, 174, 199, 0.12);
  border-color: rgba(157, 174, 199, 0.26);
  color: #d0d9e8;
}

.difficulty-badge--intro {
  background: rgba(66, 216, 122, 0.14);
  border-color: rgba(66, 216, 122, 0.35);
  color: #b5f5cd;
}

.difficulty-badge--easy {
  background: rgba(107, 180, 255, 0.14);
  border-color: rgba(107, 180, 255, 0.35);
  color: #b9dfff;
}

.difficulty-badge--medium {
  background: rgba(244, 201, 93, 0.14);
  border-color: rgba(244, 201, 93, 0.36);
  color: #ffe39a;
}

.difficulty-badge--hard {
  background: rgba(255, 159, 67, 0.14);
  border-color: rgba(255, 159, 67, 0.36);
  color: #ffd2a6;
}

.difficulty-badge--advanced {
  background: rgba(181, 140, 255, 0.15);
  border-color: rgba(181, 140, 255, 0.38);
  color: #dac9ff;
}

.difficulty-scale {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.difficulty-select {
  min-width: 168px;
}

.section-head {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-head h2,
.section-head h3,
.section-head p {
  margin: 0;
}

.section-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 14px;
  font-weight: 700;
}

.field--wide {
  grid-column: 1 / -1;
}

.checkbox-inline {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  white-space: nowrap;
}

.checkbox-inline input {
  width: auto;
}

.field-end {
  align-self: end;
}

.sr-only {
  clip: rect(0, 0, 0, 0);
  border: 0;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.type-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.type-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.type-card {
  background: rgba(18, 28, 44, 0.88);
  border: 1px solid var(--line);
  border-radius: 18px;
  cursor: pointer;
  display: grid;
  gap: 8px;
  min-height: 140px;
  padding: 18px;
  position: relative;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.type-card:hover {
  border-color: rgba(107, 180, 255, 0.45);
  transform: translateY(-1px);
}

.type-card input {
  inset: 0;
  opacity: 0;
  position: absolute;
}

.type-card.is-active,
.type-card:has(input:checked) {
  border-color: rgba(66, 216, 122, 0.65);
  box-shadow: 0 16px 36px rgba(46, 199, 107, 0.12);
}

.type-card__title {
  font-size: 18px;
  font-weight: 800;
}

.type-card__desc {
  color: var(--muted);
  line-height: 1.5;
}

.type-card--action {
  min-height: 0;
  padding: 0;
}

.type-card__button {
  align-items: flex-start;
  background: transparent;
  border: 0;
  border-radius: 18px;
  display: grid;
  gap: 8px;
  justify-items: start;
  min-height: 0;
  padding: 18px;
  text-align: left;
  width: 100%;
}

.summary-box {
  background: rgba(10, 16, 27, 0.52);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  margin-bottom: 16px;
  min-height: 68px;
  padding: 14px 16px;
}

.summary-box__title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.summary-box__text {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

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

.stack {
  display: grid;
  gap: 14px;
}

.empty-state {
  color: var(--muted);
  padding: 8px 2px;
}

.editor-table {
  display: grid;
  gap: 10px;
}

.editor-table__head,
.editor-table__row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 56px 1.4fr 1fr 1fr 1fr 90px;
}

.editor-table__head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 0 4px;
  text-transform: uppercase;
}

.editor-table__row {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 10px;
}

.editor-table__index {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.token-chip {
  background: rgba(107, 180, 255, 0.08);
  border: 1px solid rgba(107, 180, 255, 0.25);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  min-height: 0;
  padding: 8px 12px;
}

.token-chip.active {
  background: rgba(66, 216, 122, 0.18);
  border-color: rgba(66, 216, 122, 0.52);
  color: #d4ffe5;
}

.token-chip--readonly {
  cursor: default;
}

.element-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.element-card__head {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.toolbar {
  margin-bottom: 16px;
}

.toolbar__search {
  display: grid;
  gap: 8px;
  max-width: 360px;
}

.users-toolbar {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(280px, 520px) auto;
  margin-bottom: 16px;
}

.search-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.search-field span,
.check-field {
  font-size: 14px;
  font-weight: 700;
}

.users-toolbar .search-field input {
  background: rgba(17, 26, 42, 0.82);
  border-color: rgba(107, 180, 255, 0.22);
  min-height: 46px;
}

.users-toolbar__actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.check-field {
  align-items: center;
  background: rgba(17, 26, 42, 0.72);
  border: 1px solid rgba(157, 174, 199, 0.18);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  gap: 8px;
  min-height: 42px;
  padding: 8px 14px;
  white-space: nowrap;
}

.check-field input {
  accent-color: var(--green);
  flex: 0 0 auto;
  height: 16px;
  margin: 0;
  width: 16px;
}

.item-main {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

details {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 12px;
  padding-top: 12px;
}

summary {
  color: var(--blue);
  cursor: pointer;
  font-weight: 700;
}

.is-hidden {
  display: none !important;
}

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

.login .card {
  width: min(420px, calc(100vw - 32px));
}

.login-remember {
  color: var(--muted);
  margin: 2px 0 16px;
}

.login-remember input {
  accent-color: var(--green);
}

[hidden] {
  display: none !important;
}

.admin-shell {
  min-height: 100vh;
}

.dashboard {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

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

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-lockup__logo {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  height: 48px;
  object-fit: contain;
  padding: 5px;
  width: 48px;
}

.login-card {
  background: rgba(23, 34, 53, 0.88);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  display: grid;
  gap: 12px;
  padding: 20px;
  width: min(420px, calc(100vw - 32px));
}

.login-card label {
  font-size: 14px;
  font-weight: 700;
}

.form-message {
  color: #ffb5ba;
  min-height: 20px;
}

.sidebar__brand {
  color: var(--green);
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
}

.sidebar__nav {
  display: grid;
  flex: 1;
  gap: 10px;
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.nav-item {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  justify-content: flex-start;
  position: relative;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
  width: 100%;
}

.nav-item:hover {
  background: rgba(107, 180, 255, 0.09);
  border-color: rgba(107, 180, 255, 0.24);
  color: var(--text);
  transform: translateX(2px);
}

.nav-item.is-active {
  background: rgba(66, 216, 122, 0.14);
  border-color: rgba(66, 216, 122, 0.48);
  color: #d9ffe6;
  box-shadow: 0 12px 28px rgba(66, 216, 122, 0.1);
}

.nav-item.is-active::before {
  background: var(--green);
  border-radius: 999px;
  bottom: 10px;
  content: "";
  left: -9px;
  position: absolute;
  top: 10px;
  width: 4px;
}

.content-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
}

.header-actions,
.action-row,
.row-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.section-card {
  background: rgba(23, 34, 53, 0.88);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  padding: 20px;
}

.section-card + .section-card,
.tab-panel > .section-card + .section-card {
  margin-top: 18px;
}

.metric-grid + .section-card,
.topbar-inline + .section-card,
.topbar-inline + .metric-grid,
.section-card + .metric-grid,
.metric-grid + .table-wrap,
.metric-grid + .empty-state {
  margin-top: 18px;
}

.metric-grid,
.version-status-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.version-status-grid {
  margin: 18px 0;
}

.section-head + .metric-grid,
.section-head + .table-wrap,
.toolbar + .metric-grid,
.toolbar + .table-wrap,
.users-toolbar + .metric-grid {
  margin-top: 16px;
}

.action-row {
  margin-top: 16px;
}

.metric-card,
.version-status-card {
  background: rgba(23, 34, 53, 0.88);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
}

.metric-card strong,
.version-status-card strong {
  display: block;
  font-size: 34px;
  font-weight: 800;
  margin-top: 8px;
}

.version-status-card p {
  color: var(--muted);
}

.button--primary {
  background: linear-gradient(135deg, #2ec76b, #21a85a);
  border-color: #3ce17a;
  color: #06120a;
}

.button--primary:hover {
  background: linear-gradient(135deg, #49e184, #2fc76b);
  border-color: #73f59c;
  box-shadow: 0 16px 34px rgba(46, 199, 107, 0.28);
  color: #05130a;
}

.button--danger,
.danger {
  background: rgba(255, 105, 114, 0.12);
  border-color: rgba(255, 105, 114, 0.45);
  color: #ffb5ba;
}

.button--danger:hover,
.danger:hover {
  background: rgba(255, 105, 114, 0.2);
  border-color: rgba(255, 129, 137, 0.72);
  box-shadow: 0 14px 32px rgba(255, 105, 114, 0.18);
  color: #ffd3d6;
}

.button--ghost {
  background: transparent;
}

.button--ghost:hover {
  background: rgba(157, 174, 199, 0.12);
  border-color: rgba(157, 174, 199, 0.42);
}

.has-modal-open {
  overflow: hidden;
}

.modal-backdrop {
  align-items: center;
  background: rgba(6, 10, 18, 0.72);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 20;
}

.modal-dialog {
  background: rgba(15, 24, 39, 0.98);
  border: 1px solid rgba(157, 174, 199, 0.24);
  border-radius: 20px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(760px, calc(100vh - 48px));
  overflow: hidden;
  width: min(760px, calc(100vw - 48px));
}

.modal-head {
  align-items: start;
  border-bottom: 1px solid rgba(157, 174, 199, 0.16);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 20px 22px 16px;
}

.modal-head h2 {
  margin: 0;
}

.modal-close {
  flex: 0 0 auto;
}

.modal-body {
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px 22px;
}

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

.modal-summary-grid > div {
  background: rgba(17, 26, 42, 0.78);
  border: 1px solid rgba(157, 174, 199, 0.16);
  border-radius: 14px;
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 12px;
}

.modal-summary-grid span,
.modal-definition-list dt,
.login-history-modal__grid dt,
.modal-user-agent span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.modal-summary-grid strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.modal-definition-list,
.login-history-modal__grid {
  display: grid;
  gap: 10px;
  margin: 0;
}

.modal-definition-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.modal-definition-list > div,
.login-history-modal__grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.modal-definition-list dd,
.login-history-modal__grid dd {
  color: #d8e5f6;
  line-height: 1.45;
  margin: 0;
  overflow-wrap: anywhere;
}

.login-history-modal {
  display: grid;
  gap: 12px;
}

.login-history-modal__item {
  background: rgba(17, 26, 42, 0.58);
  border: 1px solid rgba(157, 174, 199, 0.16);
  border-radius: 16px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.login-history-modal__head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.login-history-modal__head strong {
  color: var(--text);
}

.login-history-modal__grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.modal-user-agent {
  border-top: 1px solid rgba(157, 174, 199, 0.14);
  display: grid;
  gap: 6px;
  padding-top: 10px;
}

.modal-user-agent p {
  color: #d8e5f6;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  overflow-wrap: anywhere;
}

.modal-empty {
  color: var(--muted);
  padding: 12px 0;
}

.toast {
  background: rgba(23, 34, 53, 0.96);
  border: 1px solid rgba(66, 216, 122, 0.44);
  border-radius: 14px;
  bottom: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  color: #d9ffe6;
  font-weight: 800;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 14px;
  position: fixed;
  right: 24px;
}

@media (max-width: 1100px) {
  .users-toolbar {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .users-toolbar__actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    height: auto;
    min-height: 0;
    overflow: visible;
    position: static;
  }

  .nav {
    overflow-y: visible;
    padding-right: 0;
  }

  .sidebar__footer {
    margin-top: 0;
  }

  .editor-table__head {
    display: none;
  }

  .editor-table__row {
    grid-template-columns: 1fr;
  }

  .section-head,
  .guide {
    align-items: stretch;
  }

  .level-actions,
  .unit-create-form,
  .unit-title-form,
  .level-title-form,
  .embedded-unit-form,
  .unit-picker__row {
    grid-template-columns: 1fr;
  }

  .unit-title-actions,
  .level-title-actions,
  .embedded-unit-actions {
    justify-content: flex-start;
  }

  .levels-topbar {
    align-items: stretch;
  }

  .levels-topbar .level-create-action {
    justify-content: flex-start;
  }

  .content {
    padding: 22px 16px;
  }

  .content-header {
    align-items: stretch;
    display: grid;
  }

  .users-table {
    min-width: 1180px;
  }

  .modal-backdrop {
    align-items: stretch;
    padding: 14px;
  }

  .modal-dialog {
    max-height: calc(100vh - 28px);
    width: 100%;
  }

  .modal-head {
    padding: 16px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-summary-grid,
  .modal-definition-list,
  .login-history-modal__grid {
    grid-template-columns: 1fr;
  }

  .unit-title-input,
  .level-title-input {
    font-size: 26px;
  }

  .level-create-form .field--wide,
  .level-create-form .field-end {
    grid-column: auto;
  }
}
