[data-theme=dark] .cr:hover{background:#1e293b}
[data-theme=dark] .cr{border-bottom-color:#1e293b}
[data-theme=dark] details.bd-item[open] summary{background:#1e293b}
[data-theme=dark] details.bd-item summary:hover{background:#1e3a5f}
[data-theme=dark] .att-tbl td{border-bottom-color:#334155}
[data-theme=dark] .att-tbl-section{background:#2a2a2a}
[data-theme=dark] .att-goal-box-cell{background:#2a2a2a}
[data-theme=dark] .att-goal-card-head.g75{background:#2d1f06;color:#fbbf24;border-bottom-color:#78350f}
[data-theme=dark] .att-goal-card-head.g85{background:#172554;color:#93c5fd;border-bottom-color:#1e40af}
[data-theme=dark] .att-goal-card-head.done{background:#052e16;color:#4ade80;border-bottom-color:#14532d}
[data-theme=dark] .att-goal-card-head.danger{background:#3b0712;color:#fca5a5;border-bottom-color:#991b1b}
[data-theme=dark] .att-mode-toggle{background:#1e293b;border-color:#334155}
[data-theme=dark] .att-mode-btn.active{background:#000;color:#f8fafc;box-shadow:0 1px 4px rgba(0,0,0,.4)}
[data-theme=dark] .att-mode-badge{background:rgba(59,130,246,.2);color:#93c5fd}
[data-theme=dark] .att-count-pill.present{background:#052e16;color:#4ade80}
[data-theme=dark] .att-count-pill.absent{background:#3b0712;color:#fca5a5}
[data-theme=dark] .att-goal-denom{color:#94a3b8;opacity:.7}
[data-theme=dark] .att-modal-card{background:#000}
[data-theme=dark] .att-modal-header{border-bottom-color:#334155}
[data-theme=dark] .comp-track{background:#334155}
[data-theme=dark] details.bd-item summary{background:#0f172a}
[data-theme=dark] .cr-track{background:#334155}
[data-theme=dark] .cr-mark{background:rgba(255,255,255,.45)}
[data-theme=dark] .sgpa-sem-box.empty{background:#1e293b;border-color:#334155;color:#475569}
[data-theme=dark] #refresh-overlay{background:rgba(15,23,42,.92)}
[data-theme=dark] *::-webkit-scrollbar{width:6px;height:6px}
[data-theme=dark] *::-webkit-scrollbar-track{background:#0f172a}
[data-theme=dark] *::-webkit-scrollbar-thumb{background:#334155;border-radius:99px}
[data-theme=dark] *::-webkit-scrollbar-thumb:hover{background:#475569}
[data-theme=dark] [data-color=green]{background:rgba(22,163,74,.14)!important;border-color:rgba(22,163,74,.4)!important;color:#4ade80!important}
[data-theme=dark] [data-color=blue]{background:rgba(37,99,235,.14)!important;border-color:rgba(37,99,235,.4)!important;color:#60a5fa!important}
[data-theme=dark] [data-color=amber]{background:rgba(180,83,9,.18)!important;border-color:rgba(251,191,36,.35)!important;color:#fbbf24!important}
[data-theme=dark] [data-color=red]{background:rgba(220,38,38,.14)!important;border-color:rgba(220,38,38,.4)!important;color:#f87171!important}
[data-theme=dark] .sgpa-sem-row{opacity:.85}

/* PAGE LAYOUT */
#view-attendance .page{flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column;gap:8px;padding:8px 14px;padding-bottom:calc(58px + env(safe-area-inset-bottom,0px) + 16px);max-width:1200px;width:100%;margin:0 auto;box-sizing:border-box}

.flip-wrap{flex-shrink:0;perspective:900px;cursor:pointer;user-select:none;width:100%;min-width:0}
.flip-inner{position:relative;transform-style:preserve-3d;transition:transform .5s cubic-bezier(.4,0,.2,1);border-radius:var(--radius);width:100%;min-width:0}
.flip-inner.flipped{transform:rotateY(180deg)}
.card-face{background:var(--surface);border-radius:var(--radius);box-shadow:var(--shadow);border:1px solid var(--border);padding:12px 16px;backface-visibility:hidden;-webkit-backface-visibility:hidden;box-sizing:border-box;width:100%}
.card-back{position:absolute;inset:0;transform:rotateY(180deg);overflow:hidden;padding:10px!important;display:flex;align-items:center}
.flip-back-inner{width:100%}
.stu-main-row{display:flex;align-items:center;gap:14px;width:100%}
.photo-wrap{position:relative;width:72px;height:72px;border-radius:50%;border:2px solid var(--border);flex-shrink:0;background:var(--surface);overflow:hidden;backface-visibility:hidden;-webkit-backface-visibility:hidden;transform:translateZ(0)}
.photo-skel{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:1.4rem;font-weight:800;color:var(--muted);background:linear-gradient(90deg,var(--bg) 0%,var(--border) 50%,var(--bg) 100%);background-size:200% 100%;animation:shimmer 1.5s infinite linear;z-index:1}
.student-photo{position:relative;width:100%;height:100%;object-fit:cover;z-index:2;opacity:0;transition:opacity 0.25s ease;backface-visibility:hidden;-webkit-backface-visibility:hidden}
.student-photo.loaded{opacity:1}
.student-photo-ph{width:72px;height:72px;border-radius:50%;flex-shrink:0;background:var(--accent);color:#fff;display:flex;align-items:center;justify-content:center;font-size:1.5rem;font-weight:800;backface-visibility:hidden;-webkit-backface-visibility:hidden;transform:translateZ(0)}
@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
[data-theme=dark] .photo-skel{background:linear-gradient(90deg,#0f172a 0%,#1e293b 50%,#0f172a 100%);background-size:200% 100%}
.stu-info h2{font-size:.95rem;font-weight:800;margin-bottom:1px}
.stu-usn{font-family:'DM Mono',monospace;font-size:.8rem;color:var(--accent);margin-bottom:1px}
.stu-prog{font-size:.74rem;color:var(--muted)}

.sgpa-chip{display:flex;flex-direction:column;align-items:center;justify-content:center;width:72px;height:72px;border-radius:10px;border:1.5px solid;flex-shrink:0;font-family:'DM Sans',sans-serif;margin-left:auto;text-align:center}
.sgpa-chip-val{font-family:'DM Mono',monospace;font-size:1.2rem;font-weight:800;line-height:1.1;margin:1px 0}
.sgpa-chip-hint{font-size:.52rem;opacity:.55;margin-top:1px}
.sgpa-fetch-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;width:72px;height:72px;border-radius:10px;border:1.5px dashed var(--border);background:var(--bg);flex-shrink:0;margin-left:auto;cursor:pointer;transition:border-color .15s,background .15s;font-family:'DM Sans',sans-serif;text-align:center}
.sgpa-fetch-btn:hover:not(:disabled){border-color:var(--accent);background:#eff6ff}
.sgpa-fetch-btn:disabled{opacity:.6;cursor:not-allowed}
.sgpa-fetch-label{font-size:.56rem;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--muted)}
.sgpa-fetch-sub{font-size:.62rem;font-weight:700;color:var(--accent);margin-top:3px}
[data-theme=dark] .sgpa-fetch-btn{background:#1e293b;border-color:#334155}
[data-theme=dark] .sgpa-fetch-btn:hover:not(:disabled){background:#1e3a5f;border-color:var(--accent)}

.sgpa-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;width:100%;min-width:0}
.sgpa-year-col{display:flex;flex-direction:row;align-items:stretch;gap:3px;min-width:0;overflow:hidden}
.sgpa-yr-label{writing-mode:vertical-rl;transform:rotate(180deg);font-size:.5rem;font-weight:700;color:var(--muted);letter-spacing:.05em;text-transform:uppercase;white-space:nowrap;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.sgpa-year-boxes{display:flex;flex-direction:column;gap:3px;flex:1;min-width:0}
.sgpa-sem-box{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:4px 2px;border-radius:7px;border:1.5px solid var(--border);background:var(--bg);flex:1;min-width:0;overflow:hidden}
.sgpa-sem-box.empty{opacity:.35}
.sgpa-sem-row{font-size:.5rem;font-weight:700;opacity:.65;text-transform:uppercase;letter-spacing:.03em;line-height:1.2}
[data-theme=dark] .sgpa-sem-box.empty .sgpa-sem-row{opacity:1;color:#e2e8f0}
[data-theme=dark] .sgpa-yr-label{color:#94a3b8}
.sgpa-sem-val{font-family:'DM Mono',monospace;font-size:.78rem;font-weight:800;line-height:1.2;width:100%;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.data-section{flex:1;overflow:hidden;min-height:0;display:flex;flex-direction:column}
.tab-card{background:var(--surface);border-radius:var(--radius);box-shadow:var(--shadow);border:1px solid var(--border);overflow:hidden;display:flex;flex-direction:column;flex:1;min-height:0}
.tab-bar{display:flex;border-bottom:1px solid var(--border);flex-shrink:0}
.tab-btn{flex:1;padding:12px 16px;font-family:'DM Sans',sans-serif;font-size:.84rem;font-weight:700;color:var(--muted);background:var(--bg);border:none;cursor:pointer;transition:color .15s,background .15s;display:flex;align-items:center;justify-content:center;gap:7px;position:relative}
.tab-btn:hover{color:var(--text);background:#f0f4ff}
.tab-btn.active{color:var(--accent);background:var(--surface)}
.tab-btn.active::after{content:'';position:absolute;bottom:-1px;left:0;right:0;height:2.5px;background:var(--accent);border-radius:2px 2px 0 0}
.tab-panel{padding:10px 12px;display:none;flex:1;flex-direction:column;min-height:0}
.tab-panel.active{display:flex}
#tab-att{overflow:hidden}
#tab-cie{overflow-y:auto}
.desk-panel-title,.desk-panel-sub,.desk-panel-head--cie{display:none}
.desk-panel-body{display:flex;flex-direction:column;flex:1;min-height:0}
@media(min-width:700px){
  .tab-bar{display:none}
  .tab-card{display:grid;grid-template-columns:1fr 1fr;gap:14px;height:100%;min-height:0;background:none;border:none;box-shadow:none;border-radius:0;overflow:visible}
  .tab-panel{display:flex;background:var(--surface);border-radius:var(--radius);box-shadow:var(--shadow);border:1px solid var(--border);flex-direction:column;overflow:hidden;min-height:0;padding:0}
  #tab-cie{overflow:hidden}
  .desk-panel-head,.desk-panel-head--cie{display:flex;align-items:center;justify-content:space-between;padding:14px 18px 0;flex-shrink:0}
  .desk-panel-title{display:inline;font-size:.73rem;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--muted)}
  .desk-panel-sub{display:inline;font-size:.68rem;color:var(--muted)}
  .desk-panel-head .card-legend{margin-bottom:0}
  .desk-panel-body{flex:1;overflow-y:auto;padding:12px 18px 16px;display:flex;flex-direction:column}
  .desk-panel-body--cie{overflow-y:auto}
}
.card-legend{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:8px;justify-content:center}
.leg-item{display:flex;align-items:center;gap:4px;font-size:.68rem;color:var(--muted)}
.leg-dot{width:7px;height:7px;border-radius:2px;flex-shrink:0}
.empty-panel{text-align:center;color:var(--muted);font-size:.85rem;padding:20px 0;margin:auto 0;display:flex;align-items:center;justify-content:center;flex:1;min-height:100%}
.cie-panel{display:flex;flex-direction:column;flex:1;min-height:0;gap:6px;padding:2px 0}
.att-rows{display:flex;flex-direction:column;flex:1;justify-content:space-evenly;height:100%;gap:3px;overflow:hidden}
.cr{display:grid;grid-template-columns:130px 1fr auto;align-items:center;gap:8px;padding:0 8px;border-bottom:1px solid var(--border);border-radius:8px;cursor:pointer;transition:background .12s;flex:1 1 auto;max-height:60px;min-height:36px}
.cr:last-child{border-bottom:none}
.cr:hover{background:#f0f4ff}
.cr-label{min-width:0}
.cr-name{display:block;font-size:.74rem;font-weight:700;letter-spacing:-0.01em;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cr-track{position:relative;height:9px;background:#f1f5f9;border-radius:5px;overflow:visible}
.cr-fill{height:100%;border-radius:5px;transition:width .4s ease}
.cr-mark{position:absolute;top:-3px;width:2px;height:15px;background:rgba(0,0,0,.35);border-radius:1px;z-index:2}
.cr-pill{font-family:'DM Mono',monospace;font-size:.72rem;font-weight:700;padding:3px 0;border-radius:20px;border:1px solid;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:2px;flex-shrink:0;width:52px}
.cr-pill-arrow{font-size:.85rem;font-weight:800;line-height:1}
details.bd-item{border:1.5px solid var(--border);border-radius:10px;overflow:hidden;flex:1;display:flex;flex-direction:column;min-height:32px;margin-bottom:0}
details.bd-item:last-child{margin-bottom:0}
details.bd-item[open]{border-color:var(--accent);flex:none}
details.bd-item summary{list-style:none;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:0 14px;cursor:pointer;background:var(--bg);transition:background .12s;user-select:none;flex:1;min-height:32px}
details.bd-item[open] summary{background:#f8faff;flex:none;flex-shrink:0}
details.bd-item summary:hover{background:#eef2ff}
details.bd-item summary::-webkit-details-marker{display:none}
.bd-left{display:flex;align-items:center;gap:8px;min-width:0;flex:1}
.bd-name{font-size:.82rem;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600}
.bd-right{display:flex;align-items:center;gap:8px;flex-shrink:0}
.bd-pill{font-family:'DM Mono',monospace;font-size:.75rem;font-weight:700;padding:3px 9px;border-radius:20px;border:1px solid transparent;white-space:nowrap}
.bd-pill-main{width:56px;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#b91c1c;background:#fff1f2;border-color:#fecdd3;font-variant-numeric:tabular-nums;}
[data-theme=dark] .bd-pill-main{color:#f87171;background:rgba(220,38,38,.14);border-color:rgba(220,38,38,.4)}
.bd-chevron{color:var(--muted);font-size:.8rem;transition:transform .18s;line-height:1;flex-shrink:0}
details.bd-item[open] .bd-chevron{transform:rotate(90deg)}
.bd-body{padding:12px 14px 14px}
.cie-detail-placeholder{text-align:center;color:var(--muted);font-size:.8rem;padding:8px 0}
.comp-row{margin-bottom:8px}.comp-row:last-child{margin-bottom:0}
.comp-meta{display:flex;align-items:center;justify-content:space-between;margin-bottom:3px;gap:6px}
.comp-name{font-family:'DM Mono',monospace;font-size:.7rem;font-weight:600;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;flex:1}
.comp-val{font-family:'DM Mono',monospace;font-size:.7rem;font-weight:700}
.comp-track{position:relative;height:12px;background:#f1f5f9;border-radius:6px;overflow:visible}
.comp-fill{height:100%;border-radius:6px;transition:width .4s ease;min-width:2px}
.comp-avg-badge{position:absolute;top:50%;transform:translate(-50%,-50%);background:#ef4444;color:#fff;font-family:'DM Mono',monospace;font-size:.58rem;font-weight:700;padding:1px 4px;border-radius:3px;white-space:nowrap;z-index:2;line-height:1.6;box-shadow:0 1px 3px rgba(0,0,0,.25);pointer-events:none}

#refresh-overlay{display:none;position:fixed;inset:0;z-index:90;background:rgba(240,244,255,.9);backdrop-filter:blur(4px);flex-direction:column;align-items:center;justify-content:center;gap:12px}
#refresh-overlay.active{display:flex}
.overlay-txt{font-size:.88rem;font-weight:700;color:var(--accent)}

#att-error-state{display:none;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:60px 20px calc(58px + env(safe-area-inset-bottom, 0px) + 20px);gap:14px;flex:1;min-height:0;box-sizing:border-box}

/* Attendance Detail Modal */
.att-modal-overlay{position:fixed;inset:0;background:rgba(15,23,42,.45);backdrop-filter:blur(3px);display:flex;align-items:flex-end;justify-content:center;z-index:10000}
@media(min-width:500px){.att-modal-overlay{align-items:center}}
.att-modal-card{background:var(--surface);border-radius:16px 16px 0 0;width:100%;max-width:640px;max-height:88vh;overflow:hidden;display:flex;flex-direction:column;box-shadow:0 -4px 32px rgba(0,0,0,.15)}
@media(min-width:500px){.att-modal-card{border-radius:16px;max-height:82vh}}
.att-modal-header{padding:14px 18px 12px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;flex-shrink:0}
.att-modal-body{padding:14px 16px;overflow-y:auto;display:flex;flex-direction:column;gap:12px}
.att-mode-toggle{display:flex;background:var(--bg);border:1px solid var(--border);border-radius:10px;padding:3px;gap:4px}
.att-mode-btn{flex:1;border:none;background:transparent;padding:7px 10px;border-radius:7px;font-family:'DM Sans',sans-serif;font-size:.76rem;font-weight:700;color:var(--muted);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:4px;transition:all .15s ease}
.att-mode-btn.active{background:var(--surface);color:var(--text);box-shadow:0 1px 4px rgba(0,0,0,.08)}
.att-mode-sub{font-size:.7rem;font-weight:600;opacity:.8;margin-left:1px}
.att-goals-container{display:flex;flex-direction:column}
.att-goals-container[data-mode="current"] .att-goal-grid-final,
.att-goals-container[data-mode="current"] .att-goal-grid-sem{display:none}
.att-goals-container[data-mode="final"] .att-goal-grid-current,
.att-goals-container[data-mode="sem"] .att-goal-grid-current{display:none}
.att-goal-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.att-goal-card{border-radius:12px;border:1.5px solid var(--border);overflow:hidden;display:flex;flex-direction:column}
.att-goal-card-head{padding:7px 12px;font-size:.65rem;font-weight:800;letter-spacing:.07em;text-transform:uppercase;text-align:center}
.att-goal-card-head.g75{background:#fffbeb;color:#92400e;border-bottom:1.5px solid #fde68a}
.att-goal-card-head.g85{background:#eff6ff;color:#1d4ed8;border-bottom:1.5px solid #bfdbfe}
.att-goal-card-head.done{background:#f0fdf4;color:#15803d;border-bottom:1.5px solid #bbf7d0}
.att-goal-card-head.danger{background:#fff1f2;color:#991b1b;border-bottom:1.5px solid #fecdd3}
.att-goal-boxes{display:grid;grid-template-columns:1fr 1fr;gap:0;flex:1;align-items:stretch}
.att-goal-box-cell{padding:10px 6px;text-align:center;background:var(--bg);display:flex;flex-direction:column;align-items:center;justify-content:center}
.att-goal-box-cell:first-child{border-right:1px solid var(--border)}
.att-goal-box-val{font-family:'DM Mono',monospace;font-size:1.35rem;font-weight:800;line-height:1;display:inline-flex;align-items:baseline;justify-content:center;white-space:nowrap}
.att-goal-denom{font-size:.82rem;font-weight:600;color:var(--muted);opacity:.75;margin-left:1px}
.att-goal-box-lbl{font-size:.58rem;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:var(--muted);margin-top:3px}
.att-tables-wrap{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.att-tbl-section{background:var(--bg);border-radius:10px;overflow:hidden}
.att-tbl-head{padding:8px 10px;font-size:.7rem;font-weight:800;letter-spacing:.05em;text-transform:uppercase;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.att-tbl-head-present{color:#15803d}
.att-tbl-head-absent{color:#9f1239}
.att-count-pill{font-family:'DM Mono',monospace;font-size:.7rem;font-weight:700;padding:1px 7px;border-radius:20px}
.att-count-pill.present{background:#dcfce7;color:#166534}
.att-count-pill.absent{background:#fee2e2;color:#991b1b}
.att-tbl{width:100%;border-collapse:collapse;font-size:.72rem}
.att-tbl th{padding:5px 8px;text-align:center;color:var(--muted);font-weight:700;font-size:.65rem;letter-spacing:.04em;text-transform:uppercase;border-bottom:1px solid var(--border);}
.att-tbl td{padding:5px 8px;border-bottom:1px solid #f1f5ff;color:var(--text)}
.att-tbl tr:last-child td{border-bottom:none}
.att-tbl .mono{font-family:'DM Mono',monospace}
.att-tbl th,.att-tbl td{text-align:center;}
