* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', sans-serif; }
body { background-color: #0f172a; color: #f8fafc; }
.hidden { display: none !important; }

/* Auth Screen */
.screen-container { width: 100vw; height: 100vh; display: flex; flex-direction: column; }
#auth-screen { justify-content: center; align-items: center; background: linear-gradient(135deg, #1e293b, #0f172a); }
.auth-card { background: #1e293b; padding: 35px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); width: 380px; }
.auth-card h2 { font-size: 20px; margin-bottom: 20px; text-align: center; color: #38bdf8; }
.input-group { margin-bottom: 12px; }
.input-group label { display: block; font-size: 12px; margin-bottom: 4px; color: #94a3b8; }
.input-group input, .input-group select { width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid #334155; background: #0f172a; color: white; }

/* Header & Live Clock */
.top-nav { background: #1e293b; padding: 12px 25px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #334155; }
.date-display { background: #0f172a; padding: 6px 15px; border-radius: 20px; border: 1px solid #334155; color: #38bdf8; font-size: 13px; font-weight: bold; }

/* Buttons & Navigation */
.header-action-buttons { display: flex; gap: 10px; margin-left: auto; align-items: flex-end; }
.btn-primary { width: 100%; padding: 10px; background: #0284c7; border: none; color: white; border-radius: 6px; cursor: pointer; font-weight: bold; }
.btn-secondary { background: #475569; color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; }
.btn-action { background: #10b981; color: white; border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-weight: bold; }
.btn-danger { background: #ef4444; color: white; border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; }
.btn-outline { background: transparent; border: 1px dashed #38bdf8; color: #38bdf8; padding: 7px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.btn-success { width: 100%; margin-top: 15px; padding: 12px; background: #16a34a; border: none; color: white; font-weight: bold; border-radius: 6px; cursor: pointer; }
.btn-sm { padding: 4px 8px; font-size: 11px; margin-top: 5px; }

/* Dashboard Content */
.dashboard-body { padding: 15px; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.selection-panel { background: #1e293b; padding: 12px; border-radius: 8px; display: flex; gap: 15px; border: 1px solid #334155; align-items: center; }
.control-group { display: flex; flex-direction: column; gap: 4px; }
.control-group label { font-size: 11px; color: #94a3b8; }
.control-group select { padding: 6px 10px; background: #0f172a; border: 1px solid #334155; color: white; border-radius: 6px; font-size: 13px; }

/* Camera View & Scanner Upload */
.main-content-grid { display: grid; grid-template-columns: 380px 1fr; gap: 12px; flex: 1; }
.panel { background: #1e293b; border-radius: 8px; padding: 15px; border: 1px solid #334155; display: flex; flex-direction: column; }
.video-wrapper { position: relative; background: #000; border-radius: 8px; min-height: 220px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#webcam, #scanned-uploaded-img { width: 100%; height: 220px; object-fit: cover; }
.scan-overlay { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,0.8); padding: 4px 8px; border-radius: 4px; font-size: 11px; color: #38bdf8; }
.camera-controls { margin-top: 10px; display: flex; gap: 10px; }
.scan-upload-box { margin-top: 12px; padding-top: 10px; border-top: 1px solid #334155; font-size: 11px; color: #94a3b8; }
.scan-upload-box input { margin-top: 5px; width: 100%; font-size: 11px; }

/* Matrix Table Styling */
.table-container { flex: 1; overflow-x: auto; overflow-y: auto; max-height: 440px; }
table { width: 100%; border-collapse: collapse; text-align: center; font-size: 12px; }
th, td { padding: 6px 4px; border: 1px solid #334155; }
th { background: #0f172a; color: #94a3b8; }

.student-name-link { color: #38bdf8; text-decoration: underline; cursor: pointer; text-align: left; padding-left: 5px; }
.student-thumb { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.badge-p { background: rgba(34, 197, 94, 0.2); color: #4ade80; font-weight: bold; border-radius: 4px; padding: 2px 4px; cursor: pointer; }
.badge-a { background: rgba(239, 68, 68, 0.2); color: #f87171; font-weight: bold; border-radius: 4px; padding: 2px 4px; cursor: pointer; }

/* Modals */
.modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: #1e293b; padding: 25px; border-radius: 10px; width: 360px; position: relative; border: 1px solid #334155; }
.modal-large { width: 550px; }
.close-btn { position: absolute; top: 10px; right: 15px; font-size: 20px; cursor: pointer; color: #94a3b8; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 15px; }
.photo-input-section { margin-top: 15px; border-top: 1px solid #334155; padding-top: 10px; }
.photo-input-section h4 { font-size: 13px; color: #38bdf8; margin-bottom: 10px; }
.photo-options { display: flex; gap: 10px; align-items: center; }
.photo-box { flex: 1; background: #0f172a; padding: 10px; border-radius: 6px; border: 1px solid #334155; font-size: 11px; }
.or-divider { font-weight: bold; color: #94a3b8; font-size: 11px; }
.mini-cam-preview { width: 100%; height: 90px; background: #000; margin-top: 5px; border-radius: 4px; overflow: hidden; position: relative; }
#registration-cam, #captured-preview-img { width: 100%; height: 100%; object-fit: cover; }