body{background:#f5f7fb;color:#1f2937;font-family:Inter,system-ui,sans-serif}.app{display:flex;min-height:100vh}.sidebar{width:250px;background:#102a43;color:#dbeafe;padding:18px 14px;position:fixed;inset:0 auto 0 0;z-index:10}.brand{display:flex;gap:10px;align-items:center;font-size:18px;font-weight:800;padding:8px 10px 20px}.brand i{font-size:30px}.brand small{font-weight:500;color:#9fb3c8}.userbox{display:flex;gap:10px;align-items:center;background:#173b5d;padding:10px;border-radius:12px;margin-bottom:18px}.userbox small{display:block;color:#9fb3c8}.avatar{width:38px;height:38px;border-radius:50%;background:#2f80ed;display:grid;place-items:center;font-weight:800;color:#fff}.sidebar nav a{display:flex;gap:12px;align-items:center;color:#c9d8e8;text-decoration:none;padding:11px 12px;border-radius:9px;margin:3px 0}.sidebar nav a:hover,.sidebar nav a.active{background:#214b72;color:#fff}.main{margin-left:250px;width:calc(100% - 250px);padding:22px}.topbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}.topbar h4{margin:3px 0 0;font-weight:800}.muted{color:#7b8794;font-size:13px}.cardx{background:#fff;border:1px solid #e6edf3;border-radius:16px;padding:20px;box-shadow:0 5px 20px rgba(16,42,67,.04)}.stat{display:flex;align-items:center;gap:15px}.stat .icon{width:48px;height:48px;border-radius:12px;background:#eaf3ff;color:#1769d2;display:grid;place-items:center;font-size:22px}.stat h2{margin:0;font-weight:800}.table thead th{background:#f7f9fc;color:#52606d;font-size:12px;text-transform:uppercase}.attendance-btn{min-width:96px}.attendance-btn.active{font-weight:800}.login-page{min-height:100vh;display:grid;place-items:center;background:linear-gradient(135deg,#102a43,#1769aa)}.login-card{width:min(430px,92vw);background:#fff;border-radius:22px;padding:32px;box-shadow:0 25px 60px rgba(0,0,0,.2)}.login-logo{width:64px;height:64px;border-radius:18px;background:#1769aa;color:#fff;display:grid;place-items:center;font-size:30px;margin-bottom:16px}.sticky-summary{position:sticky;bottom:15px;background:#102a43;color:#fff;border-radius:14px;padding:12px 16px;box-shadow:0 10px 30px rgba(0,0,0,.18)}@media(max-width:900px){.sidebar{width:72px}.brand span,.userbox>div:not(.avatar){display:none}.sidebar nav a{justify-content:center}.main{margin-left:72px;width:calc(100% - 72px)}.brand{justify-content:center}}@media(max-width:600px){.main{padding:12px}.topbar{align-items:flex-start}.cardx{padding:14px}.attendance-table thead{display:none}.attendance-table,.attendance-table tbody,.attendance-table tr,.attendance-table td{display:block;width:100%}.attendance-table tr{background:#fff;border:1px solid #e6edf3;border-radius:12px;margin-bottom:10px;padding:10px}.attendance-table td{border:0;padding:5px}.attendance-table td:last-child{display:flex;gap:8px}.attendance-table .attendance-btn{flex:1}}

.print-only{display:none}
@media print{
 body{background:#fff!important}
 .sidebar,.topbar,.no-print,.alert,.btn,.modal,.navbar{display:none!important}
 .app,.main{display:block!important;margin:0!important;width:100%!important;padding:0!important}
 .print-only{display:block!important}
 .print-report{display:block!important;border:0!important;box-shadow:none!important;padding:0!important;margin:0!important}
 .print-report table{width:100%!important;border-collapse:collapse!important}
 .print-report th,.print-report td{border:1px solid #777!important;padding:6px!important}
 @page{size:A4;margin:12mm}
}
@media(max-width:900px){.sidebar{width:72px}.brand span,.userbox>div:not(.avatar){display:none}.brand{justify-content:center}.sidebar nav a{justify-content:center}.main{margin-left:72px;width:calc(100% - 72px)}}
@media(max-width:600px){.main{padding:12px}.topbar{flex-wrap:wrap}.cardx{padding:14px}.table-responsive{overflow-x:auto}.attendance-table thead{display:none}.attendance-table,.attendance-table tbody,.attendance-table tr,.attendance-table td{display:block;width:100%}.attendance-table tr{background:#fff;border:1px solid #e6edf3;border-radius:12px;margin-bottom:10px;padding:10px}.attendance-table td{border:0;padding:5px}.attendance-table td:last-child{display:flex;gap:8px}.attendance-table .attendance-btn{flex:1}.form-control,.form-select,.btn{min-height:42px}}

/* Responsive navigation */
.mobile-menu{display:none;border:1px solid #d9e2ec;background:#fff;border-radius:10px;width:42px;height:42px;font-size:21px}
.sidebar-overlay{display:none}
.admin-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.admin-tabs a{display:inline-flex;align-items:center;gap:7px;padding:9px 12px;border:1px solid #d9e2ec;border-radius:10px;background:#fff;color:#334e68;text-decoration:none;font-size:13px}
.admin-tabs a:hover,.admin-tabs a.active{background:#eaf3ff;border-color:#b8d6f8;color:#1769aa}
@media(max-width:767px){
 .mobile-menu{display:inline-grid;place-items:center;flex:0 0 42px}
 .sidebar{transform:translateX(-100%);transition:transform .2s ease;width:250px!important;box-shadow:10px 0 30px rgba(0,0,0,.15)}
 .sidebar.open{transform:translateX(0)}
 .sidebar.open .brand span,.sidebar.open .userbox>div:not(.avatar){display:block}
 .sidebar.open .brand{justify-content:flex-start}.sidebar.open nav a{justify-content:flex-start}
 .sidebar-overlay{position:fixed;inset:0;background:rgba(0,0,0,.35);z-index:9}
 .sidebar-overlay.show{display:block}
 .main{margin-left:0!important;width:100%!important;padding:12px}
 .topbar{display:grid;grid-template-columns:42px 1fr auto;align-items:center}
 .topbar>div:first-of-type{min-width:0}
 .topbar h4{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .admin-tabs{overflow-x:auto;flex-wrap:nowrap;padding-bottom:4px}
 .admin-tabs a{white-space:nowrap}
}
@media(max-width:480px){.topbar{grid-template-columns:42px 1fr}.topbar>div:last-child{display:none}.login-card{padding:24px}.table{font-size:13px}}

.report-meta{font-size:13px;line-height:1.8}.report-meta span{display:inline-block}

.sidebar nav a span{display:inline}

/* V8 sidebar fix */
.sidebar nav a span{display:inline!important;white-space:nowrap}
@media(max-width:767px){
 .sidebar{width:250px;left:-250px;transition:left .25s ease;z-index:1050}
 .sidebar.open{left:0}
 .main{margin-left:0;width:100%}
}

#liveClock{font-variant-numeric:tabular-nums;font-size:1.05rem}

.daily-register-table th,.daily-register-table td{font-size:.82rem}
.daily-register-table th small{font-weight:500}
.print-signatures{display:flex;gap:40px}
@media print{
 @page{size:landscape;margin:10mm}
 .daily-register-table th,.daily-register-table td{font-size:8pt;padding:4px!important}
 .print-signatures{display:flex!important;gap:50px}
}

/* V13 maintenance + printing */
.sidebar{height:100vh;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin}
.sidebar nav{padding-bottom:24px}
.sidebar::-webkit-scrollbar{width:7px}.sidebar::-webkit-scrollbar-thumb{background:rgba(255,255,255,.25);border-radius:10px}
@media print{
  html,body{width:100%!important;height:auto!important;overflow:visible!important}
  .table-responsive{overflow:visible!important;display:block!important}
  .print-report{width:100%!important;max-width:none!important;overflow:visible!important}
  .print-report table{width:100%!important;max-width:100%!important;table-layout:auto!important}
  .print-report thead{display:table-header-group!important}
  .print-report tfoot{display:table-footer-group!important}
  .print-report tr{page-break-inside:avoid!important}
  .print-report th,.print-report td{white-space:normal!important;word-break:break-word!important;overflow:visible!important}
  .print-header{page-break-after:avoid!important}
}
@media print{
  .daily-register-table{font-size:7.5pt!important}
  .daily-register-table th,.daily-register-table td{padding:3px!important;white-space:normal!important}
  .daily-register-table th:first-child,.daily-register-table td:first-child{width:7%}
  .daily-register-table th:nth-child(2),.daily-register-table td:nth-child(2){width:12%}
  .daily-register-table th:nth-child(3),.daily-register-table td:nth-child(3){width:22%}
}

/* V14 final print safeguards */
@media print{
  *{box-sizing:border-box}
  html,body{overflow:visible!important;width:100%!important;background:#fff!important}
  .main{overflow:visible!important}
  .print-report,.print-report .table-responsive{overflow:visible!important;width:100%!important;max-width:100%!important}
  .print-report table{display:table!important;width:100%!important;max-width:100%!important;height:auto!important}
  .print-report thead{display:table-header-group!important}
  .print-report tbody{display:table-row-group!important}
  .print-report tfoot{display:table-footer-group!important}
  .print-report tr{page-break-inside:avoid!important;break-inside:avoid!important}
  .print-report th,.print-report td{overflow:visible!important;white-space:normal!important;word-break:break-word!important}
  .daily-register-table{font-size:6.5pt!important;table-layout:fixed!important}
  .daily-register-table th,.daily-register-table td{padding:2px!important;line-height:1.15!important}
  .daily-register-table th:first-child,.daily-register-table td:first-child{width:6%!important}
  .daily-register-table th:nth-child(2),.daily-register-table td:nth-child(2){width:11%!important}
  .daily-register-table th:nth-child(3),.daily-register-table td:nth-child(3){width:20%!important}
  .daily-register-table th:not(:first-child):not(:nth-child(2)):not(:nth-child(3)){width:auto}
}

/* V15: definitive sidebar scrolling fix */
.sidebar{
  height:100vh!important;
  max-height:100vh!important;
  overflow:hidden!important;
  display:flex!important;
  flex-direction:column!important;
}
.sidebar .brand,.sidebar .userbox{flex:0 0 auto}
.sidebar nav{
  flex:1 1 auto!important;
  min-height:0!important;
  height:auto!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  padding:4px 2px 28px!important;
  scrollbar-width:auto!important;
}
.sidebar nav::-webkit-scrollbar{width:8px}
.sidebar nav::-webkit-scrollbar-track{background:rgba(255,255,255,.06);border-radius:8px}
.sidebar nav::-webkit-scrollbar-thumb{background:rgba(255,255,255,.35);border-radius:8px}
.sidebar nav::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,.55)}
@media(max-width:767px){
  .sidebar{height:100vh!important;max-height:100vh!important}
  .sidebar nav{padding-bottom:35px!important}
}

.site-footer{margin-top:24px;padding:16px 8px;text-align:center;color:#7b8794;font-size:13px;border-top:1px solid #e6edf3}
.site-footer a{color:#1769aa;text-decoration:none;font-weight:600}.site-footer a:hover{text-decoration:underline}
@media print{.site-footer{display:none!important}}

.site-footer{display:block!important;width:100%;margin-top:24px;padding:16px 10px;text-align:center;color:#7b8794;font-size:13px;border-top:1px solid #e6edf3;background:transparent}
.site-footer a{color:#1769aa!important;text-decoration:none;font-weight:600}.site-footer a:hover{text-decoration:underline}
@media print{.site-footer{display:none!important}}

.subject-summary-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px}.subject-summary-card{border:1px solid #dce6f0;background:#fff;border-radius:12px;padding:14px;display:flex;align-items:center;gap:12px;cursor:pointer}.subject-summary-card:hover{border-color:#6aa7e8;box-shadow:0 3px 12px rgba(0,0,0,.06)}.subject-summary-card>div{flex:1}.subject-report-block{border:1px solid #e1e8ef;border-radius:12px;padding:16px;margin-bottom:16px}.session-card{box-shadow:none}.report-section{page-break-after:always}.report-section:last-child{page-break-after:auto}
@media print{.report-section{break-after:page}.report-section:last-child{break-after:auto}.subject-report-block{display:block!important;border:0!important;padding:0!important}.subject-summary-grid{display:none!important}.session-card{page-break-inside:avoid;break-inside:avoid}.subject-report-block{page-break-after:always;break-after:page}}

/* V28: Daily register focused printing */
@media print{
  @page{size:A4 portrait;margin:8mm}
  body.printing-daily-subject .subject-summary-grid,
  body.printing-daily-subject .no-print,
  body.printing-daily-subject .alert{display:none!important}
  body.printing-daily-subject .subject-report-block{display:none!important;border:0!important;margin:0!important;padding:0!important}
  body.printing-daily-subject .subject-report-block.print-selected{display:block!important}
  body.printing-daily-subject .subject-print-header{display:block!important}
  body.printing-daily-subject .print-header{margin-bottom:5mm!important}
  body.printing-daily-subject .print-header img{height:48px!important;max-width:90px!important}
  body.printing-daily-subject .print-header h3{font-size:15pt!important;margin:2px 0!important}
  body.printing-daily-subject .print-header div{font-size:8.5pt!important;line-height:1.25!important}
  body.printing-daily-subject .print-header hr{margin:3mm 0!important}
  body.printing-daily-subject .print-header h5{font-size:11pt!important}
  body.printing-daily-subject .report-meta{font-size:8.5pt!important;line-height:1.35!important;margin-bottom:4mm!important}
  body.printing-daily-subject .report-meta span{margin-right:10px!important}
  body.printing-daily-subject .subject-report-block > .session-card{
    border:0!important;box-shadow:none!important;padding:0!important;margin:0 0 5mm!important;
    page-break-inside:avoid!important;break-inside:avoid!important;
  }
  body.printing-daily-subject .subject-report-block > .session-card > .d-flex{
    font-size:9pt!important;margin-bottom:2mm!important;
  }
  body.printing-daily-subject .subject-report-block .table-responsive{
    overflow:visible!important;width:100%!important;display:block!important;
  }
  body.printing-daily-subject .subject-report-block table{
    width:100%!important;table-layout:fixed!important;border-collapse:collapse!important;font-size:7.5pt!important;
    margin:0!important;
  }
  body.printing-daily-subject .subject-report-block th,
  body.printing-daily-subject .subject-report-block td{
    padding:2.2mm 1.5mm!important;line-height:1.15!important;white-space:normal!important;
    word-break:break-word!important;border:1px solid #777!important;
  }
  body.printing-daily-subject .subject-report-block th:nth-child(1),
  body.printing-daily-subject .subject-report-block td:nth-child(1){width:10%!important}
  body.printing-daily-subject .subject-report-block th:nth-child(2),
  body.printing-daily-subject .subject-report-block td:nth-child(2){width:28%!important}
  body.printing-daily-subject .subject-report-block th:nth-child(3),
  body.printing-daily-subject .subject-report-block td:nth-child(3){width:45%!important}
  body.printing-daily-subject .subject-report-block th:nth-child(4),
  body.printing-daily-subject .subject-report-block td:nth-child(4){width:17%!important}
  body.printing-daily-subject .subject-report-block tr{page-break-inside:avoid!important;break-inside:avoid!important}
  body.printing-daily-subject .print-only{display:block!important}
}
.subject-summary-card.selected-for-print{border-color:#1769aa!important;box-shadow:0 0 0 2px rgba(23,105,170,.12)}
