:root {
  --primary: #e72f72;
  --primary2: #f5a800;
  --ink: #292128;
  --muted: #897d83;
  --line: #f0e4df;
  --bg: #fffaf4;
  --red: #d93a60;
  --shadow: 0 8px 30px rgba(201, 72, 98, .10);
}

.brand-mark {
  background: linear-gradient(145deg, #e72f72, #f5a800);
  box-shadow: 0 8px 18px #e72f7233;
}

.nav-item:hover { background: #fff3d8; color: #e72f72; }
.nav-item.active {
  background: linear-gradient(105deg, #e72f72, #f07b48);
  box-shadow: 0 8px 20px #e72f7230;
}

.help-card {
  background: linear-gradient(150deg, #fff6cf, #fff0f5);
  border-color: #f5dfbd;
}

.hero, .bank-hero {
  background: linear-gradient(110deg, #fff8d6, #fff0f5);
  border-color: #f4dfc5;
}

.primary {
  background: linear-gradient(105deg, #e72f72, #f29a34);
  box-shadow: 0 7px 16px #e72f7229;
}

.progress-fill { background: linear-gradient(90deg, #f5a800, #e72f72); }
.chart-art i { background: linear-gradient(#f5a800, #e72f72); }
.o1 { background: #ffd95e; }
.o2 { background: #f5a8c5; }
.purple-card {
  background: linear-gradient(135deg, #fff6c9, #fff0f6);
  border-color: #f3d9b4;
}
.purple-card > span { background: #e72f72; }
.donut { background: conic-gradient(#e72f72 0 35%, #f5a800 35% 70%, #f28b3c 70% 90%, #f193b5 90%); }
.d1 { background: #e72f72; }
.d2 { background: #f5a800; }
.d4 { background: #f193b5; }

.title-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.import-note { background: #fff8d8; border: 1px solid #f3df9c; border-radius: 11px; padding: 12px; color: #6e5b24; font-size: 12px; margin-bottom: 16px; }
.import-result { margin-top: 12px; padding: 10px; border-radius: 9px; background: #eaf8f3; color: #167356; }
@media(max-width:650px) { .title-actions { width: 100%; justify-content: flex-start; } }

/* Modern usability refresh */
body {
  background:
    radial-gradient(circle at 82% 8%, rgba(255, 220, 105, .18), transparent 25%),
    radial-gradient(circle at 38% 92%, rgba(245, 145, 181, .12), transparent 28%),
    #fbfaf9;
  letter-spacing: -.01em;
}

.sidebar {
  width: 260px;
  padding: 22px 18px;
  background: linear-gradient(180deg, #282229 0%, #211c22 100%);
  border: 0;
  box-shadow: 10px 0 40px rgba(40, 25, 34, .08);
}
.app-shell { margin-left: 260px; }
.brand { padding: 2px 8px 30px; }
.brand b { color: #fff; letter-spacing: -.2px; }
.brand small { color: #bdb4ba; }
.brand-mark { border-radius: 13px; }
.menu-label { color: #8f858c; font-size: 10px; margin-bottom: 12px; }
.sidebar nav { gap: 5px; }
.nav-item {
  color: #cfc8cd;
  padding: 13px 14px;
  border-radius: 11px;
  font-weight: 600;
}
.nav-item span { color: #ffcc50; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); transform: translateX(2px); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(100deg, #e72f72, #f08a3e);
  box-shadow: 0 10px 24px rgba(231, 47, 114, .27);
}
.nav-item.active span { color: #fff; }
.help-card {
  color: #fff;
  background: linear-gradient(145deg, rgba(255,204,80,.13), rgba(231,47,114,.16));
  border-color: rgba(255,255,255,.1);
}
.help-card small { color: #bdb4ba; }
.help-card button { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.1); color: #ffd866; }

.topbar {
  height: 84px;
  padding: 0 34px;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(16px);
  border-color: rgba(224,214,218,.7);
}
.topbar h1 { font-size: 16px; letter-spacing: -.25px; }
.topbar p { color: #8a7e84; }
.user {
  padding: 7px 10px 7px 7px;
  border: 1px solid #eee4e6;
  border-radius: 14px;
  background: #fff;
}
.avatar { background: linear-gradient(145deg, #e72f72, #f4a52e); box-shadow: 0 5px 12px rgba(231,47,114,.22); }
.content { padding: 30px 34px 56px; }

.hero, .bank-hero {
  min-height: 210px;
  padding: 34px 38px;
  border-radius: 22px;
  background: linear-gradient(115deg, #fff8d5 0%, #fff1f5 57%, #fde7f0 100%);
  box-shadow: 0 16px 42px rgba(115, 62, 79, .07);
}
.hero h2, .bank-hero h2, .page-title h2 { letter-spacing: -.8px; }
.eyebrow { background: rgba(231,47,114,.09); border-radius: 20px; padding: 5px 9px; display: inline-block; }

.stats { gap: 16px; margin: 20px 0; }
.stat-card, .card {
  border-color: rgba(232, 222, 224, .85);
  box-shadow: 0 8px 28px rgba(65, 39, 51, .045);
}
.stat-card {
  min-height: 86px;
  border-radius: 16px;
  padding: 17px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 13px 30px rgba(65,39,51,.08); }
.stat-icon { width: 44px; height: 44px; border-radius: 13px; }
.stat-card strong { font-size: 23px; letter-spacing: -.6px; }
.card { border-radius: 18px; padding: 21px; }
.card-head { margin-bottom: 18px; }
.card h3 { font-size: 16px; }

.primary, .outline {
  min-height: 42px;
  border-radius: 11px;
  padding: 10px 17px;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.primary:hover, .outline:hover { transform: translateY(-1px); }
.primary:hover { box-shadow: 0 10px 22px rgba(231,47,114,.25); }
.primary:active, .outline:active { transform: translateY(0); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(245,168,0,.3);
  outline-offset: 2px;
}
button:disabled { opacity: .55; cursor: wait; }

.toolbar {
  padding: 11px;
  background: #faf7f7;
  border: 1px solid #f0e7e8;
  border-radius: 13px;
}
.search { height: 42px; background: #fff; border-color: #e9dddf; }
.toolbar select, .card-head select, .modal select, .modal input, .modal textarea { min-height: 42px; }
.search:focus-within { border-color: #e72f72; box-shadow: 0 0 0 3px rgba(231,47,114,.08); }

.table-wrap { border: 1px solid #f0e7e8; border-radius: 13px; }
table { background: #fff; }
thead { position: sticky; top: 0; z-index: 2; }
th { background: #faf6f7; color: #74676e; padding: 12px; letter-spacing: .35px; }
td { padding: 13px 12px; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #fffaf1; }
tbody tr:last-child td { border-bottom: 0; }
.student-avatar { border-radius: 11px; background: linear-gradient(145deg,#fff0bb,#fbd5e4); color: #c92461; }
.badge { padding: 5px 10px; }
.icon-btn { min-height: 32px; border-radius: 9px; }
.icon-btn:hover { border-color: #e9a3bc; background: #fff5f8; }

.question-item { border-radius: 14px; padding: 13px; transition: border-color .15s, transform .15s; }
.question-item:hover { border-color: #efb3c9; transform: translateY(-1px); }
.q-type { background: #fff2bd; color: #bc6c00; }
.quick-card { border-radius: 18px; padding: 19px; }
.modal-backdrop { backdrop-filter: blur(6px); }
.modal { border-radius: 22px; padding: 29px; }
.modal-close { width: 36px; height: 36px; border-radius: 50%; background: #f8f3f4; }
.modal-close:hover { background: #fee9f0; color: #d92767; }
.toast { border: 1px solid rgba(255,255,255,.12); box-shadow: 0 14px 36px rgba(38,24,31,.25); }

@media(max-width:1000px) {
  .app-shell { margin-left: 0; }
  .sidebar { width: 272px; }
  .topbar { padding: 0 20px; }
}
@media(max-width:650px) {
  .content { padding: 18px 14px 42px; }
  .topbar { height: 72px; }
  .hero, .bank-hero { padding: 24px 21px; border-radius: 17px; }
  .stats { gap: 10px; }
  .stat-card { min-height: 78px; padding: 13px; }
  .card { padding: 16px; border-radius: 15px; }
  .page-title { flex-wrap: wrap; }
  .title-actions { display: grid; grid-template-columns: 1fr; }
  .title-actions button { width: 100%; }
}

/* Unified iconography and illustration details */
.ui-icon { display: block; flex: 0 0 auto; }
.nav-item { display: flex; align-items: center; gap: 9px; }
.nav-item span { display: grid; place-items: center; }
.help-icon { color: #e72f72; }
.stat-icon .ui-icon, .icon-box .ui-icon { width: 20px; height: 20px; }
.hero-art { filter: drop-shadow(0 18px 24px rgba(123,56,77,.08)); }
.chart-art { border: 1px solid rgba(255,255,255,.9); }
.chart-art::before { content: ''; position: absolute; inset: 18px 20px; border-bottom: 1px dashed #eadfe2; border-top: 1px dashed #f1e7e9; pointer-events: none; }
.chart-art i { position: relative; z-index: 1; box-shadow: inset 0 1px rgba(255,255,255,.35); }
.book { display: grid; place-items: center; border: 3px solid rgba(255,255,255,.65); }
.book .ui-icon { filter: drop-shadow(0 2px 2px rgba(120,70,20,.15)); }
.exam-illus { border: 1px solid #f4e8e1; background: linear-gradient(145deg,#fff,#fff8dd); }
.exam-illus::after { content: ''; position: absolute; width: 58px; height: 58px; border-radius: 18px; background: linear-gradient(145deg,#ffd85d,#ffad4d); left: 20px; top: 30px; transform: rotate(-9deg); opacity: .82; }
.q-type, .bubble, .stat-icon, .icon-box { box-shadow: inset 0 0 0 1px rgba(255,255,255,.55); }

/* Authentication */
.auth-hidden { display: none !important; }
.auth-screen { position: fixed; inset: 0; z-index: 200; display: grid; grid-template-columns: minmax(420px,1.1fr) minmax(430px,.9fr); background: #fff; }
.auth-screen.hidden { display: none; }
.auth-visual { position: relative; overflow: hidden; padding: 42px 54px; color: #fff; background: linear-gradient(145deg,#272027 0%,#4c2435 58%,#7e2f4d 100%); }
.auth-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 2; }
.auth-brand b,.auth-brand small { display: block; }.auth-brand small { color: #d9c8d0; }
.auth-copy { position: relative; z-index: 2; max-width: 570px; margin-top: min(18vh,150px); }
.auth-copy .eyebrow { color: #ffd85f; background: rgba(255,255,255,.08); }
.auth-copy h2 { font-size: clamp(34px,4vw,56px); line-height: 1.22; letter-spacing: -2px; margin: 20px 0 14px; }
.auth-copy p { color: #e0d2d9; font-size: 15px; line-height: 1.8; margin-bottom: 32px; }
.auth-feature { display: flex; align-items: center; gap: 11px; margin: 13px 0; color: #f7edf1; }
.auth-feature span { width: 34px; height: 34px; display: grid; place-items: center; color: #ffd85f; background: rgba(255,255,255,.09); border-radius: 10px; }
.auth-shape { position: absolute; border-radius: 50%; filter: blur(1px); }.auth-shape.s1 { width: 360px; height: 360px; right: -150px; top: -100px; background: rgba(255,205,78,.15); }.auth-shape.s2 { width: 470px; height: 470px; left: -220px; bottom: -260px; background: rgba(231,47,114,.22); }
.auth-panel { display: grid; place-items: center; padding: 36px; background: radial-gradient(circle at 85% 8%,#fff4cb,transparent 28%),#fffaf8; overflow: auto; }
.auth-card { width: min(430px,100%); padding: 36px; background: #fff; border: 1px solid #eee2e5; border-radius: 24px; box-shadow: 0 24px 70px rgba(73,37,52,.1); }
.auth-card>h1 { margin: 0; font-size: 28px; letter-spacing: -.8px; }.auth-card>p { color: var(--muted); margin: 3px 0 22px; }
.mobile-auth-brand { display: none; align-items: center; gap: 10px; margin-bottom: 24px; }.mobile-auth-brand .brand-mark { width: 38px; height: 38px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 18px; border-radius: 11px; background: #f7f2f3; }
.auth-tabs button { border: 0; border-radius: 8px; padding: 9px; color: #8c7f85; background: transparent; cursor: pointer; font-weight: 700; }.auth-tabs button.active { color: #c72562; background: #fff; box-shadow: 0 3px 12px rgba(55,31,41,.08); }
.auth-card form { display: grid; gap: 14px; }.auth-card input { min-height: 46px; border: 1px solid #e8dcdf; border-radius: 11px; padding: 10px 12px; font-family: inherit; }
.auth-submit { width: 100%; margin-top: 4px; min-height: 48px; }
.auth-message { min-height: 0; margin-bottom: 0; padding: 0; border-radius: 9px; font-size: 12px; }.auth-message:not(:empty) { padding: 10px; margin-bottom: 14px; }.auth-message.error { color: #ad3851; background: #feecef; }.auth-message.success { color: #167356; background: #eaf8f3; }.auth-message.info { color: #745e17; background: #fff7d5; }
.config-warning { padding: 11px; margin-bottom: 14px; color: #795f0b; background: #fff4c6; border: 1px solid #edd783; border-radius: 10px; font-size: 12px; }
.auth-footnote { display: block; text-align: center; color: #9a8e94; margin-top: 18px; }
.logout-btn { border: 0; color: #b82a5d; background: #fff0f5; border-radius: 8px; padding: 5px 8px; font-size: 10px; font-weight: 700; cursor: pointer; }
body[data-role="viewer"] #addStudentBtn,body[data-role="viewer"] #importSheetBtn,body[data-role="viewer"] #newRecordBtn,body[data-role="viewer"] #addQuestionBtn,body[data-role="viewer"] #createSetBtn,body[data-role="viewer"] #startExamBtn,body[data-role="viewer"] .delete-btn,body[data-role="viewer"] .question-item .icon-btn { display:none!important; }
.admin-only { display:none!important; }
body[data-role="admin"] .admin-only.nav-item { display:flex!important; }
.role-select { min-width:135px; border:1px solid #e5dadd; border-radius:9px; padding:7px 9px; background:#fff; font-family:inherit; }
@media(max-width:850px) { .auth-screen { grid-template-columns: 1fr; }.auth-visual { display:none; }.mobile-auth-brand { display:flex; }.auth-panel { padding:20px; }.auth-card { padding:26px; } }

/* Simple, maintainable interface */
:root {
  --primary: #334155;
  --primary2: #475569;
  --ink: #172033;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --shadow: 0 4px 16px rgba(15, 23, 42, .06);
}

body { background: var(--bg); letter-spacing: 0; }
.sidebar { background: #fff; border-right: 1px solid var(--line); box-shadow: none; }
.brand b { color: var(--ink); }
.brand small, .menu-label { color: var(--muted); }
.brand-mark { background: #334155; box-shadow: none; border-radius: 10px; }
.nav-item, .nav-item span { color: #64748b; }
.nav-item:hover { color: #1e293b; background: #f1f5f9; transform: none; }
.nav-item.active { color: #fff; background: #334155; box-shadow: none; }
.nav-item.active span { color: #fff; }
.help-card, .hero, .bank-hero, .purple-card, .orange-card { background: #fff; border-color: var(--line); }
.primary { background: #334155; box-shadow: none; }
.primary:hover { background: #1e293b; }
.card, .topbar { box-shadow: none; }
.hero, .bank-hero, .card { border-radius: 12px; }
.progress-fill, .chart-art i { background: #64748b; }

.auth-screen { grid-template-columns: minmax(360px, .8fr) minmax(500px, 1.2fr); background: #f8fafc; }
.auth-visual { padding: 40px 48px; color: #fff; background: #334155; }
.auth-brand small { color: #cbd5e1; }
.auth-copy { margin-top: min(17vh, 140px); }
.auth-copy .eyebrow { color: #e2e8f0; background: rgba(255,255,255,.08); }
.auth-copy h2 { font-size: clamp(32px, 3.5vw, 48px); letter-spacing: -.8px; }
.auth-copy p, .auth-feature { color: #e2e8f0; }
.auth-feature span { color: #fff; background: rgba(255,255,255,.1); border-radius: 8px; }
.auth-shape { display: none; }
.auth-panel { padding: 36px; background: #f8fafc; }
.auth-card { width: min(470px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(15,23,42,.07); }
.auth-heading { margin-bottom: 20px; }
.auth-heading h1 { margin: 4px 0 2px; font-size: 27px; letter-spacing: -.4px; }
.auth-heading p, .form-intro p { margin: 0; color: var(--muted); }
.auth-kicker { color: #64748b; font-size: 11px; font-weight: 700; letter-spacing: .4px; }
.mobile-auth-brand span:last-child { display: grid; }
.mobile-auth-brand small { color: var(--muted); font-size: 10px; }
.auth-tabs { grid-template-columns: 1fr 1fr; gap: 10px; padding: 0; background: transparent; }
.auth-tabs button { min-height: 44px; border: 1px solid var(--line); border-radius: 9px; color: #64748b; background: #fff; box-shadow: none; }
.auth-tabs button.active { color: #fff; border-color: #334155; background: #334155; box-shadow: none; }
.auth-card form { gap: 13px; }
.auth-tabs[hidden], .auth-card form[hidden] { display: none !important; }
.auth-card input { min-height: 46px; border-color: #cbd5e1; border-radius: 8px; outline: none; }
.auth-card input:focus { border-color: #64748b; box-shadow: 0 0 0 3px rgba(100,116,139,.12); }
.password-control { position: relative; }
.password-control input { width: 100%; padding-right: 48px; }
.password-toggle { position: absolute; top: 50%; right: 8px; width: 34px; height: 34px; padding: 7px; border: 0; border-radius: 7px; color: #64748b; background: transparent; cursor: pointer; transform: translateY(-50%); }
.password-toggle:hover { color: #1e293b; background: #f1f5f9; }
.password-toggle:focus-visible { outline: 2px solid #64748b; outline-offset: 1px; }
.password-toggle svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-toggle.showing::after { content: ''; position: absolute; left: 8px; top: 16px; width: 18px; height: 2px; border-radius: 2px; background: currentColor; transform: rotate(-42deg); }
.forgot-link, .back-link { width: max-content; padding: 0; border: 0; color: #475569; background: transparent; font-weight: 700; cursor: pointer; }
.forgot-link { justify-self: end; margin-top: -5px; font-size: 12px; }
.back-link { margin-bottom: 4px; }
.form-intro h2 { margin: 0; font-size: 22px; }
.form-intro { margin-bottom: 5px; }
.auth-submit { border-radius: 8px; }
.auth-security { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); color: #94a3b8; text-align: center; font-size: 10px; }
.auth-footnote { margin-top: 2px; color: var(--muted); }
.auth-message:not(:empty) { border: 1px solid transparent; }
.auth-message.error { color: #991b1b; background: #fef2f2; border-color: #fecaca; }
.auth-message.success { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.auth-message.info { color: #334155; background: #f1f5f9; border-color: #e2e8f0; }

@media(max-width:850px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-panel { padding: 18px; }
  .auth-card { padding: 25px; }
}
