/* =====================================================================
   DU Certificates Portal — application shell (Student / College / Academic)
   ===================================================================== */
@font-face { font-family: "Jakarta"; src: url("../lib/fonts/plus-jakarta-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("../lib/fonts/plus-jakarta-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("../lib/fonts/plus-jakarta-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("../lib/fonts/plus-jakarta-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("../lib/fonts/plus-jakarta-sans-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "NotoDeva"; src: url("../fonts/NotoSansDevanagari-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "NotoDeva"; src: url("../fonts/NotoSansDevanagari-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

@font-face { font-family: "Inter"; src: url("../lib/fonts/inter-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../lib/fonts/inter-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../lib/fonts/inter-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../lib/fonts/inter-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../lib/fonts/inter-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../lib/fonts/poppins-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../lib/fonts/poppins-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../lib/fonts/poppins-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../lib/fonts/poppins-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../lib/fonts/poppins-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("../fonts/NotoSans-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("../fonts/NotoSans-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --brand: #6d28d9; --brand-2: #7c3aed; --brand-3: #a78bfa; --brand-ink: #3b0764; --accent: #f59e0b;
  --bg: #f6f5fb; --card: #ffffff; --ink: #111827; --muted: #6b7280; --line: #e7e5f0;
  --ok: #059669; --warn: #d97706; --bad: #dc2626; --info: #0284c7; --orange: #ea580c;
  --radius: 14px; --shadow: 0 1px 2px rgba(17,24,39,.04), 0 8px 24px rgba(76,29,149,.06);
  --side-w: 264px;
}
body.theme-college { --brand: #0f766e; --brand-2: #14b8a6; --brand-3: #5eead4; --brand-ink: #134e4a; }
body.theme-academic { --brand: #3730a3; --brand-2: #6366f1; --brand-3: #a5b4fc; --brand-ink: #1e1b4b; }

html, body { height: 100%; }
body { font-family: var(--app-font, "Jakarta", "NotoDeva", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif); background: var(--bg); color: var(--ink); font-size: .925rem; -webkit-font-smoothing: antialiased; }
.hi, [lang="hi"] { font-family: "NotoDeva", "Jakarta", sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-ink); }
::selection { background: var(--brand-3); color: #fff; }

/* ---------------- shell */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--side-w); flex: 0 0 var(--side-w); background: linear-gradient(180deg, var(--brand-ink), color-mix(in srgb, var(--brand-ink) 75%, #000)); color: #e9e5ff; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 1030; transition: transform .25s ease; }
.sidebar .brand { display: flex; gap: .7rem; align-items: center; padding: 1.1rem 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand img { width: 42px; height: 42px; border-radius: 50%; background: #fff; padding: 2px; }
.sidebar .brand b { display: block; font-size: .98rem; color: #fff; letter-spacing: .2px; }
.sidebar .brand small { color: rgba(255,255,255,.65); font-size: .74rem; }
.sidebar .module { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.45); padding: 1rem 1.25rem .35rem; font-weight: 700; }
.sidebar .nav-link { color: rgba(255,255,255,.82); display: flex; align-items: center; gap: .75rem; padding: .55rem 1rem; margin: .1rem .6rem; border-radius: 10px; font-weight: 500; }
.sidebar .nav-link i { font-size: 1.05rem; opacity: .9; width: 1.2rem; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: linear-gradient(90deg, var(--brand-2), color-mix(in srgb, var(--brand-2) 60%, transparent)); color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.sidebar .side-foot { padding: 1rem 1.25rem; font-size: .75rem; color: rgba(255,255,255,.45); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; height: 64px; display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem; background: rgba(255,255,255,.82); backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line); }
.topbar .crumb { font-weight: 700; font-size: 1.05rem; }
.topbar .crumb small { display: block; font-weight: 500; color: var(--muted); font-size: .75rem; }
.topbar .user-chip { display: flex; align-items: center; gap: .6rem; padding: .3rem .4rem .3rem .3rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--brand-2), var(--accent)); font-size: .85rem; }
.content { padding: 1.5rem; flex: 1; }
.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.45rem; font-weight: 800; margin: 0; letter-spacing: -.01em; }
.page-head p { margin: .2rem 0 0; color: var(--muted); }
.side-toggle { display: none; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; transform: translateX(-100%); }
  body.side-open .sidebar { transform: none; }
  body.side-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1025; }
  .side-toggle { display: inline-flex; }
  .content { padding: 1rem; }
}

/* ---------------- cards & stats */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--card); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); padding: .9rem 1.15rem; font-weight: 700; }
.card-body { padding: 1.15rem; }
.stat { position: relative; overflow: hidden; padding: 1.1rem 1.15rem; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); height: 100%; }
.stat .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; color: #fff; }
.stat .val { font-size: 1.7rem; font-weight: 800; line-height: 1.1; margin-top: .65rem; }
.stat .lbl { color: var(--muted); font-size: .82rem; font-weight: 500; }
.stat::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: currentColor; opacity: .05; }
.g-violet { background: linear-gradient(135deg,#7c3aed,#a855f7); } .t-violet { color: #7c3aed; }
.g-teal { background: linear-gradient(135deg,#0d9488,#2dd4bf); } .t-teal { color: #0d9488; }
.g-amber { background: linear-gradient(135deg,#d97706,#fbbf24); } .t-amber { color: #d97706; }
.g-blue { background: linear-gradient(135deg,#2563eb,#60a5fa); } .t-blue { color: #2563eb; }
.g-rose { background: linear-gradient(135deg,#e11d48,#fb7185); } .t-rose { color: #e11d48; }
.g-green { background: linear-gradient(135deg,#059669,#34d399); } .t-green { color: #059669; }
.g-indigo { background: linear-gradient(135deg,#4338ca,#818cf8); } .t-indigo { color: #4338ca; }

/* ---------------- tables */
.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { padding: .7rem .85rem; border-color: var(--line); vertical-align: middle; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: #faf9ff; white-space: nowrap; }
.table-hover tbody tr:hover { background: #faf8ff; }
.table .mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
.table-wrap { overflow-x: auto; }

/* ---------------- badges / status */
.badge { font-weight: 600; border-radius: 999px; padding: .38em .7em; letter-spacing: .01em; }
.badge-soft-secondary { background: #f1f5f9; color: #475569; } .badge-soft-warning { background: #fef3c7; color: #92400e; }
.badge-soft-info { background: #e0f2fe; color: #075985; } .badge-soft-primary { background: #ede9fe; color: #5b21b6; }
.badge-soft-orange { background: #ffedd5; color: #9a3412; } .badge-soft-danger { background: #fee2e2; color: #991b1b; }
.badge-soft-success { background: #d1fae5; color: #065f46; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; margin-right: .35rem; }

/* ---------------- forms */
.form-label { font-weight: 600; font-size: .82rem; color: #374151; margin-bottom: .3rem; }
.form-label .hi { font-weight: 400; color: var(--muted); font-size: .78rem; }
.form-control, .form-select { border-radius: 10px; border-color: #dcd8ea; padding: .58rem .8rem; font-size: .92rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 .22rem color-mix(in srgb, var(--brand-2) 18%, transparent); }
.form-control.is-invalid, .form-select.is-invalid { background-image: none; }
.req::after { content: " *"; color: var(--bad); }
.btn { border-radius: 10px; font-weight: 600; padding: .55rem 1rem; }
.btn-sm { padding: .35rem .7rem; border-radius: 8px; }
.btn-brand { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border: 0; box-shadow: 0 6px 16px color-mix(in srgb, var(--brand-2) 35%, transparent); }
.btn-brand:hover { color: #fff; filter: brightness(1.06); }
.btn-soft { background: color-mix(in srgb, var(--brand-2) 10%, #fff); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand-2) 20%, #fff); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand-2) 18%, #fff); color: var(--brand-ink); }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: 9px; }
.section-title { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1rem; margin: 0 0 1rem; }
.section-title .num { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: .8rem; color: #fff; background: linear-gradient(135deg,var(--brand),var(--brand-2)); }
.section-title small { font-weight: 500; color: var(--muted); }

/* ---------------- application form */
.apply-hero { border-radius: 18px; padding: 1.25rem 1.4rem; color: #fff; background: radial-gradient(1200px 300px at 0% 0%, rgba(255,255,255,.18), transparent), linear-gradient(120deg, #4c1d95, #7c3aed 55%, #db2777); position: relative; overflow: hidden; }
.apply-hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.08); }
.stepper { display: flex; gap: .5rem; flex-wrap: wrap; }
.stepper a { display: flex; align-items: center; gap: .45rem; padding: .45rem .8rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-weight: 600; font-size: .8rem; color: var(--muted); }
.stepper a.done { color: var(--ok); border-color: #a7f3d0; background: #ecfdf5; }
.stepper a .n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: #f1f0f7; font-size: .7rem; }
.stepper a.done .n { background: var(--ok); color: #fff; }
.autosave { display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 600; padding: .35rem .75rem; border-radius: 999px; background: #f1f5f9; color: #475569; }
.autosave.saving { background: #fef3c7; color: #92400e; } .autosave.saved { background: #d1fae5; color: #065f46; } .autosave.error { background: #fee2e2; color: #991b1b; }
.form-card { scroll-margin-top: 80px; }
.upload-box { border: 2px dashed #d8d2ee; border-radius: 14px; padding: 1rem; text-align: center; background: #fbfaff; cursor: pointer; transition: .2s; position: relative; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.upload-box:hover, .upload-box.drag { border-color: var(--brand-2); background: #f5f3ff; }
.upload-box img { max-height: 120px; max-width: 100%; border-radius: 8px; object-fit: contain; }
.upload-box input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-box .hint { font-size: .75rem; color: var(--muted); }
.sticky-actions { position: sticky; bottom: 0; z-index: 10; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: .8rem 1rem; border-radius: 0 0 var(--radius) var(--radius); }

/* ---------------- details & timeline */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem 1.2rem; }
.kv div small { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kv div span { font-weight: 600; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.25rem; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 1rem .8rem; }
.timeline li::before { content: ""; position: absolute; left: -1.25rem; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--brand-2); }
.timeline li.last::before { background: var(--brand-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2) 20%, transparent); }
.timeline .t { font-weight: 700; } .timeline .m { color: var(--muted); font-size: .78rem; }
.progress-track { display: flex; justify-content: space-between; position: relative; margin: .5rem 0 1rem; }
.progress-track::before { content: ""; position: absolute; top: 15px; left: 6%; right: 6%; height: 3px; background: var(--line); }
.progress-track .bar { position: absolute; top: 15px; left: 6%; height: 3px; background: linear-gradient(90deg,var(--brand),var(--accent)); transition: width .6s; }
.progress-track .s { position: relative; text-align: center; flex: 1; font-size: .74rem; color: var(--muted); font-weight: 600; }
.progress-track .s i { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto .35rem; background: #fff; border: 2px solid var(--line); color: var(--muted); }
.progress-track .s.on i { background: var(--brand-2); color: #fff; border-color: var(--brand-2); }
.progress-track .s.on { color: var(--ink); }

/* ---------------- query thread */
.thread { display: flex; flex-direction: column; gap: .7rem; }
.msg { max-width: 82%; padding: .7rem .9rem; border-radius: 14px; background: #f4f2fb; border: 1px solid var(--line); }
.msg.me { align-self: flex-end; background: color-mix(in srgb, var(--brand-2) 10%, #fff); border-color: color-mix(in srgb, var(--brand-2) 22%, #fff); }
.msg .who { font-size: .72rem; font-weight: 700; color: var(--muted); margin-bottom: .2rem; }
.msg .att a { display: inline-flex; gap: .3rem; align-items: center; font-size: .78rem; margin: .3rem .4rem 0 0; padding: .2rem .5rem; border-radius: 8px; background: #fff; border: 1px solid var(--line); }

/* ---------------- RBAC matrix */
.perm-matrix th, .perm-matrix td { text-align: center; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }
.perm-matrix .form-check-input { width: 1.1rem; height: 1.1rem; cursor: pointer; }
.module-row td { background: #faf9ff; font-weight: 800; color: var(--brand); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }

/* ---------------- misc */
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty i { font-size: 2.6rem; color: var(--brand-3); display: block; margin-bottom: .5rem; }
.toast-zone { position: fixed; right: 1rem; bottom: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: .5rem; }
.toast-x { min-width: 280px; max-width: 420px; background: #111827; color: #fff; padding: .8rem 1rem; border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.25); display: flex; gap: .6rem; align-items: flex-start; animation: tin .25s ease; }
.toast-x.success i { color: #34d399; } .toast-x.danger i { color: #f87171; } .toast-x.warning i { color: #fbbf24; } .toast-x.info i { color: #60a5fa; }
@keyframes tin { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 160px; }
.nav-pills-soft .nav-link { border-radius: 999px; color: var(--muted); font-weight: 600; padding: .45rem .95rem; }
.nav-pills-soft .nav-link.active { background: var(--brand); color: #fff; }
.nav-pills-soft .nav-link .badge { margin-left: .35rem; }
.payload { white-space: pre-wrap; word-break: break-all; background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: .9rem; font-size: .78rem; max-height: 320px; overflow: auto; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .65rem; border-radius: 999px; background: #f3f0ff; color: var(--brand); font-weight: 600; font-size: .76rem; border: 1px solid #e4dcff; cursor: pointer; }
.chip:hover { background: #e9e3ff; }
.modal-content { border-radius: 18px; border: 0; }
.modal-header { border-bottom: 1px solid var(--line); }
.preview-sig { max-height: 46px; background: repeating-conic-gradient(#f3f4f6 0% 25%, #fff 0% 50%) 50%/12px 12px; border-radius: 6px; padding: 2px; }
@media print { .sidebar, .topbar, .no-print { display: none !important; } .content { padding: 0; } }
