:root {
  color-scheme: light;
  --bg: #fff7fb;
  --panel: #ffffff;
  --panel-2: #fff0f6;
  --border: rgba(227, 90, 153, 0.18);
  --text: #27131f;
  --muted: #6e5663;
  --gold: #d98b2b;
  --gold-2: #cc4f8c;
  --pink: rgb(244, 90, 168);
  --success: #2e9f7c;
  --danger: #cf4f65;
  --shadow: 0 18px 60px rgba(94, 20, 56, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #14181f;
  --panel-2: #10141a;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8edf4;
  --muted: #96a0af;
  --gold: #d4af37;
  --gold-2: #f1d39a;
  --pink: rgb(244, 90, 168);
  --success: #7dcfb6;
  --danger: #ff7b7b;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(244, 90, 168, 0.22), transparent 22%),
    radial-gradient(circle at top right, rgba(227, 90, 153, 0.16), transparent 20%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

#app {
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.shell {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  padding: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.64));
  border-right: 1px solid var(--border);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand {
  display: grid;
  gap: 6px;
  margin-bottom: 24px;
}

.brand__kicker {
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-2);
}

.brand__title {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.1;
}

.brand__subtitle {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav button {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  text-align: left;
  transition: 160ms ease;
}

.nav button:hover,
.nav button.is-active {
  background: rgba(244, 90, 168, 0.12);
  border-color: rgba(244, 90, 168, 0.32);
  color: var(--text);
}

.sidebar__footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 12px;
  flex-shrink: 0;
}

.sidebar__footer .btn {
  width: 100%;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.main {
  padding: 28px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar__title {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
}

.topbar__meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.96rem;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 14px;
  background: var(--panel);
  color: var(--text);
  transition: 160ms ease;
}

.btn:hover {
  border-color: rgba(244, 90, 168, 0.32);
  transform: translateY(-1px);
}

.btn--gold {
  background: linear-gradient(135deg, rgba(244, 90, 168, 0.96), rgba(227, 90, 153, 0.72));
  color: #fff;
  border-color: transparent;
  font-weight: 700;
}

.btn--ghost {
  background: transparent;
}

.grid {
  display: grid;
  gap: 18px;
  min-width: 0;
  max-width: 100%;
}

.grid--cards {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

.grid--split {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: start;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 248, 251, 0.96));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: visible;
  min-width: 0;
  max-width: 100%;
  animation: rise 220ms ease;
}

.card__body {
  padding: 20px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.card__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 18px 20px 0;
  flex-wrap: wrap;
  min-width: 0;
}

.card__title {
  margin: 0;
  font-size: 1.05rem;
}

.card__subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.stat {
  display: grid;
  gap: 6px;
  min-height: 132px;
}

.stat__label {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat__value {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  font-weight: 800;
}

.stat__hint {
  color: var(--muted);
  font-size: 0.92rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  border: 1px solid rgba(244, 90, 168, 0.22);
  background: rgba(244, 90, 168, 0.08);
  color: var(--gold-2);
}

.badge--muted {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.form {
  display: grid;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

.form--compact {
  gap: 10px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.field label {
  font-size: 0.9rem;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-2);
  color: var(--text);
  padding: 12px 14px;
  box-sizing: border-box;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.helper {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.table th,
.table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.table th {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.table td {
  font-size: 0.94rem;
}

.table tr:hover td {
  background: rgba(244, 90, 168, 0.04);
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.list {
  display: grid;
  gap: 10px;
}

.list__item {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 6px;
}

.list__title {
  font-weight: 650;
}

.list__meta,
.muted {
  color: var(--muted);
}

.split {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.course-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.course-tabs button {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
}

.course-tabs button.is-active {
  background: rgba(244, 90, 168, 0.16);
  border-color: rgba(244, 90, 168, 0.4);
  color: var(--text);
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login__panel {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
}

.login__hero,
.login__form {
  border-radius: 24px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 247, 251, 0.96));
  box-shadow: var(--shadow);
}

.login__hero {
  padding: 28px;
  display: grid;
  align-content: space-between;
  gap: 18px;
}

.login__form {
  padding: 28px;
}

.login__title {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.05;
}

.login__copy {
  color: var(--muted);
  max-width: 56ch;
  line-height: 1.6;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.kpi {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
}

.kpi strong {
  display: block;
  font-size: 1.35rem;
  margin-bottom: 6px;
}

.notice {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(244, 90, 168, 0.28);
  background: rgba(244, 90, 168, 0.08);
  color: var(--text);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 40px));
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(244, 90, 168, 0.28);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  color: var(--text);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(244, 90, 168, 0.22);
  background: linear-gradient(180deg, rgba(244, 90, 168, 0.12), rgba(227, 90, 153, 0.08));
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.85),
    inset -1px -1px 0 rgba(82, 23, 51, 0.08),
    0 14px 30px rgba(94, 20, 56, 0.12);
}

.brand-mark--beveled {
  border-radius: 20px;
  clip-path: polygon(7% 0, 93% 0, 100% 7%, 100% 93%, 93% 100%, 7% 100%, 0 93%, 0 7%);
}

.student-photo-preview,
.student-mini-photo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(244, 90, 168, 0.22);
  background: linear-gradient(180deg, rgba(244, 90, 168, 0.08), rgba(255, 255, 255, 0.8));
}

.student-photo-preview {
  min-height: 150px;
}

.student-mini-photo {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}

.student-photo-preview img,
.student-mini-photo img,
.camera-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.student-mini-photo img {
  border-radius: inherit;
}

.camera-preview {
  margin-top: 12px;
  min-height: 180px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #000;
}

.camera-controls {
  margin-top: 4px;
}

.overview-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  flex: 1 1 360px;
  min-width: 0;
}

.overview-brand .brand-mark {
  flex: 0 0 auto;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-mark--png {
  background: #000;
}

.lucide-icon {
  flex: 0 0 auto;
  stroke-width: 2;
}

.section-title {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-2);
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.toolbar .field,
.toolbar .search-field {
  flex: 1 1 200px;
  min-width: 0;
}

.toolbar .btn {
  flex: 0 0 auto;
}

.overview-hero {
  align-items: flex-start;
}

.overview-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  flex: 1 1 360px;
  min-width: 0;
}

.search-field input {
  border-color: rgba(244, 90, 168, 0.22);
}

.search-field input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 1px solid rgba(244, 90, 168, 0.4);
  border-color: rgba(244, 90, 168, 0.45);
}

.card--soft {
  background: linear-gradient(180deg, rgba(244, 90, 168, 0.05), rgba(255, 255, 255, 0.96));
}

.theme-toggle {
  width: 100%;
}

.table-editor input,
.table-editor select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.table-editor__row--pending td {
  background: rgba(255, 123, 123, 0.12) !important;
}

.table-editor__row--pending input {
  border-color: rgba(255, 123, 123, 0.45);
}

.table--tight th,
.table--tight td {
  padding: 10px 8px;
}

.autocomplete-field {
  min-width: 0;
  max-width: 100%;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--gold-2);
  padding: 0;
}

.split--top {
  align-items: start;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1280px) {
  .grid--split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1120px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }

  .sidebar__footer {
    margin-top: 24px;
  }

  .login__panel,
  .grid--split,
  .grid--cards,
  .kpi-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main,
  .sidebar,
  .login__hero,
  .login__form {
    padding: 18px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .actions {
    width: 100%;
  }

  .actions .btn {
    flex: 1 1 auto;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .table-scroll,
  .card__body {
    overflow-x: auto;
  }

  .table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  .toolbar .btn {
    flex: 1 1 auto;
  }

  .nav button,
  .sidebar__footer .btn {
    min-height: 44px;
  }
}
