/* Student Exam Section - mobile first, no frameworks */
:root {
    --ex-brand: #460018;
    --ex-brand-2: #6b0025;
    --ex-primary: #1A6B7A;
    --ex-primary-dark: #0F5A68;
    --ex-accent: #E85D75;
    --ex-ink: #1f2430;
    --ex-muted: #5f6675;
    --ex-line: #e3e7ec;
    --ex-bg: #f4f6f8;
    --ex-card: #ffffff;
    --ex-ok: #1e7b45;
    --ex-ok-bg: #e7f5ec;
    --ex-warn: #9a6a00;
    --ex-warn-bg: #fff6dd;
    --ex-err: #b42318;
    --ex-err-bg: #fdecea;
    --ex-radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--ex-bg);
    color: var(--ex-ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", "Nirmala UI", Mangal, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}
a { color: var(--ex-primary); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5rem; }

/* ---------- Top bar ---------- */
.ex-top {
    background: linear-gradient(100deg, var(--ex-brand) 0%, var(--ex-brand-2) 100%);
    color: #fff;
    position: sticky; top: 0; z-index: 20;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.ex-top-in {
    max-width: 1100px; margin: 0 auto;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px; min-height: 58px;
}
.ex-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.ex-brand img { width: 42px; height: 42px; object-fit: contain; background: #fff; border-radius: 50%; padding: 2px; flex: none; }
.ex-brand b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-brand small { display: block; font-size: 12px; opacity: .85; }
.ex-user { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.ex-user-name { display: none; font-size: 13px; opacity: .9; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-out {
    color: #fff; text-decoration: none; font-size: 13px; font-weight: 600;
    border: 1px solid rgba(255,255,255,.55); border-radius: 20px; padding: 6px 12px;
}
.ex-out:hover { background: rgba(255,255,255,.12); }

/* ---------- Layout ---------- */
.ex-main { max-width: 1100px; margin: 0 auto; padding: 14px 12px 40px; }
.ex-grid { display: grid; gap: 14px; }
.ex-title { font-size: 20px; margin: 4px 2px 12px; color: var(--ex-brand); }

/* ---------- Cards ---------- */
.ex-card {
    background: var(--ex-card);
    border: 1px solid var(--ex-line);
    border-radius: var(--ex-radius);
    box-shadow: 0 4px 14px rgba(15,35,60,.05);
    overflow: hidden;
}
.ex-card-h {
    background: linear-gradient(110deg, var(--ex-primary) 0%, #208B9E 100%);
    color: #fff; padding: 12px 16px;
    display: flex; align-items: center; gap: 10px;
}
.ex-card-h h2 { font-size: 17px; margin: 0; }
.ex-card-h .ico { width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none; }
.ex-card-h .ico svg { width: 18px; height: 18px; fill: #fff; }
.ex-card-b { padding: 16px; }

/* ---------- Menu (home) ---------- */
.ex-menu { list-style: none; margin: 0; padding: 6px; }
.ex-menu a, .ex-menu span {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 12px; border-radius: 10px;
    color: var(--ex-ink); text-decoration: none; font-weight: 600;
}
.ex-menu a:hover { background: #eef6f8; }
.ex-menu a.on { background: #e3f1f4; color: var(--ex-primary-dark); }
.ex-menu span { color: #9aa0aa; cursor: default; }
.ex-menu svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.ex-menu em { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 600; background: #eef0f3; color: #6b7280; border-radius: 10px; padding: 2px 8px; }

/* ---------- Notes ---------- */
.ex-notes { margin: 0; padding: 0; list-style: none; }
.ex-notes li { position: relative; padding: 9px 0 9px 22px; border-bottom: 1px dashed var(--ex-line); }
.ex-notes li:last-child { border-bottom: 0; }
.ex-notes li::before { content: ""; position: absolute; left: 4px; top: 17px; width: 8px; height: 8px; border-radius: 50%; background: var(--ex-primary); }

/* ---------- Messages ---------- */
.ex-msg { border-radius: 10px; padding: 11px 14px; margin-bottom: 14px; font-size: 15px; border: 1px solid transparent; }
.ex-msg.ok { background: var(--ex-ok-bg); color: var(--ex-ok); border-color: #bfe3cd; }
.ex-msg.warn { background: var(--ex-warn-bg); color: var(--ex-warn); border-color: #f1dea4; }
.ex-msg.err { background: var(--ex-err-bg); color: var(--ex-err); border-color: #f5c2bd; }
.ex-msg:empty { display: none; }

/* ---------- Forms ---------- */
.ex-field { margin-bottom: 14px; }
.ex-field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; color: #3a404c; }
.ex-input, .ex-select {
    width: 100%; font: inherit; font-size: 16px; /* 16px stops iOS zoom */
    padding: 11px 12px; border: 1px solid #cfd6de; border-radius: 10px; background: #fff; color: var(--ex-ink);
}
.ex-input:focus, .ex-select:focus { outline: none; border-color: var(--ex-primary); box-shadow: 0 0 0 3px rgba(26,107,122,.15); }
.ex-hint { font-size: 13px; color: var(--ex-muted); margin-top: 4px; }
.ex-val { color: var(--ex-err); font-size: 13px; display: block; margin-top: 4px; }

/* ---------- Buttons ---------- */
.ex-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: inherit; font-weight: 700; font-size: 15px;
    border: 0; border-radius: 40px; padding: 12px 22px; min-height: 46px;
    cursor: pointer; text-decoration: none; text-align: center;
    background: var(--ex-primary); color: #fff;
}
.ex-btn:hover { background: var(--ex-primary-dark); color: #fff; }
.ex-btn.alt { background: #fff; color: var(--ex-primary); border: 1px solid var(--ex-primary); }
.ex-btn.alt:hover { background: #eef6f8; }
.ex-btn.pink { background: var(--ex-accent); }
.ex-btn.pink:hover { background: #d44a62; }
.ex-btn.block { width: 100%; }
.ex-btn[disabled], .ex-btn.busy { opacity: .6; pointer-events: none; }
.ex-actions { display: flex; flex-direction: column-reverse; gap: 10px; margin-top: 18px; }

/* ---------- Stepper ---------- */
.ex-steps { display: flex; list-style: none; margin: 0 0 14px; padding: 0; counter-reset: s; }
.ex-steps li { flex: 1; position: relative; text-align: center; font-size: 11px; color: #8a919c; }
.ex-steps li::before {
    counter-increment: s; content: counter(s);
    display: grid; place-items: center; margin: 0 auto 4px;
    width: 30px; height: 30px; border-radius: 50%;
    background: #e6e9ee; color: #6b7280; font-weight: 700; font-size: 13px;
    position: relative; z-index: 1;
}
.ex-steps li::after { content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px; background: #e6e9ee; }
.ex-steps li:first-child::after { display: none; }
.ex-steps li.done::before { background: var(--ex-ok); color: #fff; content: "\2713"; }
.ex-steps li.done::after, .ex-steps li.cur::after { background: var(--ex-ok); }
.ex-steps li.cur::before { background: var(--ex-primary); color: #fff; box-shadow: 0 0 0 4px rgba(26,107,122,.18); }
.ex-steps li.cur { color: var(--ex-primary); font-weight: 700; }
.ex-steps a { color: inherit; text-decoration: none; display: block; }
.ex-steps span { display: block; }

/* ---------- Detail list ---------- */
.ex-dl { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; }
.ex-dl div { padding: 9px 0; border-bottom: 1px solid #f0f2f5; }
.ex-dl dt { font-size: 12.5px; color: var(--ex-muted); margin: 0; }
.ex-dl dd { margin: 2px 0 0; font-weight: 600; word-break: break-word; }

/* ---------- Subjects ---------- */
.ex-subj { list-style: none; margin: 0; padding: 0; }
.ex-subj li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f0f2f5; }
.ex-subj li:last-child { border-bottom: 0; }
.ex-no { flex: none; width: 28px; height: 28px; border-radius: 8px; background: #eef6f8; color: var(--ex-primary-dark); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.ex-subj .t { font-weight: 600; }
.ex-subj .m { font-size: 13px; color: var(--ex-muted); margin-top: 2px; }
.ex-tag { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 1px 7px; margin-right: 4px; background: #eef0f3; color: #4b5563; }
.ex-tag.mode { background: #e3f1f4; color: var(--ex-primary-dark); }

.ex-choice { border: 2px dashed #f1b8c4; background: #fff7f9; border-radius: 12px; padding: 12px; margin: 10px 0; }
.ex-choice h3 { font-size: 15px; margin: 0 0 8px; color: #a8324a; }
.ex-opt { display: flex; gap: 10px; align-items: flex-start; padding: 11px; border: 1px solid var(--ex-line); border-radius: 10px; background: #fff; margin-top: 8px; cursor: pointer; }
.ex-opt input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ex-primary); flex: none; }
.ex-opt:has(input:checked) { border-color: var(--ex-primary); background: #eef7f9; }

/* ---------- Photo ---------- */
.ex-photos { display: grid; grid-template-columns: 1fr; gap: 14px; }
.ex-pic { border: 1px solid var(--ex-line); border-radius: 12px; padding: 12px; text-align: center; background: #fcfcfd; }
.ex-pic img { display: block; margin: 0 auto 10px; border: 1px solid #d8dde3; border-radius: 6px; background: #fff; object-fit: contain; }
.ex-pic .ph { width: 130px; height: 160px; }
.ex-pic .sg { width: 220px; height: 80px; }
.ex-pic .none { display: grid; place-items: center; margin: 0 auto 10px; border: 2px dashed #cfd6de; border-radius: 6px; color: #9aa0aa; font-size: 13px; }
.ex-file { font-size: 14px; max-width: 100%; }

/* ---------- Status pills ---------- */
.ex-pill { display: inline-block; font-size: 12.5px; font-weight: 700; border-radius: 20px; padding: 3px 10px; }
.ex-pill.Draft { background: var(--ex-warn-bg); color: var(--ex-warn); }
.ex-pill.Submitted { background: #e3f1f4; color: var(--ex-primary-dark); }
.ex-pill.Accepted { background: var(--ex-ok-bg); color: var(--ex-ok); }
.ex-pill.Rejected { background: var(--ex-err-bg); color: var(--ex-err); }

.ex-sess { border: 1px solid var(--ex-line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.ex-sess:last-child { margin-bottom: 0; }
.ex-sess h3 { font-size: 17px; margin: 0 0 4px; }
.ex-sess p { margin: 4px 0 10px; color: var(--ex-muted); font-size: 14px; }
.ex-sess .ex-btn { margin: 4px 6px 0 0; }

.ex-check { display: flex; gap: 10px; align-items: flex-start; background: #f8fafb; border: 1px solid var(--ex-line); border-radius: 10px; padding: 12px; }
.ex-check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--ex-primary); }

/* ---------- Login ---------- */
.ex-login { max-width: 430px; margin: 10px auto; }

/* ---------- Larger screens ---------- */
@media (min-width: 640px) {
    .ex-main { padding: 22px 18px 50px; }
    .ex-dl { grid-template-columns: 1fr 1fr; column-gap: 24px; }
    .ex-photos { grid-template-columns: 1fr 1fr; }
    .ex-actions { flex-direction: row; justify-content: space-between; }
    .ex-steps li { font-size: 12.5px; }
    .ex-user-name { display: block; }
}
@media (min-width: 900px) {
    .ex-grid.two { grid-template-columns: 330px 1fr; align-items: start; }
    .ex-title { font-size: 22px; }
}
