:root {
  --navy: #0a3f78;
  --blue: #0e5aa7;
  --gold: #ffb01f;
  --bg: #edf6ff;
  --text: #102b47;
  --muted: #61788d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 6vw;
  background: var(--navy);
  color: white;
}

.brand {
  font-weight: 900;
  letter-spacing: .04em;
}

.brand b { color: var(--gold); }

nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

a, button { font: inherit; }

.nav-btn, .primary-btn, .secondary-btn {
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 800;
  cursor: pointer;
}

.nav-btn {
  border: 1px solid rgba(255,255,255,.45);
  color: white;
  background: transparent;
  text-decoration: none;
}

.primary-btn {
  border: 2px solid #ffd16b;
  background: var(--gold);
  color: #132d49;
}

.secondary-btn {
  border: 1px solid #aac7dd;
  background: white;
  color: var(--navy);
}

.container {
  width: min(1120px, 92vw);
  margin: 34px auto;
}

.hero {
  padding: 48px;
  border-radius: 28px;
  background: linear-gradient(135deg, #07376f, #0d5aa5);
  color: white;
  box-shadow: 0 22px 60px rgba(8,55,103,.18);
}

.hero h1 {
  font-size: clamp(2.3rem, 7vw, 5rem);
  margin: 0;
}

.hero .expert { color: var(--gold); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.card {
  background: white;
  border: 1px solid #cadce9;
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 12px 32px rgba(15,65,110,.08);
}

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

@media (max-width: 700px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .hero { padding: 28px; }
}


.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 11px 6px 7px;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 999px;
  color: white;
  text-decoration: none;
  font-size: .78rem;
  font-weight: 800;
}
.user-chip img, .avatar-placeholder {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: #dbeeff;
  color: var(--navy);
  font-weight: 900;
}
.profile-layout { display:grid; grid-template-columns: 220px 1fr; gap:24px; }
.profile-avatar-card { text-align:center; }
.profile-avatar-large {
  width: 150px; height: 150px; border-radius:50%; object-fit:cover;
  border:4px solid var(--gold); background:#dcecff;
}
.readonly-field { background:#edf3f8; color:#60778b; cursor:not-allowed; }
.status-box { margin-top:14px; padding:12px 14px; border-radius:12px; font-weight:800; display:none; }
.status-box.show { display:block; }
.status-box.success { background:#edf9f1; color:#176a3f; border:1px solid #93d0ab; }
.status-box.error { background:#fff0f0; color:#b5202e; border:1px solid #e3abb1; }
@media(max-width:760px){ .profile-layout{grid-template-columns:1fr;} }

/* Phase 1.2 admin dashboard */
.admin-hero{display:flex;align-items:center;justify-content:space-between;gap:24px;background:linear-gradient(135deg,#fff,#eef7ff)}
.admin-hero h1{margin:.25rem 0 .5rem;font-size:clamp(2rem,5vw,3.5rem)}
.admin-kicker{font-size:.78rem;font-weight:900;letter-spacing:.15em;color:var(--blue)}
.admin-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:18px 0}
.stat-card{background:#fff;border:1px solid #cadce9;border-radius:18px;padding:18px;box-shadow:0 8px 24px rgba(15,65,110,.06)}
.stat-card span{display:block;color:var(--muted);font-weight:800;font-size:.82rem}.stat-card strong{display:block;font-size:2rem;margin-top:5px;color:var(--navy)}
.admin-toolbar{display:grid;grid-template-columns:2fr 1fr 1fr auto;gap:14px;align-items:end;margin-bottom:18px}
.admin-toolbar .field{margin:0}.admin-toolbar input,.admin-toolbar select{width:100%}
.admin-table-card{padding:0;overflow:hidden}.table-wrap{overflow:auto}.admin-table{width:100%;border-collapse:collapse;min-width:1080px}
.admin-table th,.admin-table td{padding:14px 16px;text-align:left;border-bottom:1px solid #e0ebf3;vertical-align:middle}.admin-table th{background:#f4f9fd;color:#31516d;font-size:.78rem;text-transform:uppercase;letter-spacing:.04em;position:sticky;top:0}.admin-table tbody tr:hover{background:#f9fcff}
.student-cell{display:flex;align-items:center;gap:11px}.student-cell small,.admin-table td small{display:block;color:var(--muted);margin-top:3px}.admin-avatar{width:42px;height:42px;border-radius:50%;object-fit:cover;flex:0 0 auto}.admin-avatar-fallback{display:grid;place-items:center;background:#dceeff;color:var(--navy);font-weight:900}
.role-pill,.account-pill{display:inline-flex;padding:5px 9px;border-radius:999px;font-size:.75rem;font-weight:900;text-transform:capitalize}.role-admin{background:#fff2cf;color:#7b5100}.role-student{background:#eaf3ff;color:#175389}.status-active{background:#e7f8ee;color:#176a3f}.status-suspended{background:#ffe9eb;color:#a51f2d}
.admin-actions{display:flex;flex-wrap:wrap;gap:6px}.table-btn{border:1px solid #a8c3d7;background:#fff;color:var(--navy);border-radius:9px;padding:7px 9px;font-size:.76rem;font-weight:800;cursor:pointer}.table-btn:hover{background:#edf6ff}.danger-btn{border-color:#e0a7ad;color:#a51f2d}.restore-btn{border-color:#8bc7a3;color:#176a3f}.table-btn:disabled{opacity:.45;cursor:not-allowed}.table-empty{text-align:center!important;color:var(--muted);padding:32px!important}
.student-dialog{width:min(700px,92vw);border:0;border-radius:22px;padding:26px;box-shadow:0 24px 80px rgba(0,0,0,.28)}.student-dialog::backdrop{background:rgba(5,27,50,.58)}.dialog-close{float:right;border:0;background:transparent;font-size:2rem;cursor:pointer;color:var(--muted)}.dialog-profile{display:flex;align-items:center;gap:15px;margin-bottom:20px}.dialog-profile .admin-avatar{width:64px;height:64px}.dialog-profile h2{margin:0}.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:0}.detail-grid>div{background:#f5f9fc;border-radius:12px;padding:12px}.detail-grid dt{font-size:.72rem;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);font-weight:900}.detail-grid dd{margin:5px 0 0;font-weight:800;overflow-wrap:anywhere}.detail-full{grid-column:1/-1}.mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:.8rem}
@media(max-width:900px){.admin-stats{grid-template-columns:repeat(2,1fr)}.admin-toolbar{grid-template-columns:1fr 1fr}.admin-toolbar .field:first-child{grid-column:1/-1}.admin-hero{align-items:flex-start;flex-direction:column}}
@media(max-width:560px){.admin-stats{grid-template-columns:1fr 1fr}.admin-toolbar{grid-template-columns:1fr}.admin-toolbar .field:first-child{grid-column:auto}.detail-grid{grid-template-columns:1fr}.detail-full{grid-column:auto}}


/* Phase 1.2.1 compact admin dashboard refinements */
.admin-hero{padding:24px 26px;border-radius:22px}
.admin-hero h1{font-size:clamp(1.8rem,4vw,2.8rem)}
.admin-stats{margin:16px 0;gap:12px}
.stat-card{padding:15px 16px;border-radius:16px}
.stat-card strong{font-size:1.7rem}
.admin-toolbar{padding:18px;grid-template-columns:minmax(280px,2fr) minmax(150px,.8fr) minmax(150px,.8fr) auto}
.admin-toolbar label{display:block;margin-bottom:6px;font-size:.78rem;font-weight:900;color:#31516d;text-transform:uppercase;letter-spacing:.04em}
.admin-toolbar input,.admin-toolbar select{height:44px;border:1px solid #b9cee0;border-radius:12px;padding:0 12px;background:#fff;color:var(--text);font-size:.95rem}
.admin-toolbar .secondary-btn{height:44px;padding:0 17px}
.admin-table-card{border-radius:20px}
.admin-table{min-width:980px;table-layout:fixed}
.admin-table th:nth-child(1){width:25%}.admin-table th:nth-child(2){width:20%}.admin-table th:nth-child(3){width:17%}.admin-table th:nth-child(4){width:8%}.admin-table th:nth-child(5){width:9%}.admin-table th:nth-child(6){width:11%}.admin-table th:nth-child(7){width:10%}
.admin-table th,.admin-table td{padding:11px 12px;font-size:.9rem}
.student-cell{gap:10px;min-width:0}.student-cell>div{min-width:0}.student-cell strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.student-cell small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.admin-avatar,.dialog-profile .admin-avatar{display:block;object-fit:cover;object-position:center;aspect-ratio:1/1;max-width:none!important;max-height:none!important}
.admin-avatar{width:46px!important;height:46px!important;border-radius:50%!important;border:2px solid #d6e5f1;background:#e8f2fb;cursor:pointer}
.admin-avatar-button{width:46px;height:46px;padding:0;border:0;border-radius:50%;background:transparent;display:block;flex:0 0 46px;cursor:pointer}
.admin-avatar-button:focus-visible{outline:3px solid rgba(14,90,167,.3);outline-offset:2px}
.admin-actions{display:grid;grid-template-columns:1fr;gap:5px}
.table-btn{width:100%;padding:7px 8px;border-radius:8px;font-size:.72rem;line-height:1.15}
.student-dialog{width:min(720px,94vw);padding:24px}.dialog-profile .admin-avatar{width:72px!important;height:72px!important;cursor:default}
.photo-dialog{width:min(560px,92vw);border:0;border-radius:20px;padding:18px;box-shadow:0 24px 80px rgba(0,0,0,.3)}
.photo-dialog::backdrop{background:rgba(5,27,50,.7)}
.photo-dialog img{display:block;width:100%;max-height:75vh;object-fit:contain;border-radius:14px;background:#eef5fb}
.photo-dialog-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.photo-dialog-head h3{margin:0}.photo-dialog-close{border:0;background:#edf4fa;color:var(--navy);width:36px;height:36px;border-radius:50%;font-size:1.4rem;cursor:pointer}
@media(max-width:900px){.admin-toolbar{grid-template-columns:1fr 1fr}.admin-table{min-width:900px}}

/* Phase 1.4 progress dashboard */
.progress-hero{display:flex;align-items:center;justify-content:space-between;gap:20px;background:linear-gradient(135deg,#fff,#eef7ff)}
.progress-hero h1{margin:.25rem 0 .5rem;font-size:clamp(2rem,5vw,3.4rem)}
.progress-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:18px 0 28px}
.progress-section{margin-top:28px}.section-heading{display:flex;align-items:end;justify-content:space-between;gap:16px;margin-bottom:14px}.section-heading h2{margin:0}.section-heading p{margin:.35rem 0 0}
.progress-filter{height:42px;border:1px solid #b9cee0;border-radius:12px;padding:0 12px;background:#fff;color:var(--text);font-weight:700}
.attempt-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(290px,1fr));gap:16px}.attempt-card h3,.completed-attempt h3{margin:8px 0 0}.attempt-top{display:flex;justify-content:space-between;gap:16px;align-items:flex-start}.attempt-top>strong{font-size:1.15rem;color:var(--navy);white-space:nowrap}
.attempt-status{display:inline-flex;border-radius:999px;padding:5px 9px;font-size:.72rem;font-weight:900;text-transform:uppercase;letter-spacing:.04em}.attempt-status.open{background:#fff3d2;color:#805300}.attempt-status.completed{background:#e7f8ee;color:#176a3f}
.progress-track{height:9px;background:#e5eef5;border-radius:999px;overflow:hidden;margin:18px 0 12px}.progress-track span{display:block;height:100%;background:linear-gradient(90deg,var(--blue),#49a4ec);border-radius:inherit}
.attempt-meta{display:flex;flex-wrap:wrap;gap:8px 18px;color:var(--muted);font-size:.83rem;margin:12px 0}.attempt-action{display:inline-block;text-decoration:none;margin-top:8px}
.attempt-list{display:grid;gap:12px}.completed-attempt{display:grid;grid-template-columns:74px 1fr auto;gap:18px;align-items:center;padding:17px 20px}.completed-main{min-width:0}.review-btn{white-space:nowrap}
.score-ring{--score:0;width:68px;height:68px;border-radius:50%;display:grid;place-items:center;background:conic-gradient(var(--blue) calc(var(--score)*1%),#e2edf5 0);position:relative}.score-ring:before{content:"";position:absolute;inset:7px;border-radius:50%;background:#fff}.score-ring span{position:relative;font-weight:900;color:var(--navy);font-size:.9rem}
.empty-progress{text-align:center;padding:34px}.empty-progress h3{margin-top:0}.empty-progress a{display:inline-block;text-decoration:none;margin-top:8px}
.review-dialog{width:min(820px,94vw);max-height:86vh;overflow:auto}.review-list{display:grid;gap:12px;margin-top:20px}.review-item{display:grid;grid-template-columns:34px 1fr 30px;gap:12px;padding:14px;border:1px solid #dbe7ef;border-left:5px solid #adbcc8;border-radius:14px;background:#f9fcfe}.review-item.correct{border-left-color:#2b9a5e}.review-item.incorrect{border-left-color:#c43a46}.review-number{width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:#e6f0f8;font-weight:900}.review-item h4{margin:2px 0 10px}.review-item p{margin:5px 0}.review-mark{font-size:1.5rem;font-weight:900}.review-item.correct .review-mark{color:#23824f}.review-item.incorrect .review-mark{color:#b52e3b}
@media(max-width:800px){.progress-stats{grid-template-columns:repeat(2,1fr)}.completed-attempt{grid-template-columns:58px 1fr}.score-ring{width:56px;height:56px}.review-btn{grid-column:1/-1;width:100%}.progress-hero{align-items:flex-start;flex-direction:column}}
@media(max-width:520px){.progress-stats{grid-template-columns:1fr 1fr}.section-heading{align-items:stretch;flex-direction:column}.progress-filter{width:100%}}
