:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #d6dde8;
  --text: #111827;
  --muted: #64748b;
  --primary: #1f5fd6;
  --primary-dark: #173f91;
  --success: #15803d;
  --warning: #b45309;
  --danger: #b91c1c;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

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

button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary-dark);
}

.secondary {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}

.ghost {
  color: var(--primary-dark);
  background: #edf4ff;
  border-color: #bfdbfe;
}

.danger {
  color: #fff;
  background: var(--danger);
  border-color: #7f1d1d;
}

.full {
  width: 100%;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(520px, 760px) minmax(280px, 420px);
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 36px clamp(28px, 6vw, 80px);
  background:
    linear-gradient(90deg, rgba(8, 15, 32, 0.78), rgba(8, 15, 32, 0.34) 48%, rgba(244, 246, 250, 0.88)),
    url("assets/club-campus-bg.png") center / cover no-repeat,
    var(--bg);
}

.login-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(218, 226, 236, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
  backdrop-filter: blur(4px);
}

.login-aside {
  color: #ffffff;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(10px);
}

.login-aside h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

.login-aside p {
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.6;
}

.feature-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.feature-list span {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.10);
  font-weight: 800;
}

.brand-row,
.brand-compact {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: white;
  background: #1e3a8a;
  border: 3px solid #40c4aa;
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.bdic-logo {
  width: min(240px, 32vw);
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-row h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.15;
  letter-spacing: 0;
}

.brand-row p,
.brand-compact span,
.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.role-description {
  color: #334155;
  font-weight: 700;
}

.login-form {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 18px 22px;
  margin-top: 28px;
  align-items: center;
}

.login-form label {
  display: contents;
}

.login-form span {
  font-weight: 700;
  font-size: 16px;
}

.login-form input,
.login-form select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 12px;
  background: #fff;
}

.login-form button {
  grid-column: 2;
  height: 46px;
}

.quick-section {
  margin-top: 18px;
}

.name-reference {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.name-reference select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
}

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

.quick-users {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.quick-users button {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line);
}

#reset-demo {
  margin-top: 12px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  background: var(--bg);
}

.app-shell.role-student {
  --role: #1f5fd6;
  --role-soft: #eaf2ff;
}

.app-shell.role-teacher {
  --role: #0f766e;
  --role-soft: #e6f7f4;
}

.app-shell.role-admin {
  --role: #7c3aed;
  --role-soft: #f1ebff;
}

.sidebar {
  background: #0f172a;
  color: #e5eefb;
  padding: 18px 14px;
  box-shadow: 12px 0 30px rgba(15, 23, 42, 0.12);
}

.brand-compact {
  padding: 6px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-compact strong {
  display: block;
  font-size: 16px;
}

.sidebar-logo {
  width: 72px;
  height: auto;
  padding: 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
}

.brand-compact span {
  display: block;
  color: #9fb1ca;
  font-size: 12px;
}

#side-nav {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

#side-nav button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  color: #dbeafe;
  background: transparent;
  border-color: transparent;
  border-radius: 5px;
  padding: 0 12px;
}

#side-nav button.active {
  color: white;
  background: var(--role);
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  background:
    linear-gradient(180deg, var(--role-soft), rgba(244, 246, 250, 0) 260px),
    var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.topbar h2 {
  margin: 0;
  font-size: 23px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.content {
  min-width: 0;
  padding: 18px 22px 28px;
}

.panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.panel-header h3 {
  margin: 0;
  font-size: 17px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
}

.mobile-card-list {
  display: none;
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #e7edf4;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #26354d;
  background: #f3f6fa;
  font-weight: 800;
}

tr.selected td {
  background: #dbeafe;
}

.mobile-record-card.selected {
  border-color: var(--role);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--role), transparent 72%);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: #e2e8f0;
}

.badge.active,
.badge.open,
.badge.registered,
.badge.joined {
  color: var(--success);
  background: #dcfce7;
}

.badge.not-joined,
.badge.not-registered {
  color: var(--muted);
  background: #e2e8f0;
}

.badge.planned,
.badge.inactive {
  color: var(--warning);
  background: #fef3c7;
}

.badge.dissolved,
.badge.left,
.badge.cancelled {
  color: var(--danger);
  background: #fee2e2;
}

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

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.stat strong {
  display: block;
  color: var(--role);
  font-size: 24px;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
  z-index: 10;
}

.modal {
  width: min(460px, 100%);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 18px;
}

.modal h3 {
  margin: 0 0 14px;
}

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

.modal-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.modal-form input,
.modal-form select,
.modal-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.empty {
  padding: 24px;
  color: var(--muted);
}

#toast-root {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 30;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  padding: 13px 15px;
  border: 1px solid #bbf7d0;
  border-left: 5px solid var(--success);
  border-radius: 8px;
  color: #14532d;
  background: rgba(240, 253, 244, 0.96);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  font-weight: 800;
}

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

  .login-aside {
    display: none;
  }

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

  .sidebar {
    position: static;
  }

  #side-nav {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions button {
    flex: 1;
  }

  .content {
    padding: 14px;
  }

  .table-wrap {
    display: none;
  }

  .mobile-card-list {
    display: grid;
    gap: 12px;
    padding: 12px;
  }

  .mobile-record-card {
    display: grid;
    gap: 9px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
  }

  .mobile-record-card div {
    display: grid;
    grid-template-columns: 118px 1fr;
    gap: 10px;
    align-items: start;
  }

  .mobile-record-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .mobile-record-card strong {
    min-width: 0;
    color: var(--text);
    font-weight: 700;
    overflow-wrap: anywhere;
  }

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

  .login-form label {
    display: grid;
    gap: 8px;
  }

  .login-form button {
    grid-column: 1;
  }

  .quick-users,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
