/* ============ PC document workspaces: ID Cards, Admit Cards, Certificates ============
   Built by js/pc-docs.js inside <main class="pcd">. The older desktop layout stays in the page
   (hidden on the PC) because the phone's desktop-layout fallback (?layout=desktop) and the phone
   layout still use it unchanged. */
body:not(.fw-desktop-layout) .desktop-only .main:has(> main.pcd) > main.content { display: none !important; }
body.fw-desktop-layout main.pcd { display: none !important; }

.pcd { flex: 1; width: 100%; padding: 20px 24px 28px; --pcd-line: #e6eaf2; --pcd-soft: #f6f8fc; --pcd-ink: #0f172a; --pcd-mute: #64748b; }
.pcd *, .pcd *::before, .pcd *::after { box-sizing: border-box; }
.pcd button { font: inherit; }
.pcd-hidden { display: none !important; }

/* header row */
.pcd-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.pcd-head h1 { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: -.3px; color: var(--pcd-ink); }
.pcd-head p { margin: 4px 0 0; font-size: 13.5px; color: var(--pcd-mute); }
.pcd-pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.pcd-pill { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border: 1px solid var(--pcd-line); border-radius: 999px; background: #fff; font-size: 13px; color: #334155; white-space: nowrap; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.pcd-pill b { color: var(--pcd-ink); }
.pcd-pill i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.pcd-pill.warn i { background: #f59e0b; }
.pcd-pill.bad i { background: #ef4444; }
.pcd-pill button { border: 0; background: none; padding: 0; color: var(--primary); font-weight: 700; cursor: pointer; }

/* tabs (certificate types, admit card students/date sheet) */
.pcd-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; margin-bottom: 16px; border: 1px solid var(--pcd-line); border-radius: 14px; background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.pcd-tab { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: #475569; font-size: 13.5px; font-weight: 650; cursor: pointer; }
.pcd-tab:hover { background: var(--pcd-soft); color: var(--pcd-ink); }
.pcd-tab.is-on { background: var(--primary); color: #fff; box-shadow: 0 4px 12px var(--primary-glow); }
.pcd-tab .n { min-width: 20px; height: 19px; padding: 0 6px; border-radius: 999px; background: rgba(15,23,42,.08); font-size: 11px; display: inline-grid; place-items: center; }
.pcd-tab.is-on .n { background: rgba(255,255,255,.24); }
.pcd-tab .sep { width: 1px; height: 20px; background: var(--pcd-line); margin: 0 4px; }
.pcd-tabs .gap { flex: 1; }

/* grid: student list | side (preview + options) */
.pcd-grid { display: grid; grid-template-columns: minmax(0, 1fr) 452px; gap: 20px; align-items: start; }
.pcd-grid.three { grid-template-columns: 300px minmax(0, 1fr) 420px; }
@media (max-width: 1320px) {
  .pcd-grid.three { grid-template-columns: 290px minmax(0, 1fr); }
  .pcd-grid.three > .pcd-side.pv { grid-column: 2; }
}
@media (max-width: 1240px) {
  .pcd-grid { grid-template-columns: minmax(0, 1fr) 400px; }
}
.pcd-card { background: #fff; border: 1px solid var(--pcd-line); border-radius: 16px; box-shadow: 0 1px 2px rgba(16,24,40,.04); min-width: 0; }
.pcd-card + .pcd-card { margin-top: 16px; }
.pcd-card > h3, .pcd-ch { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--pcd-line); font-size: 14.5px; font-weight: 750; color: var(--pcd-ink); }
.pcd-ch small, .pcd-card > h3 small { font-size: 12.5px; font-weight: 500; color: var(--pcd-mute); }
.pcd-cb { padding: 14px 18px; }
.pcd-side { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; scrollbar-width: thin; padding-bottom: 2px; }
.pcd-side::-webkit-scrollbar { width: 8px; }
.pcd-side::-webkit-scrollbar-thumb { background: #d6dce6; border-radius: 8px; }

/* student list */
.pcd-list .pcd-search { position: relative; padding: 14px 18px 0; }
.pcd-search input { width: 100%; height: 42px; padding: 0 44px 0 40px; border: 1px solid var(--pcd-line); border-radius: 12px; background: #fff; font-size: 14px; color: var(--pcd-ink); outline: none; }
.pcd-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.pcd-search svg { position: absolute; left: 31px; top: 27px; width: 17px; height: 17px; color: #94a3b8; }
.pcd-search kbd { position: absolute; right: 30px; top: 25px; min-width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--pcd-line); border-radius: 6px; font: 600 12px/1 inherit; color: #64748b; background: #fff; }
.pcd-list .sl-chips { padding: 12px 18px; border-bottom: 1px solid var(--pcd-line); }
.pcd-bar { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--pcd-line); font-size: 13px; color: #475569; background: #fbfcfe; }
.pcd-bar label { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; cursor: pointer; }
.pcd-bar .grow { flex: 1; }
.pcd-bar .lnk { border: 0; background: none; padding: 0; color: var(--primary); font-weight: 650; cursor: pointer; font-size: 13px; }
.pcd-bar .fl { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 1px solid #fde68a; border-radius: 999px; background: #fffbeb; color: #92400e; font-size: 12px; font-weight: 650; cursor: pointer; }
.pcd-bar .fl.is-on { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.pcd input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; margin: 0; }
.pcd-rows { max-height: calc(100vh - 330px); min-height: 280px; overflow: auto; scrollbar-width: thin; }
.pcd-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid #f1f4f9; cursor: pointer; position: relative; }
.pcd-row:hover { background: #f8faff; }
.pcd-row.is-focus { background: var(--primary-soft); }
.pcd-row.is-focus::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.pcd-row > img, .pcd-row > .s-avatar, .pcd-row > .s-avatar-art { width: 40px !important; height: 40px !important; flex: 0 0 40px !important; border-radius: 13px !important; object-fit: cover; }
.pcd-row .t { flex: 1; min-width: 0; }
.pcd-row .t b { display: block; font-size: 14px; font-weight: 650; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcd-row .t small { display: block; font-size: 12px; color: #8a96a8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcd-row .tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pcd-tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; background: #f1f4f9; color: #475569; }
.pcd-tag.warn { background: #fffbeb; color: #b45309; }
.pcd-tag.bad { background: #fef2f2; color: #b91c1c; }
.pcd-tag.ok { background: #f0fdf4; color: #15803d; }
.pcd-tag.info { background: var(--primary-soft); color: var(--primary); }
.pcd-row .up { position: relative; display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 1px solid #fde68a; border-radius: 8px; background: #fffbeb; color: #b45309; font-size: 12px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.pcd-row .up::before { content: "+"; font-size: 14px; line-height: 1; }
.pcd-row .up:hover { border-color: #f59e0b; background: #fef3c7; }
.pcd-row .up input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pcd-empty { padding: 40px 20px; text-align: center; color: var(--pcd-mute); font-size: 13.5px; }
.pcd-empty b { display: block; color: var(--pcd-ink); font-size: 15px; margin-bottom: 4px; }

/* preview */
.pcd-pv { padding: 14px; background: radial-gradient(120% 90% at 50% 0, #f3f6fb, #e9edf4); border-radius: 0 0 16px 16px; }
.pcd-pv .fitbox { position: relative; overflow: hidden; margin: 0 auto; }
.pcd-pv .fitin { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.pcd-pv .fitin .sdx-page { box-shadow: 0 1px 2px rgba(15,23,42,.08), 0 10px 30px rgba(15,23,42,.16); }
.pcd-pv .sdx-pair.stack { flex-direction: column; }
.pcd-zoom { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 1px solid var(--pcd-line); border-radius: 9px; background: #fff; color: #334155; font-size: 12.5px; font-weight: 650; cursor: pointer; }
.pcd-zoom:hover { border-color: var(--primary); color: var(--primary); }
.pcd-zoom svg { width: 15px; height: 15px; }

/* options */
.pcd-opt { padding: 12px 18px; border-bottom: 1px solid #f1f4f9; }
.pcd-opt:last-child { border-bottom: 0; }
.pcd-opt > label, .pcd-opt > .lbl { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: #64748b; }
.pcd-seg { display: flex; padding: 3px; border-radius: 11px; background: #f1f4f9; gap: 3px; }
.pcd-seg button { flex: 1; height: 32px; border: 0; border-radius: 8px; background: transparent; color: #475569; font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.pcd-seg button.is-on { background: #fff; color: var(--pcd-ink); box-shadow: 0 1px 3px rgba(15,23,42,.14); }
.pcd-designs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pcd-designs.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pcd-design { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 11px; border: 1.5px solid var(--pcd-line); border-radius: 12px; background: #fff; text-align: left; cursor: pointer; min-width: 0; }
.pcd-design b { font-size: 13px; color: var(--pcd-ink); }
.pcd-design small { font-size: 11.5px; line-height: 1.3; color: #8a96a8; }
.pcd-design:hover { border-color: #b9c6dd; }
.pcd-design.is-on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.pcd-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pcd-sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #d6dce6; cursor: pointer; padding: 0; }
.pcd-sw.is-on { box-shadow: 0 0 0 2px var(--pcd-ink); }
.pcd-sw.school { position: relative; }
.pcd-sw.school::after { content: "S"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 800; }
.pcd-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.pcd-check { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 1px solid var(--pcd-line); border-radius: 999px; background: #fff; color: #334155; font-size: 12.5px; font-weight: 600; cursor: pointer; user-select: none; }
.pcd-check input { width: 15px; height: 15px; }
.pcd-check:has(input:checked) { border-color: color-mix(in srgb, var(--primary) 45%, white); background: var(--primary-soft); color: var(--primary); }
.pcd-in { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--pcd-line); border-radius: 10px; background: #fff; font-size: 13.5px; color: var(--pcd-ink); outline: none; }
.pcd-in:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea.pcd-in { height: auto; min-height: 76px; padding: 9px 11px; line-height: 1.45; resize: vertical; }
select.pcd-in { padding-right: 8px; }
.pcd-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pcd-f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.pcd-f > span { font-size: 12px; font-weight: 650; color: #475569; }
.pcd-f > span em { font-style: normal; font-weight: 500; color: #94a3b8; }
.pcd-f.full { grid-column: 1 / -1; }
.pcd-note { margin: 8px 0 0; font-size: 12px; line-height: 1.45; color: #64748b; }
.pcd-alert { display: flex; gap: 10px; align-items: flex-start; margin: 12px 18px 0; padding: 11px 13px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.pcd-alert.bad { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.pcd-alert.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.pcd-alert.ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.pcd-alert.info { background: var(--primary-soft); color: #1e3a8a; border: 1px solid color-mix(in srgb, var(--primary) 22%, white); }
.pcd-alert a, .pcd-alert button { color: inherit; font-weight: 700; text-decoration: underline; border: 0; background: none; padding: 0; cursor: pointer; font-size: inherit; }

/* the print card (gradient, like Collect Fee's collection card) */
.pcd-print { position: relative; overflow: hidden; padding: 18px; border-radius: 16px; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 82%, #000), var(--primary)); box-shadow: 0 10px 26px var(--primary-glow); }
.pcd-print::after { content: ""; position: absolute; right: -40px; top: -60px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.08); }
.pcd-print .k { position: relative; font-size: 12.5px; font-weight: 600; opacity: .9; }
.pcd-print .big { position: relative; display: block; margin-top: 2px; font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -.5px; }
.pcd-print .sub { position: relative; margin-top: 3px; font-size: 12.5px; opacity: .88; }
.pcd-print .act { position: relative; display: flex; gap: 8px; margin-top: 14px; }
.pcd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px; border: 0; border-radius: 11px; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.pcd-btn svg { width: 17px; height: 17px; }
.pcd-btn.light { flex: 1; background: #fff; color: color-mix(in srgb, var(--primary) 80%, #000); }
.pcd-btn.light:hover { background: #f1f5ff; }
.pcd-btn.ghost { background: rgba(255,255,255,.16); color: #fff; }
.pcd-btn.ghost:hover { background: rgba(255,255,255,.24); }
.pcd-btn.pri { background: var(--primary); color: #fff; box-shadow: 0 4px 12px var(--primary-glow); }
.pcd-btn.pri:hover { filter: brightness(1.06); }
.pcd-btn.out { background: #fff; color: #334155; border: 1px solid var(--pcd-line); }
.pcd-btn.out:hover { border-color: var(--primary); color: var(--primary); }
.pcd-btn.danger { background: #fff; color: #b91c1c; border: 1px solid #fecaca; }
.pcd-btn[disabled] { opacity: .55; cursor: not-allowed; filter: none; }
.pcd-btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.pcd-print .opts { position: relative; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pcd-print .opts label { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 12px; font-weight: 600; cursor: pointer; }
.pcd-print .opts input { width: 14px; height: 14px; accent-color: #fff; }

/* school details status */
.pcd-school { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pcd-si { display: flex; flex-direction: column; gap: 3px; padding: 10px; border: 1px solid var(--pcd-line); border-radius: 12px; background: #fff; font-size: 12px; color: #475569; min-width: 0; }
.pcd-si b { font-size: 12.5px; color: var(--pcd-ink); }
.pcd-si .st { font-weight: 650; }
.pcd-si .st.ok { color: #15803d; }
.pcd-si .st.no { color: #b45309; }
.pcd-si .imgb { height: 28px; display: flex; align-items: center; }
.pcd-si .imgb img { max-height: 28px; max-width: 100%; object-fit: contain; }
.pcd-si label, .pcd-si a, .pcd-si button { position: relative; align-self: flex-start; border: 0; background: none; padding: 0; color: var(--primary); font-size: 12px; font-weight: 700; cursor: pointer; text-decoration: none; }
.pcd-si label input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

/* date sheet editor */
.pcd-ds { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.pcd-ds th { padding: 9px 8px; text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: #64748b; background: #f8fafc; border-bottom: 1px solid var(--pcd-line); }
.pcd-ds td { padding: 7px 8px; border-bottom: 1px solid #f1f4f9; vertical-align: middle; }
.pcd-ds td.n { width: 34px; color: #94a3b8; font-weight: 650; text-align: center; }
.pcd-ds td.day { width: 110px; color: #475569; font-weight: 600; white-space: nowrap; }
.pcd-ds td.x { width: 44px; text-align: right; }
.pcd-ds .pcd-in { height: 36px; }
.pcd-ds input[type=date] { width: 150px; }
.pcd-icon { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid var(--pcd-line); border-radius: 9px; background: #fff; color: #94a3b8; cursor: pointer; }
.pcd-icon:hover { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.pcd-icon svg { width: 15px; height: 15px; }
.pcd-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--pcd-line); }
.pcd-actions .grow { flex: 1; }
.pcd-dirty { font-size: 12.5px; font-weight: 650; color: #b45309; }
.pcd-chipdot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #22c55e; margin-left: 2px; }

/* certificate form */
.pcd-form .grp { padding: 12px 18px 14px; border-bottom: 1px solid #f1f4f9; }
.pcd-form .grp:last-child { border-bottom: 0; }
.pcd-form .grp > h4 { margin: 0 0 10px; font-size: 12px; font-weight: 750; letter-spacing: .3px; text-transform: uppercase; color: #64748b; display: flex; align-items: center; gap: 8px; }
.pcd-form .grp > h4 button { margin-left: auto; text-transform: none; letter-spacing: 0; }
.pcd-form .rows { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pcd-form .who { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--pcd-line); }
.pcd-form .who > img, .pcd-form .who > .s-avatar, .pcd-form .who > .s-avatar-art { width: 46px !important; height: 46px !important; flex: 0 0 46px !important; border-radius: 14px !important; object-fit: cover; }
.pcd-form .who b { display: block; font-size: 15.5px; color: var(--pcd-ink); }
.pcd-form .who small { display: block; font-size: 12.5px; color: #8a96a8; }
.pcd-form .go { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--pcd-line); background: #fbfcfe; border-radius: 0 0 16px 16px; }
.pcd-form .go .pcd-btn.pri { flex: 1; }

/* registers (TC register, recent letters) */
.pcd-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pcd-table th { padding: 11px 14px; text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: #64748b; background: #f8fafc; border-bottom: 1px solid var(--pcd-line); white-space: nowrap; }
.pcd-table td { padding: 11px 14px; border-bottom: 1px solid #f1f4f9; vertical-align: middle; }
.pcd-table tr:hover td { background: #fafcff; }
.pcd-table td .t b { display: block; font-weight: 650; color: #1e293b; }
.pcd-table td .t small { display: block; font-size: 12px; color: #8a96a8; }
.pcd-table td.r { text-align: right; white-space: nowrap; }
.pcd-table .student { display: flex; align-items: center; gap: 10px; }
.pcd-table .student > img, .pcd-table .student > .s-avatar, .pcd-table .student > .s-avatar-art { width: 34px !important; height: 34px !important; flex: 0 0 34px !important; border-radius: 11px !important; object-fit: cover; }

/* zoomed preview */
.pcd-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: flex-start; justify-content: center; padding: 28px; background: rgba(15,23,42,.55); overflow: auto; }
.pcd-modal .box { background: #e9edf4; border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.35); max-width: calc(100vw - 56px); }
.pcd-modal header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #fff; border-radius: 16px 16px 0 0; border-bottom: 1px solid var(--pcd-line); }
.pcd-modal header b { flex: 1; font-size: 15px; }
.pcd-modal .bd { padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 18px; overflow: auto; }
.pcd-modal .bd .sdx-page { box-shadow: 0 2px 6px rgba(15,23,42,.12), 0 16px 40px rgba(15,23,42,.18); }
