* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  background: #F4F5F7;
  color: #131826;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #17080F;
  padding: 1.5rem;
}
.login-screen[hidden] { display: none; }

.login-shell {
  display: flex;
  width: 100%;
  max-width: 920px;
  min-height: 560px;
  background: #fff;
  border-radius: 1.6rem;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}

.login-brand {
  position: relative;
  flex: 1 1 42%;
  padding: 2.6rem 2.2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background: linear-gradient(155deg, #E85D8A 0%, #B23A63 45%, #1B0B14 100%);
  overflow: hidden;
}
.login-brand::before,
.login-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
}
.login-brand::before { width: 16rem; height: 16rem; top: -6rem; right: -5rem; }
.login-brand::after { width: 10rem; height: 10rem; bottom: -3rem; left: -3rem; background: rgba(255,255,255,0.08); }

.login-brand-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 1rem;
  background: rgba(255,255,255,0.16);
  font-size: 1.6rem;
}

.login-brand h1 {
  position: relative;
  font-size: 1.7rem;
  line-height: 1.2;
  margin: 1.2rem 0 0.3rem 0;
}
.login-brand-sub {
  position: relative;
  margin: 0;
  color: rgba(255,255,255,0.85);
  font-size: 0.95rem;
}

.login-brand-list {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.login-brand-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.92);
}
.login-brand-list .ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 0.5rem;
  background: rgba(255,255,255,0.14);
  font-size: 0.95rem;
  flex: none;
}

.login-panel {
  flex: 1 1 58%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.6rem 2.4rem;
  background: #fff;
}

.login-card {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.login-card-head h2 { margin: 0 0 0.2rem 0; font-size: 1.4rem; }
.login-card-head p { margin: 0 0 0.4rem 0; font-size: 0.88rem; color: #6B7280; }

.login-field { display: flex; flex-direction: column; gap: 0.35rem; }
.login-field-label { font-size: 0.78rem; font-weight: 600; color: #4B5563; text-transform: uppercase; letter-spacing: 0.03em; }
.login-field input,
.login-field select {
  padding: 0.75rem 0.9rem;
  border: 1.5px solid #E2E5EA;
  border-radius: 0.7rem;
  font-size: 0.98rem;
  background: #F8F9FB;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.login-field input:focus,
.login-field select:focus {
  outline: none;
  border-color: #E85D8A;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(232,93,138,0.15);
}

.login-submit {
  border: none;
  border-radius: 0.7rem;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #E85D8A, #B23A63);
  box-shadow: 0 10px 24px rgba(232,93,138,0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.login-submit:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(232,93,138,0.4); }
.login-submit:active { transform: translateY(0); }

.login-back {
  align-self: center;
  font-size: 0.82rem;
  color: #9CA3AF;
  text-decoration: none;
  margin-top: -0.2rem;
}
.login-back:hover { color: #6B7280; text-decoration: underline; }

@media (max-width: 760px) {
  .login-shell { flex-direction: column; max-width: 420px; min-height: 0; }
  .login-brand { padding: 2rem 1.8rem; }
  .login-brand-list { display: none; }
  .login-panel { padding: 2rem 1.8rem; }
}

.error-text { color: #C0263B; font-size: 0.9rem; margin: 0; }

.btn {
  border: none;
  border-radius: 0.5rem;
  padding: 0.65rem 1.1rem;
  font-size: 0.95rem;
  cursor: pointer;
}
.btn-primary { background: #131826; color: #fff; }
.btn-primary:hover { background: #232B3D; }
.btn-ghost { background: transparent; color: #6B7280; border: 1px solid #D7DAE1; }
.btn-ghost:hover { background: #EEF0F3; }
.btn-danger { background: #FBE7EA; color: #C0263B; }
.btn-danger:hover { background: #F6CED4; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.6rem;
  background: #1B0B14;
  color: #fff;
}
.topbar h1 { font-size: 1.15rem; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 0.9rem; }
.current-user-label { font-size: 0.8rem; color: #D8AEC0; white-space: nowrap; }

.weak-secret-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.6rem;
  background: #FBE7EA;
  color: #7A1626;
  border-bottom: 1px solid #F0B9C2;
}
.weak-secret-banner[hidden] { display: none; }
.weak-secret-banner p { margin: 0.15rem 0; font-size: 0.85rem; }
.weak-secret-banner .btn { flex-shrink: 0; }

.status-pill {
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: #2A3244;
  color: #AEB6C4;
}
.status-pill.ok { background: #123B2E; color: #4ADE80; }
.status-pill.error { background: #3B1220; color: #F87171; }
.status-pill.inactive { background: #2A2A2E; color: #9CA3AF; }

main { padding: 1.6rem; max-width: 1200px; margin: 0 auto; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.panel-header h2 { font-size: 1.1rem; margin: 0; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}

.card {
  background: #fff;
  border: 1px solid #E2E5EA;
  border-radius: 0.9rem;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.card.inactive-school { opacity: 0.55; }

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.card-title-row h3 { margin: 0; font-size: 1.1rem; }
.card-key { font-family: monospace; font-size: 0.8rem; color: #6B7280; }

.stat-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: #374151;
}
.stat-row strong { color: #131826; }

.field-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.field-row input {
  flex: 1;
  min-width: 12rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid #D7DAE1;
  border-radius: 0.4rem;
  font-size: 0.88rem;
}

.card-actions { display: flex; gap: 0.5rem; margin-top: 0.3rem; flex-wrap: wrap; }

.field-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: #374151;
}
.field-label input, .field-label select {
  padding: 0.6rem 0.7rem;
  border: 1px solid #D7DAE1;
  border-radius: 0.5rem;
  font-size: 0.95rem;
}
.field-hint { font-size: 0.78rem; color: #9CA3AF; margin: -0.3rem 0 0 0; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 14, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 200;
}
.modal-overlay[hidden] { display: none; }

.modal-card {
  background: #fff;
  border-radius: 1rem;
  padding: 1.6rem;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
.modal-card h3 { margin: 0; font-size: 1.15rem; }
.modal-card hr { border: none; border-top: 1px solid #E2E5EA; margin: 0.3rem 0; }
.modal-actions { display: flex; gap: 0.5rem; margin-top: 0.2rem; }
.modal-actions .btn { flex: 1; }
