<main id="main" class="settings-workspace"><div class="page-heading"><div><div class="breadcrumb">SLPS / Administration</div><h1>System settings</h1><p>Manage your platform, security and recovery tools.</p></div><button id="settingsReload" class="button secondary">Reload settings</button></div><p id="settingsNotice" class="settings-notice" role="status"></p><div class="settings-layout"><nav class="settings-nav" aria-label="Settings sections"><a href="#settingsGeneral">General</a><a href="#settingsSecurity">Security & registration</a><a href="#settingsAI">AI assistant</a><a href="#settingsAttendance">Attendance</a><a href="#settingsBackups">Database backups</a><a href="#settingsHealth">System checks</a></nav><div class="settings-sections"><form id="settingsForm"><section id="settingsGeneral" class="settings-card"><span class="section-kicker">PLATFORM PREFERENCES</span><h2>General</h2><p>Institution name used on new attendance receipts; support details and academic year shown in this settings overview.</p><div class="settings-grid"><label class="wide">Institution name<input name="institution" maxlength="150" required></label><label>Support email<input name="support_email" type="email" maxlength="254"></label><label>Support phone<input name="support_phone" maxlength="40"></label><label class="wide">Public system URL for QR verification<input name="public_url" type="url" maxlength="200" placeholder="https://your-domain.example/slps"><small>Include the application folder. For XAMPP phone testing, use your computer’s reachable LAN address instead of localhost.</small></label><label>Academic year<input name="academic_year" type="number" min="2000" max="2100" required></label></div><div id="settingsSupport" class="settings-hint"></div></section><section id="settingsSecurity" class="settings-card"><span class="section-kicker">ACCESS POLICY</span><h2>Security & registration</h2><p>Session changes apply on the next authenticated request, including existing sessions.</p><div class="settings-grid"><label>Inactivity timeout (minutes)<input name="idle_minutes" type="number" min="5" max="120" required></label><label>Maximum session duration (hours)<input name="session_hours" type="number" min="1" max="24" required></label></div><label class="settings-switch"><input name="registration_open" type="checkbox"><span><strong>Allow student registration</strong><small>Turn off to stop new public registrations. Management account creation stays available.</small></span></label><a class="settings-link" href="profile.php">Change your password in My Profile →</a></section><section id="settingsAI" class="settings-card"><span class="section-kicker">LEARNING SUPPORT</span><h2>AI assistant</h2><label class="settings-switch"><input name="ai_enabled" type="checkbox"><span><strong>Enable AI chat</strong><small>Controls both the signed-in assistant and login-page support chat.</small></span></label><label>OpenRouter model override<input name="ai_model" maxlength="150" placeholder="Leave blank to use server configuration"></label><p class="settings-hint">API keys remain in config/openrouter.local.php or server environment variables. Keys are never displayed here. Model availability and charges depend on your OpenRouter account.</p></section><div class="settings-save"><span>Changes are applied only when you save.</span><button id="settingsSave" class="button" type="submit">Save changes</button></div></form><section id="settingsAttendance" class="settings-card"><span class="section-kicker">DAILY PARTICIPATION</span><h2>Attendance policy</h2><div id="settingsAttendanceInfo" class="settings-hint"></div><p>Every calendar day counts. Missed days turn red after midnight. Monthly receipts close automatically using Zambia time. Closed receipts keep their saved details.</p><a class="settings-link" href="login-attendance.php">Open attendance receipts →</a></section><section id="settingsBackups" class="settings-card"><div class="settings-section-heading"><div><span class="section-kicker">RECOVERY</span><h2>Database backups</h2></div><button id="settingsBackup" class="button secondary">Create backup</button></div><p>Download a compressed SQL copy of your database. Back up uploaded files and server configuration separately. Restore through phpMyAdmin after taking a current backup.</p><p class="settings-hint">Exports include account records and password hashes. Keep downloads private. Exports cover base tables; database views, routines and events require your database administration tools. Maximum uncompressed export: 250 MB.</p><div id="settingsBackupList" class="settings-backup-list"></div></section><section id="settingsHealth" class="settings-card"><span class="section-kicker">SYSTEM STATUS</span><h2>Readiness checks</h2><div id="settingsChecks" class="settings-checks"></div></section><section class="settings-card"><span class="section-kicker">ACCOUNTABILITY</span><h2>Recent settings activity</h2><div id="settingsAudit" class="settings-audit"></div></section></div></div></main>
