/* Biosoft Education Certificate & ID Card System — white & blue SaaS theme */
:root {
    --mi-primary: #1d4ed8;
    --mi-primary-600: #1e40af;
    --mi-primary-50: #eff4ff;
    --mi-ink: #0f172a;
    --mi-muted: #64748b;
    --mi-border: #e5e9f2;
    --mi-bg: #f5f7fb;
    --mi-sidebar: #0b1f4d;
    --mi-sidebar-2: #10285f;
    --bs-primary: #1d4ed8;
    --bs-primary-rgb: 29, 78, 216;
    --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans Malayalam", sans-serif;
    --bs-body-color: #1e293b;
    --bs-border-color: #e5e9f2;
}
body { font-size: .925rem; }
.bg-app { background: var(--mi-bg); min-height: 100vh; }
a { text-decoration: none; }
.btn-primary { --bs-btn-bg: var(--mi-primary); --bs-btn-border-color: var(--mi-primary); --bs-btn-hover-bg: var(--mi-primary-600); --bs-btn-hover-border-color: var(--mi-primary-600); --bs-btn-active-bg: var(--mi-primary-600); }
.btn-outline-primary { --bs-btn-color: var(--mi-primary); --bs-btn-border-color: #bcd0fb; --bs-btn-hover-bg: var(--mi-primary); --bs-btn-hover-border-color: var(--mi-primary); }
.btn { border-radius: .55rem; font-weight: 500; }
.form-control, .form-select { border-radius: .55rem; border-color: #d9dfeb; }
.form-control:focus, .form-select:focus { border-color: #93b4f8; box-shadow: 0 0 0 .2rem rgba(29, 78, 216, .12); }
.form-label { font-weight: 500; color: #334155; font-size: .86rem; margin-bottom: .3rem; }
.required::after { content: " *"; color: #dc2626; }

/* Layout */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 258px; flex-shrink: 0; background: linear-gradient(180deg, var(--mi-sidebar), var(--mi-sidebar-2)); color: #cbd5f5; position: fixed; inset: 0 auto 0 0; z-index: 1040; display: flex; flex-direction: column; transition: transform .2s; }
.sidebar .brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.2rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; letter-spacing: .5px; box-shadow: 0 4px 14px rgba(29,78,216,.35); overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.sidebar .brand .name { font-weight: 600; line-height: 1.15; font-size: .95rem; }
.sidebar .brand small { color: #93a6d6; font-size: .72rem; }
.sidebar nav { overflow-y: auto; padding: .6rem .6rem 1.5rem; flex: 1; }
.sidebar .nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #7d8fc0; padding: .9rem .8rem .35rem; }
.sidebar a.nav-link { color: #cbd5f5; border-radius: .55rem; padding: .52rem .8rem; display: flex; align-items: center; gap: .7rem; font-size: .88rem; margin-bottom: 1px; }
.sidebar a.nav-link i { font-size: 1.05rem; opacity: .85; width: 1.2rem; text-align: center; }
.sidebar a.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.nav-link.active { background: rgba(59,130,246,.22); color: #fff; box-shadow: inset 3px 0 0 #60a5fa; }
.sidebar .nav-link .badge { margin-left: auto; }
.main { margin-left: 258px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 62px; background: #fff; border-bottom: 1px solid var(--mi-border); display: flex; align-items: center; padding: 0 1.4rem; gap: 1rem; position: sticky; top: 0; z-index: 1030; }
.topbar .page-title { font-weight: 600; font-size: 1.06rem; margin: 0; color: var(--mi-ink); }
.content { padding: 1.4rem; flex: 1; }
.sidebar-toggle { display: none; }
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
    .main { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; }
    .content { padding: 1rem; }
}

/* Cards & tables */
.card { border: 1px solid var(--mi-border); border-radius: .85rem; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--mi-border); padding: .85rem 1.1rem; font-weight: 600; border-radius: .85rem .85rem 0 0 !important; }
.card-body { padding: 1.1rem; }
.stat-card { padding: 1rem 1.1rem; display: flex; gap: .9rem; align-items: center; height: 100%; }
.stat-card .icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-card .value { font-size: 1.45rem; font-weight: 700; line-height: 1.1; color: var(--mi-ink); }
.stat-card .label { color: var(--mi-muted); font-size: .8rem; }
.table { --bs-table-hover-bg: #f7f9fd; margin-bottom: 0; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; font-weight: 600; background: #f8fafd; border-bottom-width: 1px; white-space: nowrap; }
.table td { vertical-align: middle; }
.table-card .card-body { padding: 0; }
.filter-bar { background: #fff; border: 1px solid var(--mi-border); border-radius: .85rem; padding: .8rem; margin-bottom: 1rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--mi-primary-50); color: var(--mi-primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem; flex-shrink: 0; }
.avatar-lg { width: 112px; height: 140px; border-radius: .7rem; object-fit: cover; }
.text-muted-2 { color: var(--mi-muted); }
.dl-grid { display: grid; grid-template-columns: 170px 1fr; gap: .45rem .9rem; margin: 0; }
.dl-grid dt { color: var(--mi-muted); font-weight: 500; font-size: .84rem; }
.dl-grid dd { margin: 0; }
@media (max-width: 575.98px) { .dl-grid { grid-template-columns: 1fr; } .dl-grid dd { margin-bottom: .4rem; } }

/* Soft badges */
.badge { font-weight: 600; border-radius: .45rem; padding: .38em .6em; }
.badge-soft-primary { background: #e0eaff; color: #1d4ed8; }
.badge-soft-info { background: #e0f2fe; color: #0369a1; }
.badge-soft-warning { background: #fef3c7; color: #a16207; }
.badge-soft-success { background: #dcfce7; color: #15803d; }
.badge-soft-teal { background: #ccfbf1; color: #0f766e; }
.badge-soft-dark { background: #e2e8f0; color: #1e293b; }
.badge-soft-danger { background: #fee2e2; color: #b91c1c; }
.badge-soft-secondary { background: #f1f5f9; color: #475569; }
.bg-soft-primary { background: #e0eaff; color: #1d4ed8; }
.bg-soft-success { background: #dcfce7; color: #15803d; }
.bg-soft-warning { background: #fef3c7; color: #a16207; }
.bg-soft-info { background: #e0f2fe; color: #0369a1; }
.bg-soft-danger { background: #fee2e2; color: #b91c1c; }
.bg-soft-teal { background: #ccfbf1; color: #0f766e; }
.bg-soft-dark { background: #e2e8f0; color: #1e293b; }

/* Toasts */
.toast-stack { position: fixed; top: 74px; right: 18px; z-index: 1090; display: flex; flex-direction: column; gap: .5rem; max-width: 380px; }
.toast-msg { background: #fff; border: 1px solid var(--mi-border); border-left: 4px solid var(--mi-primary); border-radius: .6rem; padding: .7rem .9rem; box-shadow: 0 10px 30px rgba(15,23,42,.12); display: flex; gap: .6rem; align-items: flex-start; animation: toastIn .2s ease-out; }
.toast-msg.success { border-left-color: #16a34a; } .toast-msg.danger, .toast-msg.error { border-left-color: #dc2626; } .toast-msg.warning { border-left-color: #d97706; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } }

/* Diff / compare */
.diff-row.mismatch { background: #fff7ed; }
.diff-row.mismatch td:nth-child(2), .diff-row.mismatch td:nth-child(3) { color: #9a3412; font-weight: 500; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; }
.timeline li::before { content: ""; position: absolute; left: .38rem; top: .35rem; bottom: -.35rem; width: 2px; background: var(--mi-border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: .25rem; width: .9rem; height: .9rem; border-radius: 50%; background: #fff; border: 3px solid var(--mi-primary); }

/* Public pages */
.public-body { background: linear-gradient(180deg, #eaf1ff 0, #f7f9fd 320px); min-height: 100vh; }
.public-header { background: #fff; border-bottom: 1px solid var(--mi-border); }
.public-header .logo { height: 46px; width: auto; max-width: 120px; object-fit: contain; }
.public-card { border-radius: 1rem; border: 1px solid var(--mi-border); box-shadow: 0 10px 30px rgba(15, 23, 42, .06); }
.notice-important { background: #fff7ed; border: 1px solid #fed7aa; border-left: 5px solid #ea580c; color: #7c2d12; border-radius: .7rem; padding: .85rem 1rem; font-weight: 500; }
.preview-highlight { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: .7rem; padding: .8rem 1rem; }
.preview-highlight .v { font-size: 1.15rem; font-weight: 700; color: #0f172a; word-break: break-word; }
.ack-ref { font-size: 1.6rem; font-weight: 700; letter-spacing: .03em; color: var(--mi-primary); }
.public-body .form-control, .public-body .form-select { padding: .65rem .8rem; font-size: 1rem; }
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.step-dots { display: flex; gap: .5rem; justify-content: center; font-size: .8rem; color: var(--mi-muted); }
.step-dots span.on { color: var(--mi-primary); font-weight: 600; }
@media print {
    .no-print, .sidebar, .topbar, .public-header nav { display: none !important; }
    .main { margin: 0 !important; }
    .public-body { background: #fff; }
    .public-card { box-shadow: none; border: 1px solid #999; }
}

/* Login */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: radial-gradient(1200px 600px at 10% 10%, #2563eb, #0b1f4d); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem; background: #fff; }
@media (max-width: 991.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-hero { display: none; } }

/* Doc thumbnails */
.doc-thumb { max-width: 100%; border: 1px solid var(--mi-border); border-radius: .5rem; background: repeating-conic-gradient(#f1f5f9 0 25%, #fff 0 50%) 50%/16px 16px; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--mi-muted); }
.empty-state i { font-size: 2.2rem; color: #c7d2fe; display: block; margin-bottom: .5rem; }
.copy-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
.progress { height: .8rem; border-radius: 1rem; }
