:root {
  --bg: #07131d;
  --surface: #ffffff;
  --surface-soft: #f6fbfc;
  --ink: #0d1f2a;
  --muted: #657486;
  --line: rgba(10, 151, 179, 0.18);
  --cyan: #05a6c8;
  --cyan-dark: #047c96;
  --lime: #8cc63f;
  --lime-dark: #6ca72c;
  --red: #b94646;
  --amber: #b7791f;
  --green: #15803d;
  --shadow: 0 22px 64px rgba(3, 42, 58, 0.12);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(5, 166, 200, 0.18), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(140, 198, 63, 0.16), transparent 30rem),
    var(--bg);
  color: var(--ink);
}

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

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.08;
}

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

h3 {
  margin-bottom: 8px;
  font-size: 17px;
  line-height: 1.25;
}

/* Auth */
.auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.58fr);
  background: var(--bg);
}

.auth-hero {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: 38px;
  color: #fff;
  background:
    linear-gradient(120deg, rgba(3, 20, 32, 0.5), rgba(2, 35, 49, 0.88)),
    url("https://cbs-education.com/wp-content/uploads/2025/05/Kelas-Konsep-Desain.jpg") center / cover no-repeat;
}

.auth-hero h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(42px, 6vw, 76px);
  text-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

.auth-hero p {
  max-width: 620px;
  color: #d8f4f7;
  font-size: 18px;
}

.auth-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at top, rgba(5, 166, 200, 0.14), transparent 24rem),
    #f4fbfc;
}

.login-card {
  width: min(100%, 430px);
  padding: 24px;
  border: 1px solid rgba(5, 166, 200, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.demo-users {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

/* Main layout */
.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 264px minmax(0, 1fr);
  background: #edf8fa;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 18px 14px;
  overflow-y: auto;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(4, 21, 33, 0.99), rgba(4, 48, 63, 0.98)),
    radial-gradient(circle at top, rgba(140, 198, 63, 0.18), transparent 20rem);
  border-right: 1px solid rgba(5, 166, 200, 0.22);
}

.sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 38px;
  height: 38px;
  min-width: 38px;
  object-fit: contain;
  padding: 5px;
  border: 1px solid rgba(5, 166, 200, 0.16);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(5, 166, 200, 0.18);
}

.brand-logo.dark {
  width: 54px;
  height: 54px;
  min-width: 54px;
  box-shadow: none;
}

.brand strong,
.brand span {
  display: block;
  min-width: 0;
}

.brand strong {
  max-width: 170px;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.16;
}

.brand span {
  margin-top: 3px;
  color: #b8ced8;
  font-size: 11px;
}

.sidebar-close {
  display: none;
}

.role-chip {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 0 12px;
  border: 1px solid rgba(140, 198, 63, 0.24);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(5, 166, 200, 0.18), rgba(140, 198, 63, 0.14));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.role-chip i,
.nav-item i,
.button i,
.ghost-button i,
.icon-button i {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.nav-menu {
  display: grid;
  gap: 8px;
  padding-bottom: 20px;
}

.nav-item {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #d9e8ee;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

.nav-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item.active,
.nav-item:hover {
  border-color: rgba(140, 198, 63, 0.3);
  background: linear-gradient(135deg, rgba(5, 166, 200, 0.22), rgba(140, 198, 63, 0.13));
  color: #fff;
}

.main-panel {
  min-width: 0;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(236, 253, 245, 0.88)),
    url("https://cbs-education.com/wp-content/uploads/2025/05/Kelas-Konsep-Desain.jpg") top right / min(620px, 70vw) auto no-repeat;
  background-attachment: fixed;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(5, 166, 200, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.topbar-title {
  min-width: 0;
}

.topbar-title h1 {
  overflow-wrap: anywhere;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--cyan-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.top-actions,
.profile-chip,
.toolbar,
.row-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.row-actions form {
  margin: 0;
}

.mobile-menu-button,
.mobile-backdrop {
  display: none;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(5, 166, 200, 0.18);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.profile-chip {
  min-width: 230px;
  padding: 5px 10px 5px 5px;
  border: 1px solid rgba(5, 166, 200, 0.18);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.profile-chip > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--cyan), var(--lime));
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.profile-avatar-img {
  display: block;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 2px solid rgba(5, 166, 200, 0.18);
  border-radius: 9px;
  object-fit: cover;
}

.profile-chip strong,
.profile-chip small {
  display: block;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chip small {
  color: var(--muted);
}

.content {
  display: grid;
  gap: 16px;
}

/* Components */
.panel,
.table-panel,
.stat-card,
.session-card,
.quiz-card,
.invoice-card {
  border: 1px solid rgba(5, 166, 200, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel,
.table-panel {
  padding: 17px;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px;
}

.stat-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(5, 166, 200, 0.12), rgba(140, 198, 63, 0.16));
  color: var(--cyan-dark);
}

.stat-icon i {
  width: 22px;
  height: 22px;
}

.stat-card small {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
}

.stat-card strong {
  font-size: 24px;
}

.layout-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
  gap: 16px;
}

.button,
.ghost-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 850;
  text-decoration: none;
}

.button {
  border: 0;
  background: linear-gradient(135deg, var(--cyan), var(--lime));
  color: #fff;
  box-shadow: 0 14px 30px rgba(5, 166, 200, 0.22);
}

.button:hover {
  background: linear-gradient(135deg, var(--cyan-dark), var(--lime-dark));
}

.google-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid rgba(5, 166, 200, 0.18);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(3, 42, 58, 0.08);
}

.google-button img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.password-field {
  position: relative;
  display: block;
}

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

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
}

.password-toggle:hover {
  background: #eef8fa;
  color: var(--cyan-dark);
}

.password-toggle i {
  width: 18px;
  height: 18px;
}

.ghost-button {
  border: 1px solid rgba(5, 166, 200, 0.18);
  background: #fff;
  color: var(--ink);
}

.ghost-button.danger {
  border-color: rgba(185, 70, 70, 0.22);
  color: var(--red);
}

.ghost-button.danger:hover {
  background: #fee2e2;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(5, 166, 200, 0.2);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.textarea {
  min-height: 88px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(5, 166, 200, 0.13);
}

.stack,
.form-grid {
  display: grid;
  gap: 12px;
}

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

.form-grid label,
.stack label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.full {
  grid-column: 1 / -1;
}

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

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid rgba(5, 166, 200, 0.12);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.compact-table {
  font-size: 12px;
}

.compact-table th,
.compact-table td {
  padding: 8px 9px;
}

.compact-table .badge {
  min-height: 22px;
  padding: 0 7px;
  font-size: 11px;
}

.compact-table .ghost-button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 11px;
}

.compact-table .row-actions {
  gap: 5px;
  flex-wrap: nowrap;
}

.badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.badge.green {
  background: #dcfce7;
  color: var(--green);
}

.badge.red {
  background: #fee2e2;
  color: var(--red);
}

.badge.amber {
  background: #fef3c7;
  color: var(--amber);
}

.badge.blue {
  background: #e0f7fb;
  color: var(--cyan-dark);
}

.alert {
  padding: 13px 14px;
  border: 1px solid rgba(5, 166, 200, 0.16);
  border-radius: 12px;
  background: #e0f7fb;
  color: var(--cyan-dark);
}

.alert.error {
  background: #fee2e2;
  color: var(--red);
}

.alert.success {
  background: #dcfce7;
  color: var(--green);
}

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

.course-list,
.session-list,
.invoice-list,
.quiz-list,
.material-grid {
  display: grid;
  gap: 12px;
}

.session-card,
.quiz-card,
.invoice-card {
  padding: 15px;
}

.session-card header,
.invoice-card header,
.quiz-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.chapter {
  padding: 14px;
  border: 1px solid rgba(5, 166, 200, 0.14);
  border-radius: 12px;
  background: var(--surface-soft);
}

.chapter + .chapter {
  margin-top: 10px;
}

.material-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.material-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(5, 166, 200, 0.14);
  border-radius: 12px;
  background: #fff;
}

.material-card h3 {
  display: -webkit-box;
  margin: 6px 0 4px;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.material-card .meta {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.material-card .row-actions {
  gap: 6px;
  flex-wrap: wrap;
}

.material-card .ghost-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.material-thumb {
  display: grid;
  aspect-ratio: 16 / 9;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(5, 166, 200, 0.11), rgba(140, 198, 63, 0.14));
  color: var(--cyan-dark);
}

.material-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.peserta-material-thumb img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.material-thumb i {
  width: 28px;
  height: 28px;
}

.answer-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.answer-option {
  display: flex !important;
  gap: 10px !important;
  align-items: center;
  padding: 11px;
  border: 1px solid rgba(5, 166, 200, 0.14);
  border-radius: 12px;
  background: #fff;
}

.token-box {
  display: grid;
  min-height: 230px;
  place-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px dashed rgba(5, 166, 200, 0.34);
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(5, 166, 200, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(5, 166, 200, 0.07) 1px, transparent 1px);
  background-size: 18px 18px;
}

.qr-image {
  width: min(230px, 100%);
  height: auto;
  padding: 10px;
  border: 1px solid rgba(5, 166, 200, 0.16);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(3, 42, 58, 0.12);
}

.token-code {
  padding: 7px 10px;
  border-radius: 10px;
  background: #07131d;
  color: #fff;
  font-weight: 900;
  letter-spacing: 2px;
}

.qr-reader {
  overflow: hidden;
  border: 1px solid rgba(5, 166, 200, 0.16);
  border-radius: 14px;
  background: #fff;
}

.qr-reader video {
  border-radius: 14px;
}

.qr-reader button,
.qr-reader select {
  min-height: 38px;
  margin: 6px;
  padding: 0 12px;
  border: 1px solid rgba(5, 166, 200, 0.18);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.scan-frame {
  position: relative;
  display: grid;
  min-height: 250px;
  place-items: center;
  overflow: hidden;
  border-radius: 14px;
  background: #07131d;
  color: #fff;
}

.scan-frame::before {
  content: "";
  position: absolute;
  inset: 38px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 14px;
}

.scan-line {
  position: absolute;
  left: 54px;
  right: 54px;
  height: 3px;
  background: var(--lime);
  animation: scan 2.4s ease-in-out infinite;
}

@keyframes scan {
  0%,
  100% {
    top: 64px;
  }
  50% {
    top: calc(100% - 70px);
  }
}

.profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background:
    linear-gradient(135deg, rgba(5, 166, 200, 0.12), rgba(140, 198, 63, 0.14)),
    rgba(255, 255, 255, 0.95);
}

.profile-avatar {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--cyan), var(--lime));
  color: #fff;
  font-size: 24px;
  font-weight: 900;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 40px));
  padding: 14px 16px;
  border-radius: 12px;
  background: #07131d;
  color: #fff;
  box-shadow: var(--shadow);
}

/* Responsive */
@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout-2,
  .material-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 761px) {
  .mobile-menu-button,
  .sidebar-close {
    display: none !important;
  }
}

@media (max-width: 760px) {
  body {
    overflow-x: hidden;
  }

  body.sidebar-open {
    overflow: hidden;
  }

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

  .auth-hero {
    min-height: 360px;
    padding: 24px;
  }

  .auth-hero h1 {
    font-size: 38px;
  }

  .auth-panel {
    padding: 18px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(86vw, 318px);
    height: 100vh;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    -webkit-overflow-scrolling: touch;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: none;
    background: rgba(2, 8, 23, 0.58);
    backdrop-filter: blur(5px);
  }

  body.sidebar-open .mobile-backdrop {
    display: block;
  }

  .sidebar-close,
  .mobile-menu-button {
    display: grid !important;
  }

  .sidebar-head {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -18px -14px 16px;
    padding: 18px 14px 12px;
    background: linear-gradient(180deg, rgba(4, 21, 33, 0.99), rgba(4, 21, 33, 0.88));
    backdrop-filter: blur(12px);
  }

  .sidebar-close {
    width: 38px;
    min-width: 38px;
    height: 38px;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
  }

  .nav-item {
    min-height: 50px;
    padding: 13px 14px;
    font-size: 15px;
  }

  .main-panel {
    min-height: 100vh;
    padding: 12px;
    background-size: 118vw auto;
  }

  .topbar {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-radius: 14px;
  }

  .mobile-menu-button {
    grid-column: 1;
    grid-row: 1;
  }

  .topbar-title {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
  }

  .topbar-title h1 {
    font-size: 23px;
  }

  .eyebrow {
    font-size: 11px;
  }

  .top-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 42px 42px minmax(0, 1fr);
    width: 100%;
    gap: 8px;
  }

  .top-actions .icon-button {
    width: 42px;
    height: 42px;
  }

  .profile-chip {
    min-width: 0;
    width: 100%;
    padding: 5px 8px 5px 5px;
  }

  .profile-chip > span {
    width: 32px;
    height: 32px;
  }

  .profile-avatar-img {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  .profile-chip strong,
  .profile-chip small {
    max-width: 100%;
  }

  .content {
    gap: 12px;
  }

  .panel,
  .table-panel {
    padding: 14px;
  }

  .panel-header,
  .session-card header,
  .invoice-card header,
  .quiz-card header {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats-grid,
  .form-grid,
  .material-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 14px;
  }

  .profile-hero {
    align-items: flex-start;
    flex-direction: column;
  }
}
