/* ═══════════════════════════════════════════════════════════
   ESCore Notes PWA — Ultra Modern Design System
   Light + Dark mode with toggle, glassmorphism, smooth UX
   ═══════════════════════════════════════════════════════════ */

/* ── Design Tokens — Light Mode (default) ── */
:root {
  --accent: #4f46e5;
  --accent-grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-soft: rgba(79, 70, 229, 0.08);
  --bg: #f0f2f8;
  --bg-grad: radial-gradient(ellipse at top, #e8ecf5 0%, #f0f2f8 60%);
  --card: #ffffff;
  --card-elevated: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-light: #8888a0;
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.12);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.1);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.1);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 24px rgba(79, 70, 229, 0.15);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.5);
  --blur: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --spring: 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Dark Mode ── */
[data-theme="dark"] {
  --accent: #818cf8;
  --accent-grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-soft: rgba(129, 140, 248, 0.12);
  --bg: #0a0b14;
  --bg-grad: radial-gradient(ellipse at top, #131428 0%, #0a0b14 60%);
  --card: #161728;
  --card-elevated: #1c1e34;
  --text: #f0f1f8;
  --text-secondary: #b0b2c8;
  --text-light: #8b8da8;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 24px rgba(129, 140, 248, 0.2);
  --glass: rgba(22, 23, 40, 0.72);
  --glass-border: rgba(255, 255, 255, 0.08);
}

/* ── Auto dark mode (if no manual preference) ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #818cf8;
    --accent-grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-soft: rgba(129, 140, 248, 0.12);
    --bg: #0a0b14;
    --bg-grad: radial-gradient(ellipse at top, #131428 0%, #0a0b14 60%);
    --card: #161728;
    --card-elevated: #1c1e34;
    --text: #f0f1f8;
    --text-secondary: #b0b2c8;
    --text-light: #8b8da8;
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.12);
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.12);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.12);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.12);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 24px rgba(129, 140, 248, 0.2);
    --glass: rgba(22, 23, 40, 0.72);
    --glass-border: rgba(255, 255, 255, 0.08);
  }
}

/* ── Reset ── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* ── SVG Icons ── */
.icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}
.icon-sm {
  width: 18px;
  height: 18px;
}
.icon-lg {
  width: 32px;
  height: 32px;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Inter', sans-serif;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition), color var(--transition);
}

/* ── Screens with animated transitions ── */
.screen {
  display: none;
  min-height: 100vh;
  animation: screenFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.screen.active {
  display: flex;
  flex-direction: column;
}
@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Theme Toggle ── */
.theme-toggle {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--card);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--spring), box-shadow var(--transition), border-color var(--transition);
  box-shadow: var(--shadow-md);
}
.theme-toggle.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.6);
}
.theme-toggle svg {
  width: 22px;
  height: 22px;
}

/* ── Sync indicator badge ── */
.sync-badge {
  position: fixed;
  top: 20px;
  right: 14px;
  font-size: .7rem;
  padding: 6px 14px;
  border-radius: 100px;
  z-index: 200;
  font-weight: 700;
  letter-spacing: 0.02em;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1.5px solid transparent;
  max-width: calc(100vw - 80px);
  transition: opacity var(--transition);
}
.sync-online { background: var(--success-soft); color: var(--success); border-color: var(--success-soft); }
.sync-pending { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-soft); }
.sync-offline { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-soft); }
.sync-badge .sync-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}
.sync-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ════════════════════════════════════════
   LOGIN SCREEN
   ════════════════════════════════════════ */
#screen-login {
  justify-content: center;
  align-items: center;
  padding: 80px 24px 24px;
}
.login-container {
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.login-logo {
  font-size: 3.5rem;
  margin-bottom: 12px;
  color: var(--accent);
  filter: drop-shadow(0 4px 12px rgba(79, 70, 229, 0.3));
  animation: floatLogo 3s ease-in-out infinite;
}
.login-logo svg {
  width: 64px;
  height: 64px;
}
@keyframes floatLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.login-title {
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.login-subtitle {
  font-size: .9rem;
  color: var(--text-secondary);
  margin-bottom: 36px;
  font-weight: 500;
  line-height: 1.5;
}
.login-field {
  margin-bottom: 18px;
  text-align: left;
}
.login-field label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.login-field input {
  width: 100%;
  padding: 18px 20px;
  font-size: 1.1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}
.login-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.login-btn {
  width: 100%;
  padding: 20px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent-grad);
  background-size: 200% auto;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform var(--spring), background-position var(--transition), box-shadow var(--transition);
  margin-top: 8px;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.login-btn:active {
  transform: scale(0.97);
  background-position: right center;
}
.login-btn:disabled {
  opacity: .5;
  box-shadow: var(--shadow-sm);
}
.login-error {
  color: var(--danger);
  font-size: .85rem;
  margin-top: 14px;
  min-height: 1.2em;
  font-weight: 600;
  line-height: 1.4;
}

/* ════════════════════════════════════════
   MENU SCREEN
   ════════════════════════════════════════ */
#screen-menu {
  padding: 80px 20px 24px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}
.menu-header {
  text-align: center;
  margin-bottom: 28px;
  margin-top: 28px;
}
.menu-greeting {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.3;
}
.menu-class-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 18px;
  background: var(--accent-grad);
  color: #fff;
  border-radius: 100px;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.menu-school-name {
  font-size: .82rem;
  color: var(--text-secondary);
  margin-top: 8px;
  font-weight: 500;
  line-height: 1.4;
}
.menu-section-label {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  margin: 0 0 16px;
  text-align: center;
}
.menu-student-count {
  text-align: center;
  font-size: .82rem;
  color: var(--text-secondary);
  margin-top: 20px;
  font-weight: 500;
  line-height: 1.4;
}
.module-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 8px;
}
.module-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 120px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.module-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-grad);
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 0;
}
.module-card:active {
  transform: scale(0.97);
}
.module-card:active::before {
  opacity: 1;
}
.module-card-icon {
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
  color: var(--accent);
}
.module-card-icon svg {
  width: 36px;
  height: 36px;
}
.module-card:active .module-card-icon {
  color: #fff;
}
.module-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
}
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 36px auto 0;
  padding: 14px 32px;
  background: transparent;
  border: 1.5px solid var(--border-strong);
  border-radius: 100px;
  color: var(--text-secondary);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.logout-btn:active {
  transform: scale(0.96);
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}

/* ════════════════════════════════════════
   PERIODES SCREEN (own page)
   ════════════════════════════════════════ */
#screen-periodes {
  padding: 80px 20px 24px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}
.periode-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}
.periode-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 28px 24px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 90px;
  box-shadow: var(--shadow-md);
  text-align: left;
  width: 100%;
}
.periode-btn:active {
  transform: scale(0.97);
  border-color: var(--accent);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}
.periode-btn-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  background: var(--accent-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}
.periode-btn-content {
  flex: 1;
}
.periode-btn-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
}
.periode-btn-sub {
  font-size: .82rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
  line-height: 1.4;
}
.periode-btn-arrow {
  width: 24px;
  height: 24px;
  color: var(--text-secondary);
  opacity: 0.6;
  flex-shrink: 0;
}

/* ════════════════════════════════════════
   LIST SCREENS (subjects, exams)
   ════════════════════════════════════════ */
#screen-subjects, #screen-exams {
  padding: 80px 20px 24px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}
.list-header {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 800;
  margin: 28px 0 8px;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.3;
}
.list-header-sub {
  text-align: center;
  font-size: .85rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-weight: 500;
  line-height: 1.4;
}
.list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 24px;
}
.big-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 22px 24px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  width: 100%;
  box-shadow: var(--shadow-sm);
}
.big-btn-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.big-btn-icon svg {
  width: 22px;
  height: 22px;
}
.big-btn-content {
  flex: 1;
  min-width: 0;
}
.big-btn:active {
  transform: scale(0.97);
  border-color: var(--accent);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.big-btn-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
}
.big-btn-sub {
  font-size: .85rem;
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.4;
}
.sub-discipline {
  font-weight: 400;
  color: var(--text-secondary);
}
.empty-msg {
  text-align: center;
  color: var(--text-secondary);
  padding: 48px 24px;
  font-size: .95rem;
  font-weight: 500;
  line-height: 1.5;
}
.back-btn-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 20px auto 0;
  padding: 16px 24px;
  background: var(--card);
  border: 1.5px solid var(--border-strong);
  border-radius: 100px;
  color: var(--text-secondary);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  max-width: 280px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.back-btn-nav:active {
  transform: scale(0.97);
}

/* ════════════════════════════════════════
   GRADE ENTRY SCREEN
   ════════════════════════════════════════ */
#screen-entry {
  padding: 0;
  height: 100vh;
  overflow: hidden;
}
.entry-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: var(--accent-grad);
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}
.back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: .9rem;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 100px;
  font-weight: 600;
  transition: background var(--transition-fast);
}
.back-btn:active {
  background: rgba(255, 255, 255, 0.3);
}
.entry-subject {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.entry-sur {
  font-size: .95rem;
  opacity: .8;
  min-width: 44px;
  text-align: right;
  font-weight: 600;
}

/* Student card area */
.student-card-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
#student-card {
  text-align: center;
  padding: 24px;
  width: 100%;
}
.student-name {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.03em;
  animation: studentSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.student-firstname {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  animation: studentSlideIn 0.35s 0.05s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.student-num {
  font-size: .9rem;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.05em;
}
@keyframes studentSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Progress bar */
#progress-bar {
  padding: 10px 24px;
  flex-shrink: 0;
}
.progress-track {
  height: 8px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent-grad);
  border-radius: 100px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-text {
  text-align: center;
  font-size: .78rem;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 600;
}

/* Navigation buttons */
#entry-nav {
  display: flex;
  justify-content: space-between;
  padding: 0 24px 10px;
  flex-shrink: 0;
  gap: 16px;
}
.nav-btn {
  width: 64px;
  height: 52px;
  border: 2px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-btn:active {
  transform: scale(0.92);
  border-color: var(--accent);
}
.nav-btn.disabled {
  opacity: .25;
  cursor: default;
}

/* Keypad */
#keypad {
  flex-shrink: 0;
  padding: 12px 16px 20px;
  background: var(--card);
  border-top: 1px solid var(--border);
}
.keypad-display {
  text-align: center;
  font-size: 2.8rem;
  font-weight: 900;
  padding: 10px 0 14px;
  min-height: 64px;
  letter-spacing: -0.03em;
}
.note-display { color: var(--success); }
.abs-display { color: var(--danger); }
.empty-display { color: var(--text-secondary); opacity: .4; }

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.kp-btn {
  height: 68px;
  border: none;
  border-radius: var(--radius);
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--spring), background var(--transition-fast), box-shadow var(--transition-fast);
  background: var(--card-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.kp-btn:active {
  transform: scale(0.92);
  box-shadow: var(--shadow-md);
}
.kp-abs {
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 1.05rem;
  border-color: transparent;
}
.kp-clear {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kp-validate {
  background: var(--success);
  color: #fff;
  font-size: 2rem;
  border-color: transparent;
  box-shadow: var(--shadow-md);
  grid-row: span 2;
  height: calc(68px * 2 + 10px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.kp-back {
  background: var(--card-elevated);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ════════════════════════════════════════
   RECAP SCREEN
   ════════════════════════════════════════ */
#screen-recap {
  padding: 80px 20px 24px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}
.recap-header {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 800;
  margin: 28px 0 20px;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.3;
}
.recap-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.recap-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}
.recap-row:active {
  transform: scale(0.98);
}
.recap-name {
  font-weight: 600;
  font-size: .98rem;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
}
.recap-note {
  font-weight: 900;
  font-size: 1.2rem;
  min-width: 56px;
  text-align: right;
  letter-spacing: -0.02em;
}
.recap-good { color: var(--success); }
.recap-bad { color: var(--danger); }
.recap-abs { color: var(--danger); font-size: .9rem; }
.recap-empty { color: var(--text-secondary); }
.recap-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.recap-actions button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--spring);
  letter-spacing: -0.01em;
}
.recap-actions button:active {
  transform: scale(0.97);
}
.recap-finish {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.recap-back {
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--border-strong);
}

/* ════════════════════════════════════════
   SCROLLBAR STYLING
   ════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

/* ════════════════════════════════════════
   RESPONSIVE — Small screens
   ════════════════════════════════════════ */
@media (max-width: 380px) {
  .login-title { font-size: 1.4rem; }
  .login-subtitle { font-size: .82rem; }
  .menu-greeting { font-size: 1.3rem; }
  .module-card { padding: 24px 18px; min-height: 100px; }
  .module-card-icon svg { width: 30px; height: 30px; }
  .module-card-title { font-size: 1rem; }
  .periode-btn { padding: 22px 18px; min-height: 80px; gap: 12px; }
  .periode-btn-icon { width: 48px; height: 48px; font-size: 1.4rem; }
  .periode-btn-title { font-size: 1.1rem; }
  .list-header { font-size: 1.15rem; }
  .big-btn { padding: 18px 18px; gap: 12px; }
  .big-btn-icon { width: 38px; height: 38px; }
  .big-btn-icon svg { width: 20px; height: 20px; }
  .big-btn-title { font-size: 1rem; }
  .student-name { font-size: 1.8rem; }
  .student-firstname { font-size: 1.3rem; }
  .keypad-display { font-size: 2.4rem; }
  .kp-btn { height: 60px; font-size: 1.35rem; }
  .kp-validate { height: calc(60px * 2 + 10px); }
  .kp-abs { font-size: .95rem; }
  .nav-btn { width: 56px; height: 48px; }
  .recap-name { font-size: .9rem; }
  .recap-note { font-size: 1.1rem; }
  .recap-actions button { padding: 16px; font-size: .98rem; }
  .back-btn-nav { max-width: 100%; }
  .sync-badge { font-size: .65rem; padding: 5px 10px; }
}

@media (max-width: 320px) {
  .theme-toggle { width: 42px; height: 42px; }
  .theme-toggle svg { width: 20px; height: 20px; }
  .sync-badge { font-size: .6rem; padding: 4px 8px; max-width: calc(100vw - 60px); }
  .keypad-grid { gap: 8px; }
  .kp-btn { height: 56px; font-size: 1.25rem; }
  .kp-validate { height: calc(56px * 2 + 8px); }
  .login-field input { padding: 16px 16px; font-size: 1rem; }
  .login-btn { padding: 18px; font-size: 1.05rem; }
}

/* ════════════════════════════════════════
   RESPONSIVE — Landscape entry screen
   ════════════════════════════════════════ */
@media (max-height: 500px) and (orientation: landscape) {
  #screen-entry { height: 100vh; }
  .student-card-area { padding: 12px; }
  .student-name { font-size: 1.5rem; }
  .student-firstname { font-size: 1.1rem; margin-bottom: 6px; }
  .keypad-display { font-size: 2rem; padding: 6px 0 8px; min-height: 48px; }
  .kp-btn { height: 52px; font-size: 1.2rem; }
  .kp-validate { height: calc(52px * 2 + 10px); }
  #keypad { padding: 8px 12px 12px; }
  #entry-nav { padding: 0 16px 6px; }
  .nav-btn { width: 52px; height: 40px; }
}

/* ════════════════════════════════════════
   SAFE AREA (notch support)
   ════════════════════════════════════════ */
@supports (padding: env(safe-area-inset-top)) {
  .sync-badge {
    top: calc(20px + env(safe-area-inset-top));
  }
  .theme-toggle {
    top: calc(14px + env(safe-area-inset-top));
  }
  #screen-entry .entry-header {
    padding-top: calc(16px + env(safe-area-inset-top));
  }
  #keypad {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .install-btn {
    bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .ios-install-tip {
    bottom: calc(20px + env(safe-area-inset-bottom));
  }
}

/* ════════════════════════════════════════
   INSTALL PWA BUTTON
   ════════════════════════════════════════ */
.install-btn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--accent-grad);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transition: transform var(--spring), box-shadow var(--transition);
  white-space: nowrap;
  animation: installPulse 2.5s ease-in-out infinite;
}
.install-btn:active {
  transform: translateX(-50%) scale(0.95);
}
.install-btn svg {
  width: 20px;
  height: 20px;
}
@keyframes installPulse {
  0%, 100% { box-shadow: var(--shadow-lg), var(--shadow-glow); }
  50% { box-shadow: var(--shadow-lg), 0 0 32px rgba(79, 70, 229, 0.3); }
}

/* ════════════════════════════════════════
   iOS INSTALL TOOLTIP
   ════════════════════════════════════════ */
.ios-install-tip {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  width: calc(100% - 32px);
  max-width: 420px;
}
.ios-install-tip-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--card);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .85rem;
  color: var(--text);
  line-height: 1.4;
  font-weight: 500;
}
.ios-install-tip-inner svg {
  flex-shrink: 0;
}
.ios-install-tip-inner span {
  flex: 1;
}
.ios-install-tip-inner strong {
  font-weight: 700;
  color: var(--accent);
}
.ios-share-icon {
  display: inline-block;
  vertical-align: middle;
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.ios-tip-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--transition-fast);
}
.ios-tip-close:active {
  background: var(--accent-soft);
}
