/* TCIT Jr - Institute Management System */
:root {
  --navy: #1d2a6b;
  --navy-2: #26368a;
  --navy-3: #2f43a8;
  --primary: #2f43a8;
  --primary-soft: #eef0fb;
  --orange: #f7931e;
  --orange-soft: #fff4e6;
  --teal: #10a39a;
  --teal-soft: #e6f7f5;
  --red: #e0434b;
  --red-soft: #fdecec;
  --green: #1f9d55;
  --green-soft: #e8f6ee;
  --amber: #d97706;
  --amber-soft: #fef5e4;
  --ink: #1b2240;
  --ink-2: #4a5272;
  --muted: #8189a6;
  --line: #e4e7f1;
  --bg: #f4f6fb;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 80, .05), 0 4px 16px rgba(20, 30, 80, .05);
  --font: "Segoe UI", system-ui, -apple-system, "Noto Sans", "Noto Sans Gujarati", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; color: var(--ink); }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.ic { vertical-align: -3px; flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.hide { display: none !important; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: linear-gradient(180deg, var(--navy) 0%, #172257 100%); color: #cfd5f5;
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .2s;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; background: #fff; display: grid; place-items: center; font-weight: 800; color: var(--navy); font-size: 13px; position: relative; }
.brand-logo span { position: absolute; right: -6px; top: -6px; background: var(--orange); color: #fff; border-radius: 6px; font-size: 9px; padding: 1px 4px; }
.brand-name { color: #fff; font-weight: 750; font-size: 17px; letter-spacing: .3px; }
.brand-sub { font-size: 10.5px; color: #9aa4d8; text-transform: uppercase; letter-spacing: .6px; }
.nav { padding: 10px 10px 20px; overflow-y: auto; flex: 1; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: #7d88c4; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; color: #cfd5f5; padding: 9px 12px; border-radius: 9px; margin: 1px 0; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav a.active { background: var(--orange); color: #fff; box-shadow: 0 4px 12px rgba(247,147,30,.35); }
.nav a .badge { margin-left: auto; }
.sidebar-foot { padding: 12px 18px; font-size: 11px; color: #7d88c4; border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; margin-left: 240px; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 24px;
  position: sticky; top: 0; z-index: 30;
}
.menu-btn { display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: var(--ink); }
.topsearch { flex: 1; max-width: 520px; position: relative; }
.topsearch input { width: 100%; padding: 10px 14px 10px 38px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; font-size: 14px; }
.topsearch input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }
.topsearch .ic { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.usermenu { position: relative; }
.usermenu > button { display: flex; align-items: center; gap: 9px; background: none; border: 0; cursor: pointer; padding: 4px 6px; border-radius: 10px; font: inherit; color: var(--ink); }
.usermenu > button:hover { background: var(--bg); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 84px; height: 84px; font-size: 28px; border-radius: 16px; }
.usermenu .who { text-align: left; line-height: 1.2; }
.usermenu .who small { color: var(--muted); font-size: 11px; }
.dropdown { position: absolute; right: 0; top: 48px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(20,30,80,.15); min-width: 200px; padding: 6px; display: none; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 12px; border-radius: 8px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--bg); text-decoration: none; }

.content { padding: 24px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.crumb a { color: var(--muted); }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #eef0f6; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 15px; }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

.kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.kpi .kicon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.kpi .kval { font-size: 22px; font-weight: 750; line-height: 1.1; }
.kpi .klabel { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.kpi a { color: inherit; }
.c-blue { background: var(--primary-soft); color: var(--primary); }
.c-orange { background: var(--orange-soft); color: var(--orange); }
.c-teal { background: var(--teal-soft); color: var(--teal); }
.c-red { background: var(--red-soft); color: var(--red); }
.c-green { background: var(--green-soft); color: var(--green); }
.c-amber { background: var(--amber-soft); color: var(--amber); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; line-height: 1.2;
}
.btn:hover { text-decoration: none; background: var(--bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-orange { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-orange:hover { background: #e7820b; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: #18874a; }
.btn-danger { background: #fff; border-color: #f3c2c5; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-icon { padding: 7px; }
.inline { display: inline; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--bg); color: var(--ink-2); }
.b-hot { background: var(--red-soft); color: var(--red); }
.b-warm { background: var(--amber-soft); color: var(--amber); }
.b-cold { background: #e8f1fb; color: #2f6fb3; }
.b-joined, .b-active, .b-paid, .b-p { background: var(--green-soft); color: var(--green); }
.b-lost, .b-left, .b-dropped, .b-a, .b-overdue { background: var(--red-soft); color: var(--red); }
.b-completed { background: var(--primary-soft); color: var(--primary); }
.b-on-hold, .b-part-paid, .b-l, .b-due { background: var(--amber-soft); color: var(--amber); }
.b-count { background: var(--orange); color: #fff; min-width: 20px; justify-content: center; padding: 2px 7px; }
.b-super { background: var(--navy); color: #fff; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 650; padding: 11px 14px; background: #fafbfe; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid #eff1f7; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafbff; }
.tbl tfoot td { font-weight: 700; background: #fafbfe; border-top: 1px solid var(--line); }
.tbl .person { display: flex; align-items: center; gap: 10px; }
.tbl .person .avatar { width: 32px; height: 32px; font-size: 12px; }
.tbl .person b { display: block; font-weight: 600; }
.tbl.compact td, .tbl.compact th { padding: 8px 12px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ic { color: #c4c9dc; margin-bottom: 8px; }

/* ---------- filters / tabs ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fcfcfe; border-radius: var(--radius) var(--radius) 0 0; }
.filters .f { display: flex; flex-direction: column; gap: 4px; }
.filters label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.filters input, .filters select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13px; background: #fff; min-width: 130px; }
.filters .grow { flex: 1; min-width: 200px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 10px 14px 0; border-bottom: 1px solid var(--line); }
.tabs a { padding: 9px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.tabs a:hover { text-decoration: none; color: var(--primary); }
.tabs a.on { color: var(--primary); border-color: var(--primary); }
.pager { display: flex; align-items: center; gap: 6px; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pager .btns { margin-left: auto; display: flex; gap: 6px; }

/* ---------- forms ---------- */
.form-section { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #eef0f6; margin-bottom: 18px; }
.sec-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.sec-no { background: var(--orange); color: #fff; border-radius: 7px; font-weight: 750; font-size: 12px; padding: 4px 8px; }
.sec-head h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .6px; color: var(--navy); }
.sec-head .hint { margin-left: auto; color: var(--muted); font-size: 12px; }
.sec-body { padding: 18px 20px 6px; }
.fgrid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0 16px; }
.fg { margin-bottom: 14px; grid-column: span 4; }
.fg.s2 { grid-column: span 2; } .fg.s3 { grid-column: span 3; } .fg.s5 { grid-column: span 5; } .fg.s6 { grid-column: span 6; }
.fg.s7 { grid-column: span 7; } .fg.s8 { grid-column: span 8; } .fg.s10 { grid-column: span 10; } .fg.s9 { grid-column: span 9; } .fg.s12 { grid-column: span 12; }
.fg > label, .lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.req::after { content: " *"; color: var(--red); }
.input, .fg input[type=text], .fg input[type=tel], .fg input[type=email], .fg input[type=number], .fg input[type=date], .fg input[type=time],
.fg input[type=password], .fg select, .fg textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #d9dded; border-radius: 9px; font: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
.fg input:focus, .fg select:focus, .fg textarea:focus, .input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.fg textarea { min-height: 72px; resize: vertical; }
.fg .help { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.fg input[readonly] { background: #f7f8fc; color: var(--ink-2); }
.input-group { display: flex; }
.input-group .pre { padding: 9px 11px; border: 1px solid #d9dded; border-right: 0; border-radius: 9px 0 0 9px; background: #f7f8fc; color: var(--muted); font-weight: 600; }
.input-group input { border-radius: 0 9px 9px 0 !important; }

/* chip choices (radio / checkbox that look like the paper form boxes) */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border: 1px solid #d9dded; border-radius: 20px; cursor: pointer; font-size: 13px; background: #fff; user-select: none; transition: all .12s; }
.chip span::before { content: ""; width: 12px; height: 12px; border: 1.5px solid #b7bdd6; border-radius: 3px; background: #fff; }
.chip input[type=radio] + span::before { border-radius: 50%; }
.chip input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.chip input:checked + span::before { background: var(--primary); border-color: var(--primary); box-shadow: inset 0 0 0 2px #fff; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-soft); }
.chip.big span { padding: 12px 16px; border-radius: 12px; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 190px; }
.chip.big span::before { display: none; }
.chip.big span b { font-size: 14px; }
.chip.big span small { color: var(--muted); font-weight: 400; font-size: 11.5px; }

.form-foot { position: sticky; bottom: 0; background: rgba(244,246,251,.94); backdrop-filter: blur(6px); padding: 14px 0; display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--line); margin-top: 6px; z-index: 5; }
.form-foot .spacer { flex: 1; }

.photo-box { width: 130px; height: 160px; border: 2px dashed #c9cee3; border-radius: 12px; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 12px; cursor: pointer; overflow: hidden; background: #fafbfe; position: relative; }
.photo-box img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.photo-box input { display: none; }

.fee-box { background: var(--primary-soft); border-radius: 12px; padding: 14px 16px; display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 14px; }
.fee-box div small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.fee-box div b { font-size: 19px; }

/* ---------- alerts ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.alert-success { background: var(--green-soft); color: #136c3a; border: 1px solid #c6ead6; }
.alert-danger { background: var(--red-soft); color: #a82830; border: 1px solid #f6caca; }
.alert-warning { background: var(--amber-soft); color: #92510a; border: 1px solid #f7deb0; }
.alert-info { background: var(--primary-soft); color: var(--navy-2); border: 1px solid #d8ddf6; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert .close { margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit; opacity: .6; }

/* ---------- misc ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid #f0f2f8; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 600; }
.list .s { font-size: 12px; color: var(--muted); }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 9px 14px; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; word-break: break-word; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 90px; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { height: 10px; background: #eef0f7; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #5b6fd6); border-radius: 6px; }
.bar-fill.o { background: linear-gradient(90deg, var(--orange), #ffb35c); }
.colchart { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding-top: 10px; }
.colchart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.colchart .colbar { width: 100%; max-width: 46px; background: linear-gradient(180deg, #5b6fd6, var(--primary)); border-radius: 7px 7px 3px 3px; min-height: 3px; }
.colchart .cv { font-size: 11px; color: var(--ink-2); font-weight: 600; }
.colchart .cl { font-size: 11.5px; color: var(--muted); }
.progress { height: 8px; background: #eef0f7; border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; background: var(--green); }
.steps-help { display: flex; gap: 10px; flex-wrap: wrap; }
.steps-help a { flex: 1; min-width: 180px; display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px dashed #cdd3ea; border-radius: 12px; color: var(--ink); background: #fff; }
.steps-help a:hover { border-color: var(--primary); text-decoration: none; background: var(--primary-soft); }
.steps-help .n { width: 30px; height: 30px; border-radius: 50%; background: var(--orange); color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.att-row { display: flex; gap: 6px; }
.att-row label { cursor: pointer; }
.att-row input { display: none; }
.att-row span { display: inline-grid; place-items: center; width: 40px; height: 34px; border: 1px solid #d9dded; border-radius: 8px; font-weight: 700; color: var(--muted); background: #fff; }
.att-row input[value=P]:checked + span { background: var(--green); border-color: var(--green); color: #fff; }
.att-row input[value=A]:checked + span { background: var(--red); border-color: var(--red); color: #fff; }
.att-row input[value=L]:checked + span { background: var(--amber); border-color: var(--amber); color: #fff; }
.reg td, .reg th { padding: 6px 4px !important; text-align: center; font-size: 12px; }
.reg td:nth-child(-n+2), .reg th:nth-child(-n+2) { text-align: left; padding-left: 10px !important; }
.reg .P { color: var(--green); font-weight: 700; } .reg .A { color: var(--red); font-weight: 700; } .reg .L { color: var(--amber); font-weight: 700; }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.timeline li::after { content: ""; position: absolute; left: 10px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.profile-head { display: flex; gap: 18px; align-items: center; padding: 20px; }
.profile-head .meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--ink-2); font-size: 13px; margin-top: 6px; }
.profile-head .meta span { display: inline-flex; align-items: center; gap: 5px; }
.inst-card { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.inst-card .ihead { display: flex; gap: 10px; align-items: center; padding: 12px 16px; background: #fafbfe; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ql { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.login-art { background: radial-gradient(circle at 20% 20%, #3247b8 0, var(--navy) 55%, #141d4f 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: "</>"; position: absolute; right: -20px; bottom: 40px; font-size: 220px; font-weight: 800; color: rgba(255,255,255,.05); font-family: monospace; }
.login-art h1 { color: #fff; font-size: 40px; line-height: 1.1; margin: 24px 0 12px; }
.login-art p { color: #c3cbf1; font-size: 15px; max-width: 420px; }
.login-art .tag { color: var(--orange); font-weight: 700; letter-spacing: 3px; font-size: 12px; }
.login-form { display: grid; place-items: center; padding: 40px 24px; }
.login-form form { width: 100%; max-width: 360px; }
.login-form .fg { grid-column: auto; }
.login-form input { padding: 12px 14px !important; }

/* ---------- print (receipt, admission form) ---------- */
.print-page { background: #e9ecf5; }
.paper { width: 210mm; min-height: 297mm; margin: 20px auto; background: #fff; padding: 12mm 14mm; box-shadow: 0 6px 30px rgba(0,0,0,.12); color: #111; font-size: 12.5px; }
.paper.half { min-height: auto; }
.print-bar { position: sticky; top: 0; background: var(--navy); padding: 10px 20px; display: flex; gap: 10px; justify-content: center; z-index: 10; }
.p-head { display: flex; align-items: center; gap: 14px; background: var(--navy); color: #fff; padding: 14px 18px; border-radius: 10px; }
.p-head .logo { background: #fff; color: var(--navy); width: 54px; height: 54px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.p-head h1 { color: #fff; font-size: 22px; }
.p-head .doc { margin-left: auto; background: #fff; color: var(--navy); padding: 6px 14px; border-radius: 20px; font-weight: 800; letter-spacing: .5px; }
.p-addr { text-align: center; font-size: 11.5px; padding: 6px 0 10px; border-bottom: 2px solid var(--orange); margin-bottom: 10px; }
.p-sec { display: flex; align-items: center; gap: 8px; margin: 12px 0 6px; font-weight: 800; color: var(--navy); text-transform: uppercase; font-size: 12.5px; letter-spacing: .5px; }
.p-sec span { background: var(--orange); color: #fff; padding: 2px 7px; border-radius: 5px; }
.p-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px 14px; }
.p-f { border-bottom: 1px dotted #999; padding: 3px 0; min-height: 22px; }
.p-f small { color: #555; }
.p-f b { font-weight: 600; }
.p-box { display: inline-block; width: 11px; height: 11px; border: 1px solid #333; margin: 0 3px -1px 8px; text-align: center; line-height: 9px; font-size: 10px; }
.p-tbl { width: 100%; border-collapse: collapse; margin-top: 6px; }
.p-tbl th, .p-tbl td { border: 1px solid #bbb; padding: 5px 8px; text-align: left; }
.p-tbl th { background: #eef0fb; }
.p-sign { display: flex; justify-content: space-between; margin-top: 40px; text-align: center; }
.p-sign div { border-top: 1px solid #333; width: 30%; padding-top: 4px; font-weight: 600; }
.p-photo { width: 105px; height: 130px; border: 1px dashed #999; display: grid; place-items: center; font-size: 10px; color: #777; overflow: hidden; }
.p-photo img { width: 100%; height: 100%; object-fit: cover; }

@media print {
  body, .print-page { background: #fff; }
  .print-bar, .no-print { display: none !important; }
  .paper { margin: 0; box-shadow: none; width: auto; min-height: auto; padding: 0; }
  @page { size: A4; margin: 10mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g-2-1, .g-1-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .main { margin-left: 0; }
  .menu-btn { display: block; }
  .content { padding: 16px; }
  .topbar { padding: 0 12px; }
  .usermenu .who { display: none; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .fg, .fg.s2, .fg.s3, .fg.s5, .fg.s6, .fg.s7, .fg.s8, .fg.s9, .fg.s10 { grid-column: span 12; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .dl { grid-template-columns: 120px 1fr; }
  .hide-sm { display: none; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: minmax(0, 1fr); }
  .page-head .actions { margin-left: 0; }
}

#inst-sum { font-weight: 700; }
.bad #inst-sum, tr.bad td { color: var(--red); }

/* ---------- mobile app (PWA) ---------- */
.bottom-nav, .sidebar-backdrop, .login-mobile-brand { display: none; }
.nav-btn { background: none; border: 0; width: 100%; font: inherit; cursor: pointer; text-align: left; display: flex; align-items: center; gap: 11px; color: #cfd5f5; padding: 9px 12px; border-radius: 9px; margin: 1px 0; font-size: 14px; }
.nav-btn:hover { background: rgba(255,255,255,.07); color: #fff; }
@media (max-width: 860px) {
  body { -webkit-tap-highlight-color: transparent; }
  .content { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .sidebar { z-index: 60; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 50, .45); z-index: 55; }
  .sidebar.open + .sidebar-backdrop { display: block; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--card); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 18px rgba(20, 30, 80, .08);
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px;
    font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; border-radius: 10px; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--primary); background: var(--primary-soft); }
  .login-mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
  .login-mobile-brand img { width: 44px; height: 44px; }
  .btn, input, select, textarea { min-height: 42px; }
  .btn-sm { min-height: 34px; }
  input, select, textarea { font-size: 16px !important; } /* stops iPhone zoom on focus */
  .form-foot { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 5; }
  .sticky-save { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); background: var(--card); }
  .page-head { flex-wrap: wrap; }
  .page-head .actions { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; }
  .att-row label span { width: 44px; height: 44px; }
}
@media (display-mode: standalone) { .topbar { padding-top: env(safe-area-inset-top); } }
