:root {
  --primary: #071b3a;
  --secondary: #0e4f99;
  --accent: #12c2e9;
  --accent2: #f6b93b;
  --bg: #eef5ff;
  --card: #ffffff;
  --text: #14213d;
  --muted: #637083;
  --danger: #e63946;
  --warning: #f59f00;
  --success: #2a9d8f;
  --purple: #6c5ce7;
  --shadow: 0 18px 45px rgba(7, 27, 58, 0.12);
  --radius: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(135deg, #eef5ff 0%, #f8fbff 48%, #e6f7ff 100%);
  color: var(--text);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; }
.hidden { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 5%;
  background: rgba(7, 27, 58, 0.97);
  color: #fff;
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.22);
}
.brand h1 { margin: 0; font-size: 24px; letter-spacing: 0.5px; }
.brand p { margin: 2px 0 0; font-size: 12px; color: rgba(255,255,255,0.78); }

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav a, .logout-btn {
  color: #fff;
  text-decoration: none;
  padding: 9px 13px;
  border-radius: 999px;
  background: transparent;
  transition: 0.2s ease;
  font-size: 14px;
}
.nav a:hover, .nav a.active, .logout-btn:hover { background: rgba(255,255,255,0.16); }
.logout-btn { border: 1px solid rgba(255,255,255,0.25); }
.menu-btn {
  display: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 24px;
}

main { min-height: calc(100vh - 142px); }
.page { display: none; padding: 42px 5%; animation: fadeIn 0.25s ease; }
.active-page { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.hero-section {
  display: none;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 28px;
  align-items: stretch;
}
.hero-section.active-page { display: grid; }
.hero-card, .hero-panel, .form-card, .panel, .login-card, .editor-panel, .json-panel, .welcome-card {
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(14,79,153,0.10);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.hero-card {
  padding: 44px;
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -120px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(18,194,233,0.18), transparent 70%);
}
.badge {
  display: inline-flex;
  background: rgba(246,185,59,0.18);
  color: #8a5700;
  border: 1px solid rgba(246,185,59,0.45);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
}
.hero-card h2 { font-size: clamp(32px, 4.2vw, 58px); line-height: 1.03; margin: 18px 0 14px; color: var(--primary); }
.lead { font-size: 18px; color: var(--muted); max-width: 780px; line-height: 1.65; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0; }
.student-box {
  position: relative;
  z-index: 1;
  background: linear-gradient(135deg, rgba(7,27,58,0.94), rgba(14,79,153,0.94));
  color: #fff;
  padding: 18px;
  border-radius: 16px;
  line-height: 1.8;
  max-width: 560px;
}
.hero-panel { padding: 26px; position: relative; overflow: hidden; min-height: 420px; }
.security-orbit {
  min-height: 270px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, #dff9ff 0, #f3fbff 48%, #ffffff 100%);
  position: relative;
  margin-bottom: 18px;
}
.security-orbit span { position: absolute; font-size: 34px; filter: drop-shadow(0 8px 10px rgba(0,0,0,0.12)); }
.security-orbit .shield { position: static; font-size: 86px; }
.security-orbit span:nth-child(2) { top: 36px; left: 34px; }
.security-orbit span:nth-child(3) { top: 40px; right: 40px; }
.security-orbit span:nth-child(4) { bottom: 35px; left: 60px; }
.security-orbit span:nth-child(5) { bottom: 36px; right: 66px; }
.risk-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 18px;
  border-radius: 18px;
  color: #fff;
}
.risk-card p { margin: 0; }
.risk-card strong { font-size: 38px; }
.risk-card.high { background: linear-gradient(135deg, #c92a2a, #ff6b6b); }
.risk-card.medium { background: linear-gradient(135deg, #0e4f99, #12c2e9); }

.section-heading { text-align: center; max-width: 850px; margin: 0 auto 28px; }
.section-heading span, .small-label {
  color: var(--secondary);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 12px;
}
.section-heading h2 { font-size: clamp(28px, 3vw, 42px); margin: 8px 0 8px; color: var(--primary); }
.section-heading p { color: var(--muted); line-height: 1.6; margin: 0; }

.primary-btn, .secondary-btn, .danger-btn, .success-btn {
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 800;
  transition: 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.primary-btn { color: #fff; background: linear-gradient(135deg, var(--secondary), var(--accent)); box-shadow: 0 10px 20px rgba(14,79,153,0.20); }
.secondary-btn { color: var(--primary); background: #eef5ff; border: 1px solid #cfe0f5; }
.danger-btn { color: #fff; background: linear-gradient(135deg, #d90429, #ef476f); }
.success-btn { color: #fff; background: linear-gradient(135deg, #11856f, #2a9d8f); }
.primary-btn:hover, .secondary-btn:hover, .danger-btn:hover, .success-btn:hover { transform: translateY(-1px); filter: brightness(1.02); }
.full-btn { width: 100%; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; background: #eef5ff; color: var(--primary); font-size: 22px; }

.welcome-card {
  padding: 20px 22px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.welcome-card h3 { margin: 6px 0; }
.welcome-card p { margin: 0; color: var(--muted); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.stat-card { background: #fff; padding: 24px; border-radius: 20px; box-shadow: var(--shadow); border-top: 5px solid var(--secondary); }
.stat-card span { color: var(--muted); font-weight: 700; }
.stat-card strong { display: block; font-size: 42px; color: var(--primary); margin: 8px 0; }
.stat-card p { margin: 0; color: var(--muted); }
.stat-card.warning { border-top-color: var(--warning); }
.stat-card.danger { border-top-color: var(--danger); }
.stat-card.success { border-top-color: var(--success); }

.dashboard-grid, .two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.panel { padding: 24px; }
.panel h3, .form-card h3, .json-panel h3 { margin-top: 0; color: var(--primary); }
.wide-panel { grid-column: span 2; }
.bar-list { display: grid; gap: 15px; }
.bar-top { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; margin-bottom: 6px; }
.bar-track { height: 13px; border-radius: 999px; background: #e3edf9; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--secondary), var(--accent)); min-width: 3px; }
.checklist { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.9; }

.form-card { padding: 26px; }
.compact-card { align-self: start; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
label { display: grid; gap: 7px; margin-bottom: 14px; font-weight: 700; color: var(--primary); }
input, select, textarea {
  width: 100%;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid #ccd8e8;
  background: #fbfdff;
  color: var(--text);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(18,194,233,0.13); }
textarea { resize: vertical; min-height: 110px; }
.form-actions, .mini-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.form-message { min-height: 21px; color: var(--success); font-weight: 800; }

.tools-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}
.tools-row input { min-width: 260px; flex: 1; }
.tools-row select { width: auto; min-width: 150px; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 18px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 850px; }
th, td { text-align: left; padding: 14px 15px; border-bottom: 1px solid #e6edf7; vertical-align: top; }
th { background: #f2f7ff; color: var(--primary); font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; }
td { color: #26344d; }
.table-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.table-actions button { padding: 8px 10px; border-radius: 10px; font-size: 13px; font-weight: 800; }
.edit-btn { background: #eef5ff; color: var(--secondary); border: 1px solid #cfe0f5; }
.delete-btn, .disable-btn { background: #fff0f1; color: #d90429; border: 1px solid #ffd1d6; }
.enable-btn { background: #e9fbf6; color: #0b7f69; border: 1px solid #c8f2e5; }
.pill {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.pill.Low { background: #e9fbf6; color: #0b7f69; }
.pill.Medium { background: #fff8e6; color: #8a5700; }
.pill.High { background: #fff0f1; color: #c92a2a; }
.pill.Critical { background: #f2e8ff; color: #5f27cd; }
.pill.Pending { background: #fff8e6; color: #8a5700; }
.pill.UnderReview { background: #eef5ff; color: #0e4f99; }
.pill.Escalated { background: #fff0f1; color: #c92a2a; }
.pill.Resolved, .pill.Closed, .pill.Active { background: #e9fbf6; color: #0b7f69; }
.pill.Disabled { background: #f0f2f5; color: #637083; }

.editor-panel { padding: 24px; margin-bottom: 20px; border-left: 6px solid var(--accent); }
.editor-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.editor-header h3 { margin: 4px 0 0; }
.json-panel { padding: 22px; margin-top: 22px; }
.json-panel textarea { font-family: Consolas, Monaco, monospace; font-size: 13px; min-height: 210px; background: #071b3a; color: #dff9ff; border: none; }
.import-label { margin-top: 18px; }

.policy-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.policy-card {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid #e3edf9;
}
.policy-card h3 { color: var(--primary); margin-top: 0; }
.policy-card p { color: var(--muted); line-height: 1.65; }

.login-wrapper { min-height: 60vh; display: grid; place-items: center; }
.login-card { width: min(100%, 440px); padding: 30px; }
.login-card h2 { margin: 0 0 8px; color: var(--primary); }
.login-card p { color: var(--muted); }
.demo-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 14px;
  background: #f2f7ff;
  color: var(--text);
  line-height: 1.75;
  font-size: 14px;
}
code { background: #e7effb; border-radius: 6px; padding: 2px 6px; color: var(--secondary); font-weight: 800; }

.profile-details { line-height: 1.9; color: var(--muted); }
.profile-details strong { color: var(--primary); }
.users-panel .table-wrap, .small-table { box-shadow: none; border: 1px solid #e6edf7; }
.users-panel table { min-width: 620px; }

.footer {
  text-align: center;
  padding: 22px 5%;
  background: var(--primary);
  color: rgba(255,255,255,0.78);
  font-size: 14px;
}

@media (max-width: 1050px) {
  .topbar { align-items: flex-start; }
  .menu-btn { display: block; margin-top: 2px; }
  .nav {
    position: absolute;
    left: 5%;
    right: 5%;
    top: 82px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    background: #071b3a;
    border-radius: 18px;
    padding: 12px;
    box-shadow: var(--shadow);
  }
  .nav.open { display: flex; }
  .nav a, .logout-btn { display: block; text-align: left; width: 100%; }
  .hero-section.active-page { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .policy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .topbar { padding: 12px 4%; }
  .brand-icon { width: 42px; height: 42px; }
  .brand h1 { font-size: 20px; }
  .brand p { display: none; }
  .page { padding: 30px 4%; }
  .hero-card, .form-card, .panel, .login-card, .editor-panel, .json-panel, .welcome-card { padding: 20px; }
  .hero-actions, .welcome-card, .editor-header { align-items: stretch; flex-direction: column; }
  .stats-grid, .dashboard-grid, .policy-grid, .form-grid, .two-column { grid-template-columns: 1fr; }
  .wide-panel { grid-column: auto; }
  .security-orbit { min-height: 230px; }
  .security-orbit .shield { font-size: 62px; }
  .security-orbit span { font-size: 28px; }
  .tools-row { align-items: stretch; }
  .tools-row input, .tools-row select, .tools-row button { width: 100%; min-width: 0; }
  table { min-width: 760px; }
}
