* { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #eef1f5;
    margin: 0;
    padding: 0;
    color: #1f2937;
}
.topbar {
    background: #0b3d91;
    color: #fff;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar a {
    color: #fff;
    text-decoration: none;
    background: rgba(255,255,255,0.15);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
}
.topbar a:hover { background: rgba(255,255,255,0.28); }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0b3d91, #1e6fd9);
}
.login-card {
    background: #fff;
    width: 380px;
    padding: 34px 30px;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}
.login-card h1 {
    font-size: 20px;
    margin: 0 0 4px;
    color: #0b3d91;
    text-align: center;
}
.login-card p.sub {
    text-align: center;
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 22px;
}
label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #374151;
}
input[type=text], input[type=date] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 18px;
}
input[type=text]:focus, input[type=date]:focus {
    outline: none;
    border-color: #0b3d91;
    box-shadow: 0 0 0 3px rgba(11,61,145,0.15);
}
button.btn {
    width: 100%;
    background: #0b3d91;
    color: #fff;
    border: none;
    padding: 11px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
button.btn:hover { background: #092f70; }
.error-box {
    background: #fee2e2;
    color: #b91c1c;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}
.container {
    max-width: 950px;
    margin: 30px auto;
    padding: 0 16px;
}
.card {
    background: #fff;
    border-radius: 10px;
    padding: 26px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}
.card h2 {
    margin-top: 0;
    color: #0b3d91;
    font-size: 18px;
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 10px;
}
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 24px;
}
.info-grid div span.k {
    font-size: 12px;
    color: #6b7280;
    display: block;
}
.info-grid div span.v {
    font-size: 14px;
    font-weight: 600;
}
.btn-link {
    display: inline-block;
    background: #0b3d91;
    color: #fff;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}
.btn-link:hover { background: #092f70; }
.status-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.status-approved { background: #dcfce7; color: #166534; }
.status-pending { background: #fef9c3; color: #854d0e; }

/* ---- Marksheet ---- */
.ms-page-outer {
    max-width: 850px;
    margin: 0 auto;
}
.marksheet {
    background: #fff;
    border: 4px double #0b3d91;
    padding: 6px;
    position: relative;
}
.marksheet-inner {
    border: 1px solid #0b3d91;
    padding: 26px 32px 20px;
    position: relative;
}
.watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-32deg);
    font-size: 64px;
    font-weight: 800;
    color: rgba(11, 61, 145, 0.06);
    letter-spacing: 6px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 0;
    text-transform: uppercase;
}
.marksheet-inner > * { position: relative; z-index: 1; }

.marksheet .head {
    text-align: center;
    border-bottom: 2px solid #0b3d91;
    padding-bottom: 12px;
    margin-bottom: 16px;
}
.marksheet .head .emblem {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #0b3d91;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-align: center;
    line-height: 1.1;
}
.marksheet .head h1 {
    margin: 0;
    font-size: 21px;
    color: #0b3d91;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}
.marksheet .head h2 {
    margin: 3px 0 0;
    font-size: 13px;
    color: #4b5563;
    font-weight: 500;
}
.marksheet .head h3 {
    display: inline-block;
    margin: 12px 0 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #111827;
    text-transform: uppercase;
    border: 1px solid #111827;
    padding: 4px 18px;
    border-radius: 3px;
}

.ms-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 16px;
}
.ms-info {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 20px;
    font-size: 12.5px;
}
.ms-info .full-row { grid-column: 1 / -1; }
.ms-info div b {
    color: #4b5563;
    font-weight: 600;
    display: inline-block;
    min-width: 108px;
}
.ms-info div span.val {
    color: #111827;
    font-weight: 700;
}
.ms-photo-box {
    width: 92px;
    height: 110px;
    border: 1px solid #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #9ca3af;
    text-align: center;
    flex-shrink: 0;
    background: #f9fafb;
}

table.marks-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 14px;
    font-size: 12.5px;
}
table.marks-table th, table.marks-table td {
    border: 1px solid #4b5563;
    padding: 7px 8px;
    text-align: center;
}
table.marks-table th {
    color: #211f1f !important;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
table.marks-table td.subject-name { text-align: left; font-weight: 600; }
table.marks-table td.sno { color: #6b7280; width: 32px; }
table.marks-table tbody tr:nth-child(even) td {
    background: #f7f9fc !important;
}
table.marks-table tfoot td {
    font-weight: 800;
    background: #eef1f8 !important;
}
table.marks-table tfoot tr.pct-row td {
    font-size: 12px;
}

.result-banner {
    text-align: center;
    padding: 9px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 1.5px;
    border-radius: 4px;
    margin-bottom: 6px;
    border: 1.5px solid;
}
.result-pass {
    background: #dcfce7 !important;
    color: #166534 !important;
    border-color: #166534;
}
.result-fail {
    background: #fee2e2 !important;
    color: #b91c1c !important;
    border-color: #b91c1c;
}

.ms-footnote {
    font-size: 10px;
    color: #6b7280;
    margin-bottom: 14px;
    line-height: 1.5;
}

.sign-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 55px;
    font-size: 11.5px;
    font-weight: 600;
    color: #374151;
}
.sign-row div { text-align: center; }
.sign-row div .line {
    margin-top: 42px;
    border-top: 1px solid #333;
    padding-top: 5px;
    width: 170px;
}
.qr-box {
    width: 64px;
    height: 64px;
    border: 1px solid #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: #9ca3af;
    text-align: center;
    margin: 0 auto 4px;
}

.print-btn {
    text-align: center;
    margin: 18px 0;
}
.print-btn button {
    border: none;
    cursor: pointer;
}

/* ---------- PRINT ---------- */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    @page {
        size: A4;
        margin: 10mm;
    }
    body { background: #fff !important; }
    .no-print { display: none !important; }
    .container { margin: 0; max-width: 100%; padding: 0; }
    .ms-page-outer { max-width: 100%; }
    .marksheet { border-width: 3px; }
    table.marks-table, table.marks-table tr, table.marks-table td, table.marks-table th {
        page-break-inside: avoid;
    }
    .sign-row { page-break-inside: avoid; }
}
