:root {
  --purple: #6746ee;
  --purple-strong: #4d2ed1;
  --purple-soft: #f1edff;
  --cyan: #18b9ca;
  --ink: #1f2338;
  --muted: #697086;
  --line: #e5e8f1;
  --green: #15785a;
  --green-soft: #e9f8f1;
  --red: #bf3448;
  --red-soft: #fff0f2;
  --amber: #976213;
  --amber-soft: #fff7df;
  --bg: #f3f5fb;
  --surface: #ffffff;
  --shadow-sm: 0 6px 18px rgba(37, 40, 77, .07);
  --shadow-md: 0 16px 45px rgba(48, 42, 105, .11);
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 90% -10%, rgba(103, 70, 238, .16), transparent 33rem),
    radial-gradient(circle at 5% 20%, rgba(24, 185, 202, .09), transparent 28rem),
    var(--bg);
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
  line-height: 1.45;
}

button,
a,
input,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(103, 70, 238, .28);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

.shell {
  width: min(1220px, 100%);
  max-width: none;
  padding: 18px clamp(12px, 3vw, 28px) 110px;
}

.top {
  position: sticky;
  top: 10px;
  z-index: 30;
  min-height: 72px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 23px;
  padding: 12px 15px;
  background: rgba(255, 255, 255, .91);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

.top .logo {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  border-radius: 17px;
  color: #fff;
  box-shadow: 0 8px 22px rgba(103, 70, 238, .25);
}

.top h1 {
  font-size: clamp(18px, 3vw, 22px);
  letter-spacing: -.3px;
}

.top .muted {
  margin-top: 2px;
  font-size: 12px;
}

.btn {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 9px 14px;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(.985);
}

.btn.primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-strong));
  box-shadow: 0 8px 18px rgba(103, 70, 238, .2);
}

.btn.ghost {
  border-color: #ddd6ff;
  background: var(--purple-soft);
  color: #4f33c0;
}

.btn.green {
  border-color: #bfe8d8;
  background: var(--green-soft);
  color: #126747;
}

.btn.danger {
  border-color: #ffd4da;
  background: var(--red-soft);
  color: #a9283c;
}

.full-width {
  width: 100%;
}

.card {
  border-color: rgba(220, 224, 238, .9);
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
}

.auth {
  position: relative;
  width: min(500px, 100%);
  margin: clamp(28px, 7vh, 70px) auto;
  padding: clamp(20px, 5vw, 34px);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.auth::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
}

.auth h2 {
  margin: 5px 0 20px;
  font-size: 25px;
}

.tabs {
  padding: 4px;
  border-radius: 16px;
  background: #f1f2f8;
  margin-bottom: 18px;
}

.tabs .btn {
  min-height: 46px;
}

.input {
  min-height: 46px;
  border: 1px solid #d9ddea;
  border-radius: 13px;
  padding: 10px 13px;
  color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.input:focus {
  border-color: var(--purple);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(103, 70, 238, .11);
}

.field-label {
  display: block;
  margin: 4px 2px 5px;
  color: #4d5369;
  font-size: 12px;
  font-weight: 800;
}

.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  border: 1px solid rgba(103, 70, 238, .12);
  border-radius: 26px;
  padding: clamp(20px, 4vw, 30px);
  color: #fff;
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 255, 255, .18), transparent 16rem),
    linear-gradient(125deg, #4027ae, #704cf2 58%, #19aebd);
  box-shadow: 0 18px 48px rgba(78, 49, 187, .2);
}

.dashboard-hero h2 {
  margin: 3px 0 7px;
  font-size: clamp(23px, 4vw, 34px);
  letter-spacing: -.6px;
}

.dashboard-hero p {
  max-width: 600px;
  margin: 0;
  color: rgba(255, 255, 255, .82);
}

.eyebrow {
  display: block;
  color: #7462d1;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dashboard-hero .eyebrow {
  color: #dcd4ff;
}

.overview-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(78px, 1fr));
  gap: 8px;
  flex: 0 0 min(360px, 42%);
}

.overview-metric {
  min-height: 88px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 18px;
  padding: 12px;
  text-align: center;
  background: rgba(255, 255, 255, .12);
  backdrop-filter: blur(8px);
}

.overview-metric span {
  display: block;
  font-size: 29px;
  font-weight: 900;
  line-height: 1.1;
}

.overview-metric small {
  display: block;
  margin-top: 5px;
  color: rgba(255, 255, 255, .82);
  font-size: 11px;
}

.overview-metric.attention:not(.is-clear) {
  background: rgba(255, 195, 71, .2);
}

.academy-access {
  margin-top: 12px;
  border: 1px solid #ddd8f8;
  border-radius: 17px;
  color: #4c4770;
  background: rgba(255, 255, 255, .77);
  box-shadow: var(--shadow-sm);
}

.academy-access > summary,
.bulk-box > summary,
.add-student-panel > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 11px 14px;
  cursor: pointer;
  list-style: none;
}

.academy-access > summary::-webkit-details-marker,
.bulk-box > summary::-webkit-details-marker,
.add-student-panel > summary::-webkit-details-marker {
  display: none;
}

.academy-access > summary::after,
.bulk-box > summary::after,
.add-student-panel > summary::after {
  content: "⌄";
  margin-inline-start: auto;
  font-size: 18px;
  font-weight: 900;
  transition: transform .18s ease;
}

.academy-access[open] > summary::after,
.bulk-box[open] > summary::after,
.add-student-panel[open] > summary::after {
  transform: rotate(180deg);
}

.academy-access > div {
  padding: 0 15px 14px;
}

.academy-access p {
  margin: 0 0 9px;
  font-size: 13px;
}

.grid {
  grid-template-columns: minmax(310px, 360px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  margin-top: 16px;
}

.students-panel {
  position: sticky;
  top: 98px;
  max-height: calc(100vh - 115px);
  padding: 16px;
  overflow: auto;
  scrollbar-width: thin;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
}

.panel-heading h2 {
  margin: 2px 0 0;
  font-size: 22px;
}

.panel-icon {
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  place-items: center;
  border-radius: 14px;
  background: var(--purple-soft);
  font-size: 21px;
}

#controllerInfo {
  margin: 4px 0 13px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.student-tools {
  margin-bottom: 12px;
}

.search-field {
  position: relative;
}

.search-field > span {
  position: absolute;
  top: 50%;
  right: 13px;
  z-index: 1;
  color: #777d91;
  font-size: 20px;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field .input {
  margin: 0;
  padding-right: 42px;
}

.add-student-panel {
  margin-top: 8px;
  border: 1px solid #ddd7ff;
  border-radius: 14px;
  color: #5339c5;
  background: #f8f6ff;
}

.add-student-panel > summary {
  font-weight: 900;
}

.add-student-panel form {
  padding: 0 12px 12px;
}

#studentsList {
  display: grid;
  gap: 10px;
}

.student {
  position: relative;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px;
  background: var(--surface);
  box-shadow: 0 5px 15px rgba(36, 40, 74, .045);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.student:hover {
  border-color: #cec5ff;
  box-shadow: 0 10px 24px rgba(64, 45, 147, .09);
  transform: translateY(-1px);
}

.student.selected {
  border: 2px solid var(--purple);
  padding: 12px;
  background: linear-gradient(135deg, #fbfaff, #f0edff);
  box-shadow: 0 10px 28px rgba(103, 70, 238, .14);
}

.student.selected::before {
  content: "נבחר";
  position: absolute;
  top: 10px;
  left: 10px;
  border-radius: 999px;
  padding: 3px 7px;
  color: #fff;
  background: var(--purple);
  font-size: 9px;
  font-weight: 900;
}

.student-identity {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.student-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #7152ef, #18b8c7);
  box-shadow: 0 6px 15px rgba(103, 70, 238, .18);
  font-size: 17px;
  font-weight: 900;
}

.student-name {
  min-width: 0;
}

.student-name b {
  overflow: hidden;
  color: #23263b;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-name small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student > p,
.student-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 10px 0;
}

.badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border: 1px solid #caeadf;
  padding: 4px 8px;
  font-size: 9.5px;
  line-height: 1.25;
}

.badge.pending {
  border-color: #f0dda7;
}

.badge.off {
  border-color: #ffd4da;
}

.student .actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.student .actions .btn {
  min-width: 0;
  min-height: 38px;
  padding: 7px 8px;
  font-size: 10.5px;
}

.student .actions .danger:last-child {
  grid-column: 1 / -1;
}

.student .notice {
  margin: 9px 0 0;
}

.bulk-box {
  margin: 14px 0 0;
  padding: 0;
  overflow: hidden;
  border-color: #ddd8f7;
  background: #faf9ff;
}

.bulk-box > summary {
  color: #4d3ca7;
}

.bulk-box > summary small {
  margin-inline-start: auto;
  color: var(--muted);
  font-weight: 400;
}

.bulk-box > summary::after {
  margin-inline-start: 0;
}

.bulk-content {
  padding: 0 11px 12px;
}

.bulk-grid {
  gap: 6px;
}

.bulk-grid .btn {
  min-height: 39px;
  padding: 7px 8px;
  font-size: 10px;
}

.bulk-level {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 11px;
}

.bulk-level h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 2px 0 10px;
  color: #4b5065;
  font-size: 12px;
}

.check-row input,
.level-control input {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  accent-color: var(--purple);
}

.activity-panel {
  min-width: 0;
  min-height: 500px;
  padding: clamp(16px, 3vw, 25px);
}

.activity-loading {
  display: grid;
  min-height: 420px;
  place-items: center;
  text-align: center;
}

.loading-orb {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border: 5px solid #e8e3ff;
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: control-spin .75s linear infinite;
}

@keyframes control-spin {
  to { transform: rotate(360deg); }
}

.activity-panel > .actions:first-child {
  align-items: center;
  margin: -4px -4px 14px;
  border-bottom: 1px solid var(--line);
  padding: 4px 4px 15px;
}

.activity-panel > .actions:first-child h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 30px);
}

.activity-panel > .actions:first-child p {
  margin: 2px 0 0;
}

.detail-nav {
  position: sticky;
  top: 96px;
  z-index: 15;
  display: flex;
  gap: 6px;
  margin: 0 -4px 14px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid #e0dcf5;
  border-radius: 15px;
  background: rgba(249, 248, 255, .94);
  box-shadow: 0 8px 20px rgba(42, 38, 82, .07);
  backdrop-filter: blur(12px);
  scrollbar-width: none;
}

.detail-nav::-webkit-scrollbar {
  display: none;
}

.detail-nav button {
  min-width: max-content;
  min-height: 38px;
  border: 0;
  border-radius: 11px;
  padding: 7px 11px;
  color: #4c4669;
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.detail-nav button:hover {
  color: #4e32c3;
  background: #ebe6ff;
}

.stats {
  gap: 9px;
}

.stat {
  position: relative;
  min-height: 82px;
  border: 1px solid #e5e0ff;
  border-radius: 17px;
  padding: 13px 9px;
  color: #565c70;
  background: linear-gradient(145deg, #faf9ff, #f0edff);
  font-size: 11px;
}

.stat b {
  margin-bottom: 3px;
  color: #292342;
  font-size: clamp(20px, 4vw, 26px);
}

.stats .stat:nth-child(2) {
  border-color: #cdecef;
  background: linear-gradient(145deg, #f7ffff, #eafafa);
}

.stats .stat:nth-child(3) {
  border-color: #f0e0bd;
  background: linear-gradient(145deg, #fffdf8, #fff6e4);
}

.insight {
  position: relative;
  margin: 14px 0 20px;
  border: 1px solid #ded8fa;
  padding: clamp(15px, 3vw, 20px);
  overflow: hidden;
}

.insight::after {
  content: "";
  position: absolute;
  top: -70px;
  left: -55px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(103, 70, 238, .09);
}

.trend {
  font-size: clamp(18px, 3vw, 24px);
}

.progress-track {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #dddfea;
}

.progress-track > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
}

.activity-panel > h3,
.usage-panel > h3 {
  margin: 24px 0 9px;
  color: #2c3046;
  font-size: 17px;
  scroll-margin-top: 160px;
}

.activity-panel > h3::before,
.usage-panel > h3::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 18px;
  margin-left: 7px;
  border-radius: 99px;
  background: linear-gradient(var(--purple), var(--cyan));
  vertical-align: -3px;
}

.level-control {
  grid-template-columns: 125px minmax(190px, 1fr) auto;
  gap: 10px;
  border: 1px solid #e2e5ef;
  border-radius: 17px;
  padding: 12px;
  background: #f8f9fd;
}

.level-control .input {
  margin: 0;
}

.level-control label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #474d61;
  font-size: 12px;
}

.feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.feature-btn {
  min-height: 50px;
  border-color: #bde5d6;
  border-radius: 14px;
  padding: 9px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

.feature-btn:hover {
  box-shadow: 0 7px 17px rgba(23, 120, 88, .1);
  transform: translateY(-1px);
}

.feature-btn.off {
  border-color: #ffd0d7;
}

.chart {
  height: 190px;
  border: 1px solid #e7e3f7;
  padding: 17px 12px 13px;
  background:
    repeating-linear-gradient(to top, transparent 0 38px, rgba(103, 70, 238, .07) 38px 39px),
    #fbfaff;
}

.chart-bar {
  box-shadow: 0 5px 12px rgba(103, 70, 238, .16);
}

.chart-col small {
  font-size: 9px;
}

.attempt {
  margin: 9px 0;
  border: 1px solid #e4e1f3;
  border-right: 5px solid var(--purple);
  border-radius: 16px;
  padding: 13px;
  background: #fdfcff;
}

.attempt-head strong {
  min-width: 50px;
  border-radius: 999px;
  padding: 4px 8px;
  color: #4b34bd;
  background: #ebe6ff;
  text-align: center;
}

.attempt details {
  margin-top: 9px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.attempt summary {
  min-height: 38px;
  color: #5138bf;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.answer-detail {
  border: 1px solid #e7e5ef;
  border-radius: 11px;
  padding: 9px;
  background: #fff;
  line-height: 1.65;
}

.usage-panel {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 1px;
}

.usage-summary {
  gap: 9px;
}

.usage-row {
  border-color: #e4e6ef;
  border-radius: 15px;
  background: #fcfcff;
}

.empty {
  border: 1px dashed #d7d9e5;
  border-radius: 17px;
  padding: 26px 16px;
  background: #fafbfe;
}

.empty-welcome {
  display: grid;
  min-height: 450px;
  align-content: center;
  justify-items: center;
}

.empty-welcome > span {
  display: grid;
  width: 78px;
  height: 78px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 25px;
  background: linear-gradient(135deg, #eee9ff, #e4f8fa);
  font-size: 37px;
}

.empty-welcome h2 {
  margin: 0 0 5px;
  color: #313549;
  font-size: 21px;
}

.empty-welcome p {
  max-width: 430px;
  margin: 0;
  line-height: 1.6;
}

.empty-search,
.usage-list .empty {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.empty-search > span,
.usage-list .empty > span {
  font-size: 29px;
}

.empty-search > b,
.usage-list .empty > b {
  color: #303449;
}

.empty-search > small,
.usage-list .empty > small {
  line-height: 1.55;
}

.notice {
  border-radius: 14px;
  line-height: 1.55;
}

@media (max-width: 900px) {
  .dashboard-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .overview-metrics {
    flex-basis: auto;
  }

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

  .students-panel {
    position: static;
    max-height: none;
  }

  .activity-panel {
    scroll-margin-top: 88px;
  }

  .detail-nav {
    top: 86px;
  }
}

@media (max-width: 620px) {
  .shell {
    padding: 8px 8px 105px;
  }

  .top {
    top: 5px;
    min-height: 62px;
    gap: 8px;
    border-radius: 18px;
    padding: 8px 10px;
  }

  .top .logo {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    border-radius: 13px;
    font-size: 19px;
  }

  .top .muted {
    display: none;
  }

  .top .btn {
    min-height: 39px;
    padding: 7px 9px;
    font-size: 11px;
  }

  .dashboard-hero {
    margin-top: 10px;
    border-radius: 20px;
    padding: 18px 15px;
  }

  .dashboard-hero h2 {
    font-size: 23px;
  }

  .dashboard-hero p {
    font-size: 12px;
  }

  .overview-metrics {
    gap: 5px;
  }

  .overview-metric {
    min-height: 73px;
    border-radius: 14px;
    padding: 9px 5px;
  }

  .overview-metric span {
    font-size: 23px;
  }

  .overview-metric small {
    font-size: 9px;
  }

  .academy-access > summary {
    font-size: 12px;
  }

  .grid {
    gap: 10px;
    margin-top: 10px;
  }

  .card,
  .students-panel,
  .activity-panel {
    border-radius: 20px;
    padding: 13px;
  }

  .student {
    border-radius: 16px;
    padding: 11px;
  }

  .student.selected {
    padding: 10px;
  }

  .student .actions {
    grid-template-columns: 1fr 1fr;
  }

  .student .actions .btn {
    min-height: 42px;
  }

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

  .activity-panel {
    min-height: 360px;
  }

  .activity-panel > .actions:first-child {
    align-items: flex-start;
  }

  .activity-panel > .actions:first-child .badge {
    margin-top: 3px;
  }

  .detail-nav {
    top: 72px;
    margin-inline: -5px;
  }

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

  .stat {
    min-height: 76px;
  }

  .level-control {
    grid-template-columns: 1fr;
  }

  .level-control .btn {
    width: 100%;
  }

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

  .feature-btn {
    min-height: 54px;
  }

  .chart {
    height: 165px;
    gap: 4px;
    padding-inline: 8px;
  }

  .usage-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
