﻿/* ============================================================
   CRSU Transcript Builder — styles
   ============================================================ */

/* ---- Kruti Dev 010 (legacy Devanagari font) ---- */
@font-face {
  font-family: "Kruti Dev 010";
  src: url("fonts/KRDEV010.TTF") format("truetype");
  font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Kruti Dev 010";
  src: url("fonts/Kruti Dev 010 Bold.ttf") format("truetype");
  font-weight: bold; font-style: normal; font-display: swap;
}

/* ---- Arial (Lingaya university name + subtitles) ---- */
@font-face {
  font-family: "Arial Local";
  src: local("Arial"), url("fonts/arial.ttf") format("truetype");
  font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Arial Local";
  src: local("Arial Bold"), url("fonts/arialbd.ttf") format("truetype");
  font-weight: bold; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Arial Local";
  src: local("Arial Italic"), url("fonts/ariali.ttf") format("truetype");
  font-weight: normal; font-style: italic; font-display: swap;
}

/* ---- Palatino Linotype (email + footer line) ---- */
@font-face {
  font-family: "Palatino Local";
  src: local("Palatino Linotype"), url("fonts/pala.ttf") format("truetype");
  font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Palatino Local";
  src: local("Palatino Linotype Bold"), url("fonts/palab.ttf") format("truetype");
  font-weight: bold; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Palatino Local";
  src: local("Palatino Linotype Italic"), url("fonts/palai.ttf") format("truetype");
  font-weight: normal; font-style: italic; font-display: swap;
}

/* ---- DejaVu Sans (ITR acknowledgement font) ---- */
@font-face {
  font-family: "DejaVu Sans";
  src: url("fonts/DejaVuSans.ttf") format("truetype");
  font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "DejaVu Sans";
  src: url("fonts/DejaVuSans-Bold.ttf") format("truetype");
  font-weight: bold; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "DejaVu Sans Condensed";
  src: url("fonts/DejaVuSansCondensed.ttf") format("truetype");
  font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "DejaVu Sans Condensed";
  src: url("fonts/DejaVuSansCondensed-Bold.ttf") format("truetype");
  font-weight: bold; font-style: normal; font-display: swap;
}

:root {
  --blue:    #1c2c5b;
  --blue-2:  #2e5fa3;
  --gold:    #b8860b;
  --red:     #7a0e22;
  --ink:     #000;
  --line:    #000;
  --grid:    #dbe1ee;
  --bg:      #eef2f8;
  --panel:   #fff;
  --muted:   #6b7280;
  --soft:    #f3f6fb;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: Roboto, -apple-system, "Segoe UI", sans-serif; color: #1f2937; background: var(--bg); }

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding: 10px 18px; background: linear-gradient(135deg, var(--blue), var(--blue-2));
  color: white; box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.topbar .brand { display: flex; flex-direction: column; }
.topbar .brand h1 { margin: 0; font-size: 18px; font-weight: 700; }
.topbar .brand small { opacity: .8; font-size: 11.5px; }
.bar-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* Sidebar toggle button */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 6px;
  background: rgba(255,255,255,.14); border: none; cursor: pointer;
  color: white; padding: 0; margin-right: 6px;
  transition: background .15s, transform .15s;
}
.icon-btn:hover  { background: rgba(255,255,255,.26); }
.icon-btn:active { transform: scale(.95); }

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 20px; height: 2.5px; background: currentColor;
  border-radius: 2px; transition: transform .25s, opacity .2s, top .25s;
  position: relative;
}
.hamburger::before, .hamburger::after { content: ""; position: absolute; left: 0; }
.hamburger::before { top: -6px; }
.hamburger::after  { top:  6px; }

/* When menu is open, morph hamburger → "×" */
body.menu-open .hamburger { background: transparent; }
body.menu-open .hamburger::before { top: 0; transform: rotate(45deg)  translate(2px, 3px); }
body.menu-open .hamburger::after  { top: 0; transform: rotate(-45deg) translate(2px,-3px); }

.btn {
  font: inherit; font-size: 13px; font-weight: 500;
  border: none; cursor: pointer; padding: 8px 14px;
  border-radius: 4px; background: rgba(255,255,255,.16); color: white;
  transition: background .15s, transform .05s;
}
.btn:hover { background: rgba(255,255,255,.26); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--gold); }
.btn.primary:hover { background: #946d09; }
.btn.success { background: #198754; }
.btn.success:hover { background: #146c43; }
.btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,.35); }
.btn.ghost:hover { background: rgba(255,255,255,.1); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.file-pick {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; background: rgba(255,255,255,.14);
  border-radius: 4px; font-size: 13px; cursor: pointer;
}
.file-pick input { display: none; }
.file-pick:hover { background: rgba(255,255,255,.22); }

.status {
  flex-basis: 100%; font-size: 12.5px; min-height: 14px; opacity: .92;
  padding: 4px 0 0;
}
.status.ok  { color: #b7fbd5; }
.status.err { color: #ffd5d5; }
.status.busy{ color: #ffe9a8; }

/* ============================================================
   NAV MENU (3 sections: Transcript / LOR-MOI / Experience)
   ============================================================ */
.nav-menu {
  position: fixed;
  left: 14px; top: 70px;
  z-index: 60;
  min-width: 280px;
  background: white;
  border: 1px solid #d8dee9;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  transform-origin: top left;
  animation: navIn .14s ease-out;
}
@keyframes navIn {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.nav-backdrop {
  position: fixed; inset: 0; z-index: 55;
  background: transparent;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 9px 12px;
  background: transparent; border: none; cursor: pointer;
  text-align: left;
  font: inherit; color: #1f2937;
  border-radius: 6px;
  transition: background .12s;
}
.nav-item:hover  { background: #f1f5f9; }
.nav-item.active { background: rgba(28,44,91,.08); }
.nav-item.active .ni-title { color: var(--blue); font-weight: 700; }
.nav-item[hidden] { display: none !important; }
.nav-divider { height: 1px; background: #e5e7eb; margin: 6px 8px; }
.nav-logout:hover { background: #fff1f2 !important; }
.nav-logout:hover .ni-title { color: #dc2626; }
.nav-logout .ni-title { color: #64748b; }
.ni-icon { font-size: 22px; line-height: 1; width: 28px; text-align: center; }
.ni-text { display: flex; flex-direction: column; }
.ni-title {
  font-size: 13.5px; font-weight: 600; color: #1f2937;
}
.ni-sub {
  font-size: 11px; color: #6b7280; margin-top: 1px;
}

/* ============================================================
   DASHBOARD SECTION
   ============================================================ */
.section[data-section="dashboard"]:not([hidden]) {
  display: block;
  overflow: auto;
  background: var(--panel);
}
.dashboard {
  max-width: 1280px; margin: 0 auto;
  padding: 22px 28px 60px;
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.dash-hero {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  color: white;
  padding: 22px 26px;
  border-radius: 10px;
  display: flex; justify-content: space-between; gap: 16px;
  align-items: flex-end; flex-wrap: wrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.10);
}
.dash-hero h2 { margin: 0 0 4px; font-size: 22px; }
.dash-hero p  { margin: 0; opacity: .88; font-size: 13.5px; }
.dash-stats {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.dash-stat {
  background: rgba(255,255,255,.14);
  padding: 10px 16px; border-radius: 6px;
  text-align: center; min-width: 90px;
}
.dash-stat .v { font-size: 22px; font-weight: 700; line-height: 1; }
.dash-stat .l { font-size: 11px; opacity: .85; text-transform: uppercase; letter-spacing: .4px; }

.dash-card {
  background: white;
  border: 1px solid #e3e8f0; border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.dash-card.wide { grid-column: 1 / -1; }
.dash-card h3 {
  margin: 0 0 12px; color: var(--blue);
  font-size: 13.5px; text-transform: uppercase; letter-spacing: .4px;
  padding-bottom: 6px; border-bottom: 1px solid #eef2f8;
}
.dash-card .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; }
.dash-card .field input,
.dash-card .field select {
  padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 4px; font: inherit; font-size: 13px;
}
.dash-card .field small { font-size: 11px; color: var(--muted); }
.dash-card .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dash-card .btn {
  background: var(--blue); color: white;
}
.dash-card .btn:hover { background: var(--blue-2); }
.dash-card .form-status {
  font-size: 12.5px; min-height: 16px; padding-top: 4px;
}
.dash-card .form-status.ok  { color: #166534; }
.dash-card .form-status.err { color: #b91c1c; }
.dash-card .form-status.busy { color: #92400e; }

.users-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.users-table th, .users-table td {
  padding: 7px 10px; border-bottom: 1px solid #eef2f8; text-align: left;
}
.users-table th {
  background: #f5f8fd; color: var(--blue);
  font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  font-weight: 600;
}
.users-table tr.disabled td { color: var(--muted); }
.users-table .role-pill {
  display: inline-block; padding: 2px 8px; border-radius: 11px; font-size: 11.5px; font-weight: 600;
}
.users-table .role-pill.admin { background: #fef3c7; color: #92400e; }
.users-table .role-pill.user  { background: #dbeafe; color: #1e40af; }
.users-table .state-pill {
  display: inline-block; padding: 2px 8px; border-radius: 11px; font-size: 11.5px; font-weight: 600;
}
.users-table .state-pill.active   { background: #dcfce7; color: #14532d; }
.users-table .state-pill.disabled { background: #fee2e2; color: #7f1d1d; }
.users-table .tiny-btn {
  font: inherit; font-size: 11.5px; padding: 4px 8px; cursor: pointer;
  background: white; border: 1px solid #cbd5e1; border-radius: 3px;
  color: #374151; margin-right: 4px;
}
.users-table .tiny-btn.danger { color: #b91c1c; border-color: #fca5a5; }
.users-table .tiny-btn.danger:hover { background: #fef2f2; }
.users-table .tiny-btn.success { color: #166534; border-color: #86efac; }
.users-table .tiny-btn.success:hover { background: #f0fdf4; }

.users-table .pw-cell {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; color: #1f2937;
}
.users-table .pw-cell .pw-dots { letter-spacing: 1px; user-select: none; color: var(--muted); }
.users-table .pw-cell .pw-reveal {
  background: none; border: none; cursor: pointer; padding: 0 4px;
  color: var(--blue); font-size: 12px;
}
.users-table .pw-cell .pw-reveal:hover { text-decoration: underline; }
.users-table .pw-cell .pw-missing { color: var(--muted); font-style: italic; font-size: 11.5px; }

/* ============================================================
   EDIT USER MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
/* hidden attribute must win over display:flex */
.modal-overlay[hidden] { display: none !important; }
.modal-card {
  background: white; border-radius: 10px;
  width: 100%; max-width: 440px;
  padding: 20px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.30);
  animation: navIn .14s ease-out;
}
.modal-card header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.modal-card header h3 { margin: 0; color: var(--blue); font-size: 16px; }
.modal-card .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; }
.modal-card .field input, .modal-card .field select {
  padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 4px; font: inherit; font-size: 13px;
}
.modal-card footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px;
}
.modal-card .btn.primary {
  background: var(--blue); color: white;
}
.modal-card .btn.primary:hover { background: var(--blue-2); }
.icon-btn.ghost { background: transparent; color: #1f2937; }
.icon-btn.ghost:hover { background: #f1f5f9; }

.dash-activity { max-height: 360px; overflow: auto; }
.dash-activity table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dash-activity td { padding: 5px 8px; border-bottom: 1px solid #eef2f8; }
.dash-activity td.when { color: var(--muted); white-space: nowrap; }

.dash-quick {
  display: flex; flex-direction: column; gap: 6px;
}
.dash-quick .btn {
  display: block; text-align: left; padding: 9px 12px;
}

/* ============================================================
   RECORDS SECTION
   ============================================================ */
.section[data-section="records"]:not([hidden]) {
  display: block;
  overflow: auto;
  background: var(--panel);
}
.records-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 28px 60px;
}
.records-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.records-head h2 {
  margin: 0; font-size: 20px; color: var(--blue);
}
.records-hint {
  margin: 4px 0 0; font-size: 13px; color: var(--muted);
}
.records-actions { display: flex; gap: 8px; align-items: center; }
.records-actions input[type=search] {
  padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 4px;
  font: inherit; font-size: 13px; min-width: 240px;
}
.records-actions .btn {
  background: var(--blue); color: white;
}
.records-actions .btn:hover { background: var(--blue-2); }

.records-table-wrap {
  border: 1px solid #e3e8f0;
  border-radius: 8px;
  overflow: auto;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.records-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.records-table thead th {
  position: sticky; top: 0;
  background: var(--blue); color: white;
  font-weight: 600; text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.4px;
  border-bottom: 2px solid #142244;
}
.records-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid #eef2f8;
  color: #1f2937;
}
.records-table tbody tr:hover td { background: #f8fafd; }
.records-table tbody tr.row-action { cursor: pointer; }
.records-table .col-actions { width: 1%; white-space: nowrap; }
.records-table .badge-user {
  display: inline-block;
  background: rgba(28,44,91,.08);
  color: var(--blue);
  padding: 2px 8px; border-radius: 11px;
  font-size: 11.5px; font-weight: 600;
}
.records-table .records-empty {
  text-align: center; color: var(--muted); padding: 28px 12px; font-style: italic;
}
.records-table .row-btn {
  font: inherit; font-size: 12.5px; padding: 5px 10px;
  border: 1px solid var(--blue); background: white; color: var(--blue);
  border-radius: 4px; cursor: pointer;
  transition: background .15s, color .15s;
}
.records-table .row-btn:hover { background: var(--blue); color: white; }
.records-table .row-btn.danger {
  border-color: #dc2626; color: #dc2626;
}
.records-table .row-btn.danger:hover {
  background: #dc2626; color: white;
}

/* ================================================================
   REDESIGNED DASHBOARD
   ================================================================ */
.dashboard {
  padding: 24px 28px 48px;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Welcome banner */
.db-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, #1e3a5f 0%, #1a2f52 60%, #0f2340 100%);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 22px;
  box-shadow: 0 4px 24px rgba(15,35,64,.18);
}
.db-banner-left { display: flex; align-items: center; gap: 16px; }
.db-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.2);
}
.db-greeting {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
}
.db-date {
  margin: 0;
  font-size: 12.5px;
  color: rgba(255,255,255,.6);
}
.db-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255,255,255,.12);
  color: #e0e7ff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.18);
  transition: background .15s;
  white-space: nowrap;
}
.db-admin-link:hover { background: rgba(255,255,255,.2); color: #fff; }
.db-logout-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.7);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,.14);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.db-logout-btn:hover { background: rgba(220,38,38,.3); color: #fca5a5; border-color: rgba(220,38,38,.4); }

/* KPI row */
.db-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.db-kpi {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(15,23,42,.06);
  transition: box-shadow .2s, transform .2s;
  position: relative;
  overflow: hidden;
}
.db-kpi::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 99px 99px 0 0;
}
.db-kpi:hover { box-shadow: 0 8px 20px rgba(15,23,42,.1); transform: translateY(-2px); }
.db-kpi-blue::before   { background: #3b82f6; }
.db-kpi-teal::before   { background: #0d9488; }
.db-kpi-violet::before { background: #7c3aed; }
.db-kpi-amber::before  { background: #d97706; }
.db-kpi-icon { font-size: 22px; flex-shrink: 0; }
.db-kpi-val   { font-size: 24px; font-weight: 800; letter-spacing: -.04em; line-height: 1; color: #0f172a; }
.db-kpi-label { font-size: 11.5px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-top: 3px; }

/* Section label */
.db-section-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #94a3b8;
  margin-bottom: 10px;
}

/* Quick actions grid */
.db-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.db-action-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  box-shadow: 0 1px 3px rgba(15,23,42,.05);
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.db-action-card:hover {
  box-shadow: 0 6px 16px rgba(15,23,42,.1);
  transform: translateY(-2px);
  border-color: #c7d2fe;
}
.db-action-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  font-size: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.db-action-card div { display: flex; flex-direction: column; min-width: 0; }
.db-action-card strong { font-size: 13.5px; color: #0f172a; font-weight: 700; }
.db-action-card span  { font-size: 11.5px; color: #64748b; margin-top: 2px; }

/* Recent records list */
.db-recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.db-rec-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  width: 100%;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
  transition: background .15s, box-shadow .15s;
}
.db-rec-card:hover { background: #fafbff; box-shadow: 0 4px 10px rgba(15,23,42,.07); border-color: #c7d2fe; }
.db-rec-icon { font-size: 18px; flex-shrink: 0; }
.db-rec-body { flex: 1; min-width: 0; }
.db-rec-body strong { display: block; font-size: 14px; color: #0f172a; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-rec-body span   { display: block; font-size: 12px; color: #64748b; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-rec-date { font-size: 12px; color: #94a3b8; white-space: nowrap; flex-shrink: 0; }
.db-recent-loading { padding: 24px; text-align: center; color: #94a3b8; font-size: 13px; }
.db-empty { padding: 24px; text-align: center; color: #94a3b8; font-size: 13px; background: #f8fafc; border-radius: 10px; border: 1px dashed #e2e8f0; }

/* Account form card */
.db-form-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 22px;
  box-shadow: 0 1px 3px rgba(15,23,42,.05);
}
.db-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}
.db-form-card .field { display: flex; flex-direction: column; gap: 5px; }
.db-form-card .field span { font-size: 12px; font-weight: 700; color: #334155; text-transform: uppercase; letter-spacing: .04em; }
.db-form-card .field input,
.db-form-card .field input[type="file"] { font-size: 13.5px; }

/* Section placeholder styling */
.coming-soon {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 60px 40px;
  background: var(--panel);
}
.coming-soon .cs-icon {
  font-size: 56px; margin-bottom: 14px; opacity: .75;
}
.coming-soon h2 {
  margin: 0 0 8px; color: var(--blue); font-size: 22px;
}
.coming-soon p {
  margin: 4px 0; color: #374151; font-size: 14px; max-width: 480px;
}
.coming-soon .cs-sub {
  margin-top: 14px; color: var(--muted); font-style: italic; font-size: 13px;
}

/* ============================================================
   SETTINGS PANEL
   ============================================================ */
.settings-panel {
  position: fixed; right: 12px; top: 72px; z-index: 50;
  width: 320px; padding: 16px 18px;
  background: white; border: 1px solid #e3e8f0; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.settings-panel h3 { margin: 0 0 12px; color: var(--blue); }
.settings-panel .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 13px; }
.settings-panel .field input,
.settings-panel .field select { padding: 7px 9px; border: 1px solid #cbd5e1; border-radius: 4px; font: inherit; font-size: 13px; }
.settings-panel small { color: var(--muted); font-size: 11px; }
.logo-uploads { padding-top: 6px; border-top: 1px dashed #d8dee9; }

/* ============================================================
   MAIN LAYOUT — each section is a standalone full-height container.
   Only the currently selected section is shown; the rest stay
   display:none until the menu switches to them.
   ============================================================ */
.layout { height: calc(100vh - 64px); }

.section { display: none; height: 100%; }
.section:not([hidden]) { display: block; }

/* Transcript section: 3-column grid (editor + handle + preview) */
.section[data-section="transcript"]:not([hidden]) {
  display: grid;
  grid-template-columns: 380px 6px 1fr;
}

/* Draggable resize handle */
.resize-handle {
  width: 6px;
  cursor: col-resize;
  background: #d8dee9;
  position: relative;
  z-index: 5;
  transition: background .15s;
}
.resize-handle:hover,
.resize-handle.dragging {
  background: #94a3b8;
}
.resize-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 32px;
  border-radius: 2px;
  background: #94a3b8;
}
.resize-handle:hover::after,
.resize-handle.dragging::after {
  background: #475569;
}

/* LOR section: tab-bar on top, editor+preview below */
.section[data-section="lor"]:not([hidden]) {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}
.lor-content {
  display: grid;
  grid-template-columns: 380px 1fr;
  overflow: hidden;
  min-height: 0;
}
.lor-content .editor,
.lor-content .preview-wrap { min-height: 0; }

/* Tab bar */
.lor-tabbar {
  background: white;
  border-bottom: 1px solid #d8dee9;
  padding: 8px 16px 6px;
}
.lor-tabbar .tab-row {
  display: flex; gap: 4px; align-items: center;
}
.lor-tabbar .tab-row.sub {
  margin-top: 6px;
  padding-left: 6px;
  border-top: 1px dashed #e3e8f0;
  padding-top: 6px;
}
.subtab-label {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px;
  margin-right: 6px;
}
.lor-tabbar .tab,
.lor-tabbar .subtab {
  background: transparent; border: none; cursor: pointer;
  padding: 6px 14px; border-radius: 4px;
  font: inherit; font-size: 13px; color: #6b7280;
  font-weight: 500;
  transition: background .12s, color .12s;
}
.lor-tabbar .tab.active,
.lor-tabbar .subtab.active {
  background: rgba(28,44,91,.10);
  color: var(--blue);
  font-weight: 700;
}
.lor-tabbar .tab:hover,
.lor-tabbar .subtab:hover { background: #f1f5f9; color: #1f2937; }
.lor-tabbar .subtab { padding: 4px 10px; font-size: 12.5px; }

.editor {
  background: var(--panel); border-right: 1px solid #d8dee9;
  overflow-y: auto; padding: 14px 16px;
}
.preview-wrap {
  overflow-y: auto; padding: 22px;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}

/* ============================================================
   EDITOR (left panel)
   ============================================================ */
.ed-card {
  background: white; border: 1px solid #e3e8f0; border-radius: 6px;
  padding: 12px 14px; margin-bottom: 10px;
}
.ed-card > h3 {
  margin: 0 0 10px; font-size: 12px; color: var(--blue);
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid #eef2f8; padding-bottom: 5px;
}
.ed-card .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.ed-card .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px 10px; }
.ed-field { display: flex; flex-direction: column; }
.ed-field > label {
  font-size: 10.5px; color: #6b7280; text-transform: uppercase;
  letter-spacing: .4px; margin-bottom: 2px;
}
.ed-field > input, .ed-field > textarea, .ed-field > select {
  padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 3px;
  font: inherit; font-size: 13px; background: white;
}
.ed-field > input:focus, .ed-field > textarea:focus, .ed-field > select:focus {
  outline: none; border-color: var(--blue-2);
  box-shadow: 0 0 0 2px rgba(46,95,163,.18);
}

.ed-sem {
  background: #fafbfd; border: 1px solid #dde3ee; border-radius: 5px;
  padding: 10px 12px; margin: 8px 0;
}
.ed-sem-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.ed-sem-head h4 { margin: 0; font-size: 12px; color: var(--blue); }
.ed-sem-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.ed-sem-meta .ed-field > label { font-size: 9.5px; }
.ed-sem-meta .ed-field > input { padding: 4px 7px; font-size: 12px; }

.ed-subjects {
  width: 100%; border-collapse: collapse; font-size: 11.5px;
}
.ed-subjects th, .ed-subjects td { padding: 2px 3px; border: 1px solid #e3e8f0; }
.ed-subjects th { background: var(--blue); color: white; font-size: 10px; font-weight: 600; }
.ed-subjects td input {
  width: 100%; padding: 3px 5px; border: 1px solid transparent;
  background: transparent; font: inherit; font-size: 11.5px;
  border-radius: 2px;
}
.ed-subjects td input:focus { background: white; border-color: var(--blue-2); outline: none; }
.ed-subjects .col-n { width: 52px; }
.ed-subjects td.x { width: 22px; text-align: center; }
.ed-subjects tr.qual td { background: #fffde7; }

.tiny-btn {
  font: inherit; font-size: 10.5px; padding: 3px 7px; cursor: pointer;
  background: white; border: 1px solid #cbd5e1; border-radius: 3px;
  color: #374151;
}
.tiny-btn:hover { background: #f1f5f9; }
.tiny-btn.danger { color: #b91c1c; border-color: #fca5a5; }
.tiny-btn.danger:hover { background: #fef2f2; }
.tiny-btn.add { background: var(--gold); color: white; border-color: var(--gold); }
.tiny-btn.add:hover { background: #946d09; }

/* ============================================================
   A4 PREVIEW PAGE
   ============================================================ */
.a4-page {
  width: 210mm; min-height: 297mm; background: white;
  /* Minimum print-safe margins (top/sides), extra room reserved at the
     bottom for the signature block. */
  padding: 6mm 6mm 30mm;
  box-shadow: 0 4px 18px rgba(0,0,0,.15);
  font-family: "Times New Roman", Times, serif;
  font-size: 10pt; color: black; line-height: 1.25;
  position: relative;
  overflow: hidden;
  /* Watermark background (CRSU seal, very faded) */
  background-image: url("transcript_assets/crsu_back_logo.png");
  background-repeat: no-repeat;
  background-position: center 55%;
  background-size: 130mm 130mm;
}

/* Add a hard bottom margin to the marks table so even when no signature
   is visible, the table never bleeds into the footer reserved area. */
.marks { margin-bottom: 4mm; }

/* Header band */
.tr-header {
  display: grid;
  grid-template-columns: 24mm 1fr 28mm;
  gap: 6mm; align-items: center;
  padding-bottom: 3mm;
  margin-bottom: 5mm;
  position: relative;
}
.tr-header::after {
  /* Decorative divider line (provided by user) */
  content: "";
  display: block;
  position: absolute;
  left: 0; right: 0; bottom: -1mm;
  height: 3mm;
  background-image: url("transcript_assets/crsu_line.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.tr-header img { max-width: 100%; max-height: 24mm; display: block; margin: 0 auto; position: relative; z-index: 1; }
.tr-header .uni-hi {
  /* Prefer Kruti Dev 010 if installed locally; fall back to Devanagari Unicode fonts */
  font-family: "Kruti Dev 010", "Kruti Dev", "Mangal", "Noto Sans Devanagari", serif;
  color: #606060;
  font-size: 21pt; font-weight: 800; line-height: 1.05; text-align: center;
  margin: 0 0 1.2mm;
  white-space: nowrap;          /* keep on a single line */
  letter-spacing: -0.2px;       /* slight squeeze for safety */
}
.tr-header .uni-en {
  font-weight: bold; font-size: 15pt; text-align: center;
  font-family: "Times New Roman", Times, serif;
  color: #606060;
  margin: 0 0 0.8mm;
  line-height: 1.15;
}
.tr-header .uni-sub {
  font-style: italic; font-weight: 600; font-size: 11pt; text-align: center;
  font-family: "Times New Roman", Times, serif;
  color: #606060;
  line-height: 1.15;
}

/* Everything except the watermark sits above it */
.a4-page > * { position: relative; z-index: 1; }

/* Info strip (branch | phone/email) */
.tr-info {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin: 0 0 1mm;
  font-family: "Times New Roman", Times, serif;
  line-height: 1.15;
}
.tr-info .left  { font-weight: bold; font-size: 11.5pt; }
.tr-info .right { text-align: right; font-size: 11pt; font-weight: 600; }
.tr-info a { color: #0000ee; text-decoration: underline; }

/* Title strip — row 1: NO. (left) + Dated (right), row 2: Transcript (centered) */
.tr-title {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "no    dated"
    "name  name";
  gap: 0.5mm 4mm;
  align-items: center;
  margin: 0.5mm 0 1mm;
  font-family: "Times New Roman", Times, serif;
  line-height: 1.15;
}
.tr-title .no    { grid-area: no;    text-align: left;   font-style: italic; font-weight: bold; font-size: 11pt; }
.tr-title .dated { grid-area: dated; text-align: right;  font-style: italic; font-weight: bold; font-size: 11pt; }
.tr-title .name  { grid-area: name;  text-align: center; font-weight: bold;  font-size: 14pt; margin-top: 0; }
.tr-title .no u, .tr-title .dated u { text-decoration: underline; }

/* Student details — 2-column × 2-row grid.
   Both right-column items ("Registration No:" / "Father's Name :")
   share the same left edge automatically. */
.tr-student {
  display: grid;
  grid-template-columns: 105mm 1fr;
  gap: 0.6mm 4mm;
  margin: 1mm 0 2.5mm;
  font-weight: bold; font-size: 11.5pt; line-height: 1.15;
  font-family: "Times New Roman", Times, serif;
  white-space: nowrap;
}

/* Section title */
.tr-section-title {
  text-align: center; font-weight: bold; font-size: 12.5pt;
  margin: 1mm 0 3mm;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-family: "Times New Roman", Times, serif;
  letter-spacing: 0.2px;
}

/* Marks table */
.marks {
  width: 100%; border-collapse: collapse; font-size: 10.5pt;
  border: 1px solid black;
  font-family: "Times New Roman", Times, serif;
}
.marks th, .marks td {
  border: 1px solid black;
  padding: 0.35mm 1.8mm;     /* tighter vertical padding */
  vertical-align: middle;
  line-height: 1.1;          /* tighter line spacing */
}
.marks th { background: white; font-weight: bold; }
.marks .sem-row td {
  font-weight: bold; padding: 0.8mm 1.5mm;
  background: white;
  /* Top-align every section-header cell so the first line of the spanning
     course/sem text sits on the same baseline as the column titles
     ("Marks Obtained" / "Minimum Pass Marks" / "Maximum Marks"). */
  vertical-align: top;
}
.marks .sem-row .col-h {
  text-align: center; font-weight: bold;
  border-bottom: 1px solid black;
  vertical-align: top;
}
.marks .sem-row.divider td { border-top: 2px solid black; }

.marks td.subj { padding-left: 2mm; }
.marks td.center { text-align: center; }
.marks tr.total td {
  font-weight: bold; border-top: 1px solid black;
  padding: 0.8mm 1.5mm;
}
.marks tr.total td.center { font-size: 11pt; }

.marks tr.summary-top td { border-top: 2px solid black; }

/* Two-value cell (theory + internal, date + min) */
.dual {
  display: inline-flex; gap: 3mm; align-items: center; justify-content: center;
}

/* Signature block (no stamp) */
.tr-sign {
  position: absolute;
  right: 6mm; bottom: 12mm;
  text-align: left;
  font-weight: bold; font-size: 11pt; line-height: 1.4;
  font-family: "Times New Roman", Times, serif;
}
.tr-sign .sig-text { position: relative; }

/* ============================================================
   LOR (Letter of Recommendation) preview styles
   ============================================================ */
.lor-refdate {
  display: flex; justify-content: space-between;
  margin: 8mm 0 6mm;
  font-size: 11.5pt; font-weight: 600;
  font-family: "Times New Roman", Times, serif;
}

/* Lingaya-specific Ref.No/Date row — 10 mm from each page edge */
.lor-refdate.lingaya-refdate {
  margin-left:  4mm;        /* + .a4-page padding 6mm = 10mm total */
  margin-right: 4mm;
}

/* Lingaya body (title + paragraphs + signature) — 15 mm from each page edge,
   rendered in Arial (matches the reference PDF) */
.lingaya-page .lor-title,
.lingaya-page .lor-body,
.lingaya-page .lingaya-sign {
  margin-left:  9mm;        /* + .a4-page padding 6mm = 15mm total */
  margin-right: 9mm;
  font-family: "Arial Local", Arial, sans-serif;
}
.lor-title {
  text-align: center; font-weight: bold; font-size: 13pt;
  text-decoration: underline; text-underline-offset: 3px;
  margin: 0 0 6mm;
  font-family: "Times New Roman", Times, serif;
  letter-spacing: 0.3px;
}
.lor-body {
  font-size: 11.5pt; line-height: 1.45;
  font-family: "Times New Roman", Times, serif;
  text-align: justify;
}
.lor-body p { margin: 0 0 3.5mm; }
.lor-body p:last-child { margin-bottom: 0; }

.lor-hod {
  position: absolute;
  left: 6mm; bottom: 12mm;
  font-weight: bold; font-size: 11pt; line-height: 1.4;
  font-family: "Times New Roman", Times, serif;
}

/* ============================================================
   Lingaya-specific letterhead
   ============================================================ */
.lingaya-header {
  display: grid;
  grid-template-columns: 27.609mm 1fr;
  gap: 4mm;
  align-items: center;
  padding: 0 0 1mm;
  position: relative;
}
.lingaya-header img {
  width: 27.609mm; height: 35.895mm;
  display: block;
  object-fit: contain;
  margin-left: 3mm;     /* shift logo right to match the original PDF layout */
}
.lingaya-header .uni-name {
  font-family: "Arial Local", Arial, sans-serif;
  font-weight: bold;
  font-size: 27.658pt;
  line-height: 1.05;
  color: #000;
  text-align: center;
  margin: 0 0 1mm;
  white-space: nowrap;          /* stay on one line */
  letter-spacing: -0.1px;       /* tiny squeeze, safety */
}
.lingaya-header .uni-sub1,
.lingaya-header .uni-sub2 {
  font-family: "Arial Local", Arial, sans-serif;
  font-weight: normal;
  font-size: 13.488pt;
  line-height: 1.2;
  color: #000;
  text-align: center;
}
.lingaya-header .uni-email {
  position: absolute;
  right: 0; bottom: 3mm;
  font-family: "Palatino Local", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-weight: bold;
  font-size: 10.5pt;
  color: #000;
}

/* Decorative tri-coloured line image (red / orange / yellow).
   Pulled outward with negative margins so it sits 1 mm from each page
   edge (page has 6 mm side padding, line bleeds out by 5 mm). */
.lingaya-divider {
  display: block;
  height: 2.2mm;
  margin: 1mm -5mm 5mm;
  background-image: url("lor_assets/lingaya_line.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.lingaya-footer {
  position: absolute;
  left: 6mm; right: 6mm; bottom: 8mm;
  text-align: center;
  font-family: "Palatino Local", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 10.5pt;
  padding-top: 2mm;
}
.lingaya-footer::before {
  content: "";
  display: block;
  position: absolute;
  left: 0; right: 0; top: -1mm;
  height: 1.8mm;
  background-image: url("lor_assets/lingaya_line.png");
  background-repeat: no-repeat; background-size: 100% 100%;
}
.lingaya-footer b { font-weight: bold; }

.lingaya-sign {
  margin-top: 6mm;
  font-family: "Times New Roman", Times, serif;
  font-size: 11.5pt;
}
.lingaya-sign .sincerely { margin-bottom: 12mm; }
.lingaya-sign .authority { font-weight: bold; padding-left: 4mm; }

/* ============================================================
   PRINT — vector, pixel-perfect, selectable text
   ============================================================ */
@page { size: A4; margin: 0; }

@media print {
  /* Force colour & background printing (Chrome / Edge / Safari) */
  html, body, .a4-page {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  html, body { background: white !important; margin: 0 !important; padding: 0 !important; }
  .no-print { display: none !important; }

  /* Strip browser scrollbars / layouts that affect print flow */
  .layout         { display: block !important; height: auto !important; overflow: visible !important; }
  .preview-wrap   { display: block !important; padding: 0 !important; gap: 0 !important;
                    overflow: visible !important; }
  .editor         { display: none !important; }

  /* Each transcript page renders at the exact A4 size, no scaling */
  .a4-page {
    box-shadow: none !important;
    margin: 0 !important;
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    page-break-after: always;
    break-after: page;
    overflow: hidden;
  }
  .a4-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }
}

/* =================== Login + Admin additions =================== */
.auth-page,
.admin-page {
  min-height: 100vh;
  background: #f4f7fb;
}
.auth-card {
  width: min(420px, calc(100% - 28px));
  margin: 9vh auto 0;
  background: #fff;
  border: 1px solid #dfe7f1;
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 18px 50px rgba(28, 43, 70, .10);
}
.auth-card h1 { margin: 0 0 6px; font-size: 24px; }
.auth-card p { margin: 0 0 18px; color: #607087; }
.form-status { margin-top: 10px; font-size: 13px; }
.form-status.ok { color: #0b7a36; }
.form-status.err { color: #b42318; }
.form-status.busy { color: #0b5cad; }
.settings-note {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #dfe7f1;
  border-radius: 12px;
  background: #f8fbff;
}
.settings-note small,
.session-user,
.muted {
  color: #5d6b7e;
  font-size: 13px;
}
.admin-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
  padding: 18px;
}
.admin-card {
  background: #fff;
  border: 1px solid #dfe7f1;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 32px rgba(28, 43, 70, .08);
}
.admin-card h2 { margin: 0 0 10px; font-size: 18px; }
.admin-card.wide { grid-column: 1 / -1; }
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 10px;
}
.table-wrap { overflow: auto; border: 1px solid #e5edf7; border-radius: 12px; }
.admin-card table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-card th,
.admin-card td { padding: 9px 10px; border-bottom: 1px solid #eef3f8; text-align: left; vertical-align: top; }
.admin-card th { background: #f6f9fd; font-weight: 700; color: #2e3a4c; }
.json-view {
  max-height: 380px;
  overflow: auto;
  background: #101828;
  color: #f8fafc;
  padding: 14px;
  border-radius: 12px;
  margin-top: 12px;
  font-size: 12px;
}
@media (max-width: 760px) {
  .admin-layout { grid-template-columns: 1fr; padding: 12px; }
  .admin-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   MARRIAGE CERTIFICATE SECTION
   ============================================================ */

/* ── Editor ───────────────────────────────────────────────── */
.mc-editor { padding: 16px 14px 24px; display: flex; flex-direction: column; gap: 10px; }
.mc-section-title { font-size: 10.5px; font-weight: 700; letter-spacing:.08em; text-transform:uppercase; color:#64748b; margin-bottom:2px; }
.mc-row  { display:flex; flex-direction:column; gap:6px; }
.mc-2col { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.mc-two-col-form { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.mc-field { display:flex; flex-direction:column; gap:4px; font-size:11.5px; font-weight:600; color:#374151; }
.mc-field input,.mc-field textarea,.mc-field select {
  padding:7px 10px; border:1.5px solid #d1d5db; border-radius:6px;
  font-size:12.5px; font-family:inherit; color:#111827; background:#fff;
  transition:border-color .15s,box-shadow .15s;
}
.mc-field input:focus,.mc-field textarea:focus { outline:none; border-color:#6366f1; box-shadow:0 0 0 3px rgba(99,102,241,.12); }
.mc-field textarea { resize:vertical; min-height:50px; }
.mc-field input[type="file"] { padding:5px 8px; font-size:11.5px; }
.mc-person-title { font-size:12.5px; font-weight:700; margin-bottom:8px; padding:5px 10px; border-radius:6px; }
.bride-color { background:#fdf2f8; color:#9d174d; border-left:3px solid #ec4899; }
.groom-color { background:#eff6ff; color:#1e40af; border-left:3px solid #3b82f6; }
.mc-divider  { height:1px; background:#e5e7eb; margin:4px 0; }
.mc-actions  { display:flex; gap:10px; margin-top:6px; padding-top:10px; border-top:1px solid #e5e7eb; }

/* ── Preview wrapper ──────────────────────────────────────── */
.mc-preview-wrap {
  padding: 24px;
  background: #6b7280;
  min-height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: auto;
  box-sizing: border-box;
}

/* Scaler outer — holds the visual footprint of the scaled page.
   Page coordinate system = original PDF points (A4 landscape 841.7 × 595.4). */
.mc-page-scaler {
  width: 657px;   /* 841.7 × 0.78 */
  height: 465px;  /* 595.4 × 0.78 */
  position: relative;
  flex-shrink: 0;
}

/* ── Certificate page — exact PDF point grid (1px = 1pt) ───── */
.mc-page {
  width: 841.7px;
  height: 595.4px;
  position: absolute;
  top: 0;
  left: 0;
  transform: scale(0.78);
  transform-origin: top left;
  background: url('/mc_assets/mc_img_0.png') no-repeat 0 0 / 100% 100%;
  box-shadow: 0 6px 40px rgba(0,0,0,.40);
  font-family: Helvetica, Arial, sans-serif;
  color: #000;
  overflow: hidden;
  box-sizing: border-box;
}

/* ── Absolute-positioned cert text (coords baked into inline styles) ── */
.mc-abs {
  position: absolute;
  line-height: 1;
  font-family: Helvetica, Arial, sans-serif;
  color: #000;
  white-space: nowrap;
  margin: 0;
}
.mc-abs.b { font-weight: bold; }

/* ── eDisHa block — TOP RIGHT (PDF: label x≈592.8, top≈54.7) ─ */
.mc-edisha-block {
  position: absolute;
  top: 49px;
  left: 585px;
  z-index: 2;
  display: flex;
  align-items: stretch;
  gap: 0;
}
.mc-edisha-label {
  background: #000;
  color: #fff;
  font-family: Helvetica, Arial, sans-serif;
  font-weight: bold;
  font-size: 9px;
  padding: 2px 7px;
  line-height: 1.45;
  white-space: nowrap;
}
.mc-edisha-num {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 9px;
  color: #000;
  padding: 2px 6px;
  line-height: 1.45;
  white-space: nowrap;
  border: 1px solid #000;
  border-left: none;
  background: #fff;
}

/* ── Couple photo — PDF: x0=568.1 top=203.8 w=170.2 h=98.7 ──
   Crop frame + draggable inner image (pannable / zoomable). */
.mc-couple-frame {
  position: absolute;
  left: 568.1px;
  top: 203.8px;
  width: 170.2px;
  height: 98.7px;
  overflow: hidden;
}
.mc-couple-frame img {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  max-width: none;
  cursor: move;
  user-select: none;
  -webkit-user-drag: none;
}
.mc-couple-placeholder {
  position: absolute;
  left: 568.1px;
  top: 203.8px;
  width: 170.2px;
  height: 98.7px;
  border: 1px solid #bbb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #999;
  text-align: center;
  background: rgba(255,255,255,0.35);
}

/* ── QR — PDF: x0=111.9 top=432.5  68×68 ─────────────────── */
.mc-qr-render {
  position: absolute;
  left: 111.9px;
  top: 432.5px;
  width: 68px;
  height: 68px;
}
.mc-qr-render canvas,
.mc-qr-render img { width: 68px !important; height: 68px !important; display: block; }

/* ── Stamp — PDF: x0=581.5 top=449.4 w=144 h=57.2 ────────── */
.mc-stamp-img {
  position: absolute;
  left: 581.5px;
  top: 449.4px;
  width: 144px;
  height: 57.2px;
  object-fit: contain;
  display: block;
}

/* ── Disclaimer rule — PDF: x0=247 x1=573.5 top=524.1 ────── */
.mc-disclaimer-rule {
  position: absolute;
  left: 247px;
  top: 524.1px;
  width: 326.5px;
  height: 0;
  border-top: 1px solid #000;
}
/* ── Disclaimer text — PDF: top=527, centered, black 8pt ─── */
.mc-disclaimer-p {
  position: absolute;
  left: 0;
  right: 0;
  top: 527px;
  text-align: center;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 8px;
  color: #000;
  margin: 0;
  line-height: 1;
}
.mc-disclaimer-p a { color: #000; text-decoration: none; }

/* ── Centered intro lines (left:0;right:0;text-align:center) ─ */
.mc-abs-center {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  line-height: 1;
  font-family: Helvetica, Arial, sans-serif;
  color: #000;
  margin: 0;
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
  .mc-preview-wrap { padding: 0 !important; background: none !important; }
  .mc-page-scaler  { width: 841.7px !important; height: 595.4px !important; }
  .mc-page {
    transform: none !important;
    box-shadow: none !important;
    width: 841.7px !important;
    height: 595.4px !important;
  }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1200px) {
  .mc-page-scaler { width: 555px; height: 393px; }
  .mc-page { transform: scale(0.66); }
}
@media (max-width: 900px) {
  .mc-two-col-form { grid-template-columns: 1fr; }
  .mc-2col { grid-template-columns: 1fr 1fr; }
  .mc-page-scaler { width: 438px; height: 310px; }
  .mc-page { transform: scale(0.52); }
}


/* ============================================================
   ITR ACKNOWLEDGEMENT SECTION
   ============================================================ */

/* ── Preview wrapper ──────────────────────────────────────── */
.itr-preview-wrap {
  padding: 24px;
  background: #6b7280;
  min-height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: auto;
  box-sizing: border-box;
}

/* Scaler — A4 portrait at 1pt=1px: 595×842 zoomed to 0.69 → 411×581 */
.itr-page-scaler {
  width: 411px;
  height: 581px;
  position: relative;
  flex-shrink: 0;
}

/* A4 page — 595×842px (1 PDF point = 1 px) for coordinate-exact layout.
   Scaled with `zoom` (not transform:scale) so the SVG border grid re-renders
   crisply at the display size instead of being raster-downscaled into dots. */
.itr-page {
  width: 595px;
  height: 842px;
  position: absolute;
  top: 0; left: 0;
  zoom: 0.69;
  background: #fff;
  box-shadow: 0 6px 40px rgba(0,0,0,.40);
  font-family: "DejaVu Sans", Arial, sans-serif;
  color: #000;
  box-sizing: border-box;
  overflow: hidden;
}

/* Income Tax Department emblem watermark — exact original placement */
.itr-watermark {
  position: absolute;
  left: 29.9px;
  top: 50.2px;
  width: 535.4px;
  height: 689.7px;
  object-fit: fill;
  pointer-events: none;
  z-index: 0;
}

/* Coordinate-positioned text + border lines */
.itr-lines { position: absolute; top: 0; left: 0; width: 595px; height: 842px; pointer-events: none; z-index: 1; }
/* Keep border strokes a crisp constant width regardless of the page's scale
   transform, so thin lines render solid (not broken/dotted) in the preview. */
.itr-lines line { vector-effect: non-scaling-stroke; }
.itr-t { z-index: 2; }
.itr-rot { z-index: 2; }
.itr-t {
  position: absolute;
  line-height: 1;
  white-space: nowrap;
  font-family: "DejaVu Sans", Arial, sans-serif;
  color: #000;
}
.itr-t.b { font-weight: bold; }
.itr-t.r { text-align: right; }
.itr-t.c { text-align: center; }
.itr-rot {
  position: absolute;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center center;
  white-space: nowrap;
  font-weight: bold;
  font-size: 7.9px;
  font-family: "DejaVu Sans", Arial, sans-serif;
  color: #000;
  z-index: 2;
}

/* ── Top bar: Ack No + Date ──────────────────────────────── */
.itr-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10pt;
  font-weight: bold;
  margin-bottom: 8px;
  border-bottom: 1.5px solid #000;
  padding-bottom: 4px;
}

/* ── Title block ─────────────────────────────────────────── */
.itr-title {
  text-align: center;
  font-size: 13pt;
  font-weight: bold;
  margin: 6px 0 2px;
  letter-spacing: 0.3px;
}
.itr-subtitle {
  text-align: center;
  font-size: 7.5pt;
  margin: 0 0 1px;
  line-height: 1.35;
  color: #333;
}
.itr-rule-ref {
  text-align: center;
  font-size: 8pt;
  margin: 0 0 6px;
  color: #333;
}

/* ── Main info table ─────────────────────────────────────── */
.itr-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9pt;
  margin-bottom: 6px;
}
.itr-info-table td,
.itr-info-table th {
  border: 1px solid #000;
  padding: 3px 6px;
  vertical-align: top;
  text-align: left;
}
.itr-info-table .itr-lbl {
  font-weight: bold;
  background: #f5f5f5;
  width: 120px;
  white-space: nowrap;
}
.itr-info-table .itr-val {
  font-weight: normal;
}
.itr-ay-cell {
  font-weight: bold;
  text-align: center;
  background: #f5f5f5;
  width: 90px;
}
.itr-ay-val {
  font-weight: bold;
  font-size: 11pt;
  text-align: center;
  width: 80px;
}

/* ── Tax details — two-column table ──────────────────────── */
.itr-tax-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8.5pt;
  margin-bottom: 6px;
}
.itr-tax-table td,
.itr-tax-table th {
  border: 1px solid #000;
  padding: 2.5px 5px;
  vertical-align: middle;
}
.itr-tax-table th {
  background: #f0f0f0;
  font-weight: bold;
  text-align: center;
  font-size: 9pt;
}
.itr-tax-lbl {
  text-align: left;
  font-weight: normal;
}
.itr-tax-sno {
  text-align: center;
  font-weight: bold;
  width: 24px;
}
.itr-tax-val {
  text-align: right;
  font-weight: normal;
  width: 90px;
  font-family: "Courier New", monospace;
}

/* ── Verification paragraph ──────────────────────────────── */
.itr-verify-p {
  font-size: 8.5pt;
  line-height: 1.5;
  margin: 6px 0;
  text-align: justify;
  border: 1px solid #000;
  padding: 6px 8px;
}
.itr-verify-bold {
  font-weight: bold;
}

/* ── QR / Barcode footer ─────────────────────────────────── */
.itr-qr-band {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid #000;
  padding: 6px 8px;
  margin-bottom: 6px;
}
.itr-qr-left {
  flex-shrink: 0;
  text-align: center;
}
.itr-qr-label {
  font-size: 7.5pt;
  font-weight: bold;
  margin-bottom: 4px;
  white-space: nowrap;
}
.itr-qr-render {
  width: 90px;
  height: 90px;
}
.itr-qr-string {
  flex: 1;
  font-size: 7pt;
  font-family: "Courier New", monospace;
  word-break: break-all;
  line-height: 1.4;
  align-self: center;
}

/* ── Do not send notice ──────────────────────────────────── */
.itr-notice {
  text-align: center;
  font-size: 10pt;
  font-weight: bold;
  border: 2px solid #000;
  padding: 5px;
  background: #f9f9f9;
  letter-spacing: 0.3px;
}

/* ── ITR Form editor ─────────────────────────────────────── */
.itr-form-section {
  margin-bottom: 16px;
}
.itr-form-section h3 {
  font-size: 14px;
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #ddd;
  color: var(--text);
}
.itr-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
.itr-form-grid.itr-1col {
  grid-template-columns: 1fr;
}
.itr-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--text-muted);
}
.itr-form-grid label span {
  font-weight: 600;
  color: var(--text);
}
.itr-form-grid input,
.itr-form-grid select,
.itr-form-grid textarea {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
}

/* ── ITR Print ───────────────────────────────────────────── */
@media print {
  .itr-preview-wrap { padding: 0 !important; background: none !important; }
  .itr-page-scaler  { width: 595px !important; height: 842px !important; }
  .itr-page {
    zoom: 1 !important;
    transform: none !important;
    box-shadow: none !important;
    width: 595px !important;
    height: 842px !important;
  }
}

/* ── ITR Responsive ──────────────────────────────────────── */
@media (max-width: 1200px) {
  .itr-page-scaler { width: 357px; height: 505px; }
  .itr-page { zoom: 0.60; }
}
@media (max-width: 900px) {
  .itr-form-grid { grid-template-columns: 1fr; }
  .itr-page-scaler { width: 298px; height: 421px; }
  .itr-page { zoom: 0.50; }
}


/* ============================================================
   ITR DOCUMENT-TYPE TABS
   ============================================================ */
.itr-year-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.itr-year-tab {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft, #f1f3f5);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
}
.itr-year-tab.active {
  background: var(--blue, #1c2c5b);
  color: #fff;
  border-color: var(--blue, #1c2c5b);
}
.itr-year-tab:hover:not(.active) {
  border-color: var(--blue, #1c2c5b);
  color: var(--text);
}

.itr-doc-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
}
.itr-doc-tab {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: var(--bg-soft, #f1f3f5);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: -2px;
}
.itr-doc-tab.active {
  background: var(--bg, #fff);
  color: var(--blue, #1c2c5b);
  border-bottom: 2px solid var(--bg, #fff);
}
.itr-doc-tab:hover:not(.active) { color: var(--text); }


/* ============================================================
   COMPUTATION A — "COMPUTATION OF TOTAL INCOME"
   ============================================================ */
.compa-page-scaler {
  width: 413px; height: 584px;
  position: relative; flex-shrink: 0;
}
.compa-page {
  width: 794px; height: 1123px;
  position: absolute; top: 0; left: 0;
  transform: scale(0.52); transform-origin: top left;
  background: #fff;
  box-shadow: 0 6px 40px rgba(0,0,0,.40);
  font-family: "DejaVu Sans", "DejaVu Sans Condensed", Arial, sans-serif;
  color: #000; box-sizing: border-box;
  padding: 30px 38px; overflow: hidden;
  font-size: 9pt;
}
.ca-title {
  text-align: center;
  font-size: 16pt;
  font-weight: bold;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.ca-info {
  width: 100%;
  border-collapse: collapse;
  font-size: 8.5pt;
  margin-bottom: 4px;
}
.ca-info td { padding: 1.5px 4px; vertical-align: top; }
.ca-il { font-weight: bold; white-space: nowrap; width: 80px; }
.ca-iv { width: 38%; }
.ca-section-band {
  text-align: center;
  font-weight: bold;
  font-size: 9.5pt;
  background: #F1F1F1;
  border: 1px solid #000;
  padding: 2px 0;
  margin: 4px 0;
}
.ca-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8.5pt;
  border-left: 1px solid #000;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
}
.ca-table td { padding: 1px 4px; vertical-align: top; }
.ca-lbl { text-align: left; }
.ca-a {
  text-align: right;
  width: 92px;
  white-space: nowrap;
}
.ca-head td { font-weight: bold; border-top: 1px solid #000; }
.ca-head2 td { font-weight: bold; border-bottom: 1px solid #000; border-top: 1px solid #000; }
.ca-head2-nb td { font-weight: bold; }
.ca-sec td, tr.ca-sec td { font-weight: bold; }
.ca-bold td, tr.ca-bold td { font-weight: bold; }
tr.ca-bt td { border-top: 1px solid #000; }
tr.ca-bb td { border-bottom: 1px solid #000; }
.ca-taxhead {
  font-weight: bold;
  font-size: 9pt;
  border-left: 1px solid #000;
  border-right: 1px solid #000;
  padding: 3px 4px 1px;
}
.ca-taxhead-cell {
  font-weight: bold;
  font-size: 9pt;
  padding: 3px 4px 1px;
}
.ca-footer {
  text-align: center;
  font-weight: bold;
  font-size: 9pt;
  margin-top: 28px;
  line-height: 1.4;
}
.ca-page-no {
  text-align: center;
  font-size: 8.5pt;
  margin-top: 14px;
}


/* ============================================================
   COMPUTATION B — CompuTax detailed (Section 115BAC)
   ============================================================ */
/* ── GST Registration Certificate ───────────────────────── */
.gst-page-scaler {
  width: 413px; height: 584px;
  position: relative; flex-shrink: 0;
}
.gst-page {
  width: 595px; height: 842px;
  position: absolute; top: 0; left: 0;
  transform: scale(0.694); transform-origin: top left;
  background: #fff;
  box-shadow: 0 6px 40px rgba(0,0,0,.40);
  font-family: Helvetica, Arial, sans-serif;
  color: #000; box-sizing: border-box;
  overflow: hidden;
}
.gt {
  position: absolute;
  white-space: pre-wrap;
  line-height: 1.15;
}
.gst-svg {
  position: absolute;
  top: 0; left: 0;
  width: 595px; height: 842px;
}

/* ── Computation & GST Print & Responsive ────────────────── */
@media print {
  .compa-page-scaler { width: 794px !important; height: 1123px !important; }
  .compa-page {
    transform: none !important; box-shadow: none !important;
    width: 794px !important; height: 1123px !important;
  }
  .gst-page-scaler { width: 595px !important; height: 842px !important; }
  .gst-page {
    transform: none !important; box-shadow: none !important;
    width: 595px !important; height: 842px !important;
  }
}
@media (max-width: 1200px) {
  .compa-page-scaler { width: 357px; height: 505px; }
  .compa-page { transform: scale(0.45); }
  .gst-page-scaler { width: 357px; height: 505px; }
  .gst-page { transform: scale(0.60); }
}
@media (max-width: 900px) {
  .compa-page-scaler { width: 318px; height: 449px; }
  .compa-page { transform: scale(0.40); }
  .gst-page-scaler { width: 318px; height: 449px; }
  .gst-page { transform: scale(0.534); }
}

/* Preview-only mode (admin iframe) — hide everything except the document */
body.preview-only .topbar,
body.preview-only .nav-menu,
body.preview-only .nav-backdrop,
body.preview-only .editor,
body.preview-only .resize-handle,
body.preview-only .section[data-section="records"],
body.preview-only .section[data-section="dashboard"],
body.preview-only .section[data-section="account"],
body.preview-only .mc-actions,
body.preview-only .itr-doc-tabs,
body.preview-only .lor-tabbar { display: none !important; }

/* Collapse every section's inner grid to a single full-width column so the
   hidden editor column no longer reserves space and offsets the document. */
body.preview-only .section:not([hidden]) {
  display: block !important;
  height: auto !important;
  overflow: visible !important;
}
body.preview-only .lor-content {
  display: block !important;
  grid-template-columns: 1fr !important;
  overflow: visible !important;
}
body.preview-only .preview-wrap,
body.preview-only .mc-preview-wrap,
body.preview-only .itr-preview-wrap {
  width: 100% !important;
  max-width: 100% !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;     /* centre the document page horizontally */
  overflow: auto;
  padding: 16px;
}
/* Let wide fixed-width pages (794px A4) shrink to fit narrow modals */
body.preview-only .preview-wrap > *,
body.preview-only .mc-preview-wrap > *,
body.preview-only .itr-preview-wrap > * {
  max-width: 100%;
  flex: 0 0 auto;
}
body.preview-only { padding-top: 0 !important; }
html body.preview-only { overflow: auto !important; }
