/* ============================================================
   ALECHKA SCHOOL HUB — HPC Bilinguales Gymnasium Heidelberg
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  overflow-x: hidden;
}

body {
  height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

:root {
  /* Brand colours */
  --primary:       #4338CA;
  --primary-light: #6366F1;
  --primary-dark:  #312E81;
  --accent:        #D97706;
  --accent-light:  #F59E0B;
  --accent-glow:   rgba(217,119,6,.18);

  /* Surfaces */
  --bg:       #EEF2FF;
  --surface:  #FFFFFF;
  --surface2: #F8FAFC;
  --border:   rgba(67,56,202,.10);

  /* Text */
  --text:     #0F172A;
  --text-2:   #334155;
  --text-3:   #64748B;
  --text-4:   #94A3B8;

  /* Status */
  --red:    #DC2626;
  --orange: #EA580C;
  --yellow: #CA8A04;
  --green:  #16A34A;
  --blue:   #2563EB;
  --violet: #7C3AED;

  /* Subject palette */
  --s-deutsch:    #2563EB;
  --s-englisch:   #059669;
  --s-mathe:      #D97706;
  --s-bio:        #65A30D;
  --s-spanisch:   #DB2777;
  --s-italiano:   #DC2626;
  --s-ethik:      #7C3AED;
  --s-geschichte: #EA580C;
  --s-sport:      #0891B2;
  --s-physik:     #1D4ED8;
  --s-musik:      #BE185D;
  --s-chemie:     #0D9488;
  --s-default:    #475569;

  /* Layout */
  --nav-h:    64px;
  --hdr-h:    56px;

  /* Radii */
  --r-xl:  20px;
  --r-lg:  16px;
  --r-md:  12px;
  --r-sm:   8px;
  --r-xs:   5px;

  /* Shadows */
  --sh-sm:  0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --sh:     0 4px 12px rgba(67,56,202,.12), 0 2px 4px rgba(0,0,0,.06);
  --sh-md:  0 10px 25px rgba(67,56,202,.14), 0 4px 10px rgba(0,0,0,.08);
  --sh-lg:  0 20px 40px rgba(67,56,202,.18), 0 8px 16px rgba(0,0,0,.10);
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
#login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background-image: url('school-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.login-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(49,46,129,.88) 0%,
    rgba(67,56,202,.82) 40%,
    rgba(30,27,90,.92) 100%
  );
}

.login-card {
  position: relative;
  z-index: 1;
  /* no panel — the content sits straight on the shared background */
  background: none;
  border: none;
  box-shadow: none;
  padding: 36px 28px 32px;
  width: min(340px, calc(100vw - 32px));
  text-align: center;
  /* a soft shadow keeps white text legible over a bright photo */
  text-shadow: 0 1px 12px rgba(0,0,0,.45);
}

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.login-name {
  font-size: 30px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.1;
  margin-bottom: 4px;
  letter-spacing: -.5px;
}

.login-school {
  font-size: 13px;
  color: rgba(255,255,255,.65);
  margin-bottom: 28px;
  line-height: 1.4;
}

.pin-dots {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 28px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45);
  background: transparent;
  transition: all .2s ease;
}

.pin-dot.filled {
  background: #FFFFFF;
  border-color: #FFFFFF;
  box-shadow: 0 0 12px rgba(255,255,255,.5);
  transform: scale(1.1);
}

.pin-dot.error {
  background: var(--red);
  border-color: var(--red);
  animation: shake .4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pin-btn {
  height: 58px;
  border: 1px solid rgba(255,255,255,.20);
  border-radius: var(--r-md);
  background: rgba(255,255,255,.12);
  color: #FFFFFF;
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  user-select: none;
}

.pin-btn .sub {
  font-size: 8px;
  letter-spacing: 1px;
  opacity: .5;
  font-weight: 500;
  margin-top: 2px;
  text-transform: uppercase;
}

.pin-btn:active {
  background: rgba(255,255,255,.25);
  transform: scale(.94);
}

.pin-btn.del {
  font-size: 18px;
}

.pin-btn.empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
  pointer-events: none;
}

.login-footer {
  margin-top: 20px;
  font-size: 11px;
  color: rgba(255,255,255,.35);
}

/* ============================================================
   MAIN APP LAYOUT
   ============================================================ */
#app {
  display: none;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
}

#app.visible {
  display: flex;
}

/* Header */
.app-header {
  flex-shrink: 0;
  height: var(--hdr-h);
  background: var(--primary-dark);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  position: relative;
  z-index: 10;
}

.header-icon {
  font-size: 22px;
  line-height: 1;
}

.header-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -.3px;
}

.header-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,.55);
  font-weight: 400;
}

.header-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.85);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.icon-btn:active { background: rgba(255,255,255,.22); }

/* Content */
.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding-bottom: calc(var(--nav-h) + 16px);
}

/* Bottom navigation */
.app-nav {
  flex-shrink: 0;
  height: var(--nav-h);
  background: #FFFFFF;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  box-shadow: 0 -4px 16px rgba(0,0,0,.08);
  position: relative;
  z-index: 10;
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 8px 4px;
  position: relative;
  transition: all .15s ease;
  color: var(--text-3);
}

.nav-tab .nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform .2s ease;
}

.nav-tab .nav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .2px;
  white-space: nowrap;
}

.nav-tab.active {
  color: var(--primary);
}

.nav-tab.active .nav-icon {
  transform: translateY(-2px);
}

.nav-tab.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}

/* Badge on nav */
.nav-badge {
  position: absolute;
  top: 8px;
  right: calc(50% - 20px);
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--red);
  color: #fff;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ============================================================
   HERO CARD
   ============================================================ */
.hero-card {
  margin: 16px 16px 0;
  border-radius: var(--r-xl);
  overflow: hidden;
  position: relative;
  box-shadow: var(--sh-md);
  min-height: 160px;
}

.hero-photo {
  position: absolute;
  inset: 0;
  background-image: url('school-bg2.jpg');
  background-size: cover;
  background-position: center 30%;
}

.hero-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(49,46,129,.80) 0%,
    rgba(67,56,202,.65) 50%,
    rgba(30,27,90,.85) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.hero-name {
  font-size: 22px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -.4px;
  line-height: 1.1;
}

.hero-class {
  font-size: 12px;
  color: rgba(255,255,255,.70);
  margin-top: 2px;
  font-weight: 500;
}

.hero-date-pill {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 100px;
  padding: 5px 12px;
  font-size: 12px;
  color: rgba(255,255,255,.90);
  font-weight: 600;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.hero-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-stat {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  backdrop-filter: blur(8px);
}

.hero-stat-val {
  font-size: 16px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1;
}

.hero-stat-lbl {
  font-size: 9px;
  color: rgba(255,255,255,.60);
  font-weight: 500;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-top: 1px;
}

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section {
  padding: 20px 16px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .8px;
}

.section-link {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.card + .card { margin-top: 8px; }

.card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.card-row + .card-row {
  border-top: 1px solid var(--border);
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.card-body { flex: 1; min-width: 0; }

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.card-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
  line-height: 1.3;
}

.card-right {
  flex-shrink: 0;
  text-align: right;
}

/* ============================================================
   KLASSENARBEITEN CARDS
   ============================================================ */
.ka-list { display: flex; flex-direction: column; gap: 8px; }

.ka-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  display: flex;
}

.ka-stripe {
  width: 5px;
  flex-shrink: 0;
}

.ka-body {
  flex: 1;
  padding: 14px 14px 14px 12px;
  min-width: 0;
}

.ka-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.ka-subject-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 100px;
  color: #fff;
}

.ka-countdown {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 100px;
  letter-spacing: .2px;
  white-space: nowrap;
}

.ka-countdown.urgent  { background: #FEE2E2; color: var(--red); }
.ka-countdown.soon    { background: #FEF3C7; color: var(--yellow); }
.ka-countdown.ok      { background: #D1FAE5; color: var(--green); }
.ka-countdown.past    { background: var(--surface2); color: var(--text-4); }

.ka-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.ka-details {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.ka-detail {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-3);
}

.ka-source {
  margin-top: 8px;
  font-size: 10px;
  color: var(--text-4);
  font-style: italic;
}

/* ============================================================
   CALENDAR
   ============================================================ */
.calendar-wrap {
  margin: 16px 16px 0;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.cal-header {
  display: flex;
  align-items: center;
  padding: 16px 16px 12px;
  gap: 8px;
}

.cal-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-2);
  transition: all .15s;
  flex-shrink: 0;
}

.cal-nav-btn:active { background: var(--primary); color: #fff; border-color: var(--primary); }

.cal-month-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.cal-grid {
  padding: 0 10px 12px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.cal-wd {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 6px 0;
}

.cal-wd.weekend { color: var(--red); }

.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .12s;
  position: relative;
  min-width: 0;
}

.cal-day:hover  { background: rgba(67,56,202,.06); }
.cal-day:active { background: rgba(67,56,202,.14); }

.cal-day-num {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  line-height: 1;
}

.cal-day.other-month .cal-day-num { color: var(--text-4); }
.cal-day.weekend .cal-day-num { color: #EF4444; }
.cal-day.today .cal-day-num {
  background: var(--primary);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.cal-day-dots {
  display: flex;
  gap: 2px;
  margin-top: 3px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-events-list {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.cal-events-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 12px 0 8px;
}

.cal-event-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.cal-event-item:last-child { border-bottom: none; }

.cal-event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.cal-event-info { flex: 1; min-width: 0; }

.cal-event-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.cal-event-date {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
}

/* ============================================================
   TEACHERS
   ============================================================ */
.teachers-grid {
  padding: 16px 16px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.teacher-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}

.teacher-card:active {
  transform: scale(.97);
  box-shadow: var(--sh);
}

.teacher-card.principal {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.teacher-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.3);
  flex-shrink: 0;
}

.teacher-avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  margin: 0 auto 6px;
}

.teacher-card.principal .teacher-avatar-placeholder {
  width: 52px;
  height: 52px;
  font-size: 20px;
  margin: 0;
  background: rgba(255,255,255,.2);
}

.teacher-info { flex: 1; min-width: 0; }

.teacher-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.teacher-card.principal .teacher-name {
  color: #FFFFFF;
  font-size: 15px;
}

.teacher-role {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 2px;
  font-weight: 500;
}

.teacher-card.principal .teacher-role {
  color: rgba(255,255,255,.65);
}

.teacher-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 6px;
}

.subj-chip {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 100px;
  color: #fff;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.teacher-source {
  font-size: 9px;
  color: var(--text-4);
  font-style: italic;
  margin-top: 4px;
}

.teacher-card.principal .teacher-source {
  color: rgba(255,255,255,.45);
}

/* Teacher modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  animation: fadeIn .2s ease;
}

.modal-overlay.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } }

.modal-sheet {
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) var(--r-lg) var(--r-lg);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
  animation: slideUp .3s ease;
  max-height: 80vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: -8px auto 16px;
}

/* ============================================================
   EVENING PLAN
   ============================================================ */
.evening-card {
  margin: 16px 16px 0;
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #3730A3 100%);
  border-radius: var(--r-xl);
  padding: 20px;
  box-shadow: var(--sh-md);
}

.evening-title {
  font-size: 16px;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 4px;
}

.evening-sub {
  font-size: 12px;
  color: rgba(255,255,255,.55);
  margin-bottom: 16px;
}

.evening-section {
  margin-bottom: 14px;
}

.evening-section-title {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.50);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 6px;
}

.evening-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 6px;
}

.evening-bullet {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-light);
  margin-top: 5px;
  flex-shrink: 0;
}

.evening-text {
  font-size: 13px;
  color: rgba(255,255,255,.85);
  line-height: 1.4;
}

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
  padding: 32px 20px;
  text-align: center;
}

.empty-icon { font-size: 40px; margin-bottom: 10px; }

.empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
}

.empty-text {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
  max-width: 260px;
  margin: 0 auto;
}

/* ============================================================
   TODAY TAB
   ============================================================ */
.today-header {
  margin: 16px 16px 0;
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--sh-sm);
  display: flex;
  gap: 12px;
  align-items: center;
}

.today-day {
  font-size: 36px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  letter-spacing: -2px;
}

.today-info { flex: 1; }

.today-weekday {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.today-month {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 1px;
}

.today-kw {
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: .5px;
}

/* Homework item */
.hw-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.hw-item:last-child { border-bottom: none; }

.hw-subject-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 3px;
  flex-shrink: 0;
}

.hw-body { flex: 1; }

.hw-subject {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 2px;
}

.hw-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.4;
}

.hw-due {
  font-size: 10px;
  color: var(--text-4);
  margin-top: 2px;
}

/* ============================================================
   MATERIALS
   ============================================================ */
.material-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.material-item:last-child { border-bottom: none; }

.material-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: #FEE2E2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.material-info { flex: 1; min-width: 0; }

.material-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.material-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
}

.material-source {
  font-size: 9px;
  color: var(--text-4);
  font-style: italic;
}

/* ============================================================
   SCHOOL INFO
   ============================================================ */
.info-card {
  margin: 16px 16px 0;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.info-photo {
  width: 100%;
  height: 140px;
  object-fit: cover;
  object-position: center 40%;
  display: block;
}

.info-body { padding: 16px; }

.info-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.info-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
}

.info-row-icon { font-size: 16px; width: 24px; text-align: center; }

/* ============================================================
   FILTER CHIPS
   ============================================================ */
.filter-chips {
  display: flex;
  gap: 6px;
  padding: 12px 16px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ============================================================
   TAB TRANSITIONS
   ============================================================ */
.tab-content {
  animation: tabIn .25s ease;
  padding-bottom: 24px;
}

@keyframes tabIn {
  from { opacity: 0; transform: translateY(8px); }
}

/* ============================================================
   UTILS
   ============================================================ */
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.px-16 { padding-left: 16px; padding-right: 16px; }

.no-data {
  font-size: 12px;
  color: var(--text-4);
  font-style: italic;
  padding: 12px 16px;
  line-height: 1.5;
}

.source-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  color: var(--text-4);
  font-weight: 500;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  margin-top: 4px;
}

/* ============================================================
   RESPONSIVE — desktop preview
   ============================================================ */
@media (min-width: 480px) {
  #login-screen { padding: 20px; }
  #app { box-shadow: 0 0 0 1px var(--border), var(--sh-lg); border-radius: var(--r-xl); margin: 20px auto; height: calc(100dvh - 40px); }
  .teachers-grid { grid-template-columns: 1fr 1fr 1fr; }
  .teachers-grid .teacher-card.principal { grid-column: 1 / -1; }
}

/* Кликабельные блоки в шапке */
.hero-stat[role="button"] {
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.hero-stat[role="button"]:active {
  transform: scale(.96);
  background: rgba(255,255,255,.28);
}
.hero-stat[role="button"]::after {
  content: '›';
  position: absolute;
  top: 5px; right: 8px;
  font-size: 13px;
  color: rgba(255,255,255,.55);
  line-height: 1;
}
.hero-stat { position: relative; }

/* ============================================================
   СЕЗОННЫЕ ФОНЫ ПО МЕСЯЦАМ
   Фотография + тёмный градиент поверх — иначе белый текст
   тонет на светлых снимках (снег, цветение).
   ============================================================ */
.today-header.has-bg,
.cal-header.has-bg {
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.today-header.has-bg .today-day,
.today-header.has-bg .today-weekday {
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.45);
}
.today-header.has-bg .today-month {
  color: rgba(255,255,255,.85);
  text-shadow: 0 1px 5px rgba(0,0,0,.45);
}
.today-header.has-bg .today-kw {
  background: rgba(255,255,255,.22);
  color: #fff;
  backdrop-filter: blur(4px);
}

.cal-header.has-bg .cal-month-title {
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.45);
}
.cal-header.has-bg .cal-nav-btn {
  background: rgba(255,255,255,.2);
  color: #fff;
  border-color: rgba(255,255,255,.3);
  backdrop-filter: blur(4px);
}

/* Подпись автора — обязательна для CC BY, но не должна мешать */
.bg-credit {
  position: absolute;
  right: 6px;
  bottom: 3px;
  line-height: 1;
  z-index: 2;
}
/* Подпись не должна перехватывать жест — шапка листается свайпом */
.bg-credit, .bg-credit * { pointer-events: none; }

/* ============================================================
   ШАПКА ДНЯ — СВАЙП
   Блок с датой листается вбок. Стрелки по краям подсказывают,
   что его можно тянуть, и не мешают читать дату.
   ============================================================ */
.today-header {
  position: relative;
  touch-action: pan-y;          /* боковые жесты наши, вертикальная прокрутка страницы */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.today-header::before,
.today-header::after {
  content: '\2039';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  line-height: 1;
  color: var(--text-4);
  opacity: .35;
  pointer-events: none;
}
.today-header::before { left: 5px; }
.today-header::after  { content: '\203A'; right: 5px; }

.today-header.has-bg::before,
.today-header.has-bg::after { color: #fff; opacity: .5; }

/* Тёмный фон — стрелки светлые, дата и так сдвинута от краёв */
.today-header .today-day  { margin-left: 10px; }
.today-header .today-kw   { margin-right: 10px; }

/* ============================================================
   АНИМАЦИЯ ЛИСТАНИЯ
   Уходящее не просто съезжает, а рассыпается: размывается,
   слегка уменьшается и тает. Приходящее собирается обратно.
   Длительность короткая — жест должен оставаться отзывчивым.
   ============================================================ */
@keyframes dustOutLeft {
  0%   { opacity: 1; transform: translateX(0) scale(1);          filter: blur(0); }
  100% { opacity: 0; transform: translateX(-34px) scale(.955);   filter: blur(7px); }
}
@keyframes dustOutRight {
  0%   { opacity: 1; transform: translateX(0) scale(1);          filter: blur(0); }
  100% { opacity: 0; transform: translateX(34px) scale(.955);    filter: blur(7px); }
}
@keyframes dustInLeft {
  0%   { opacity: 0; transform: translateX(34px) scale(.97);     filter: blur(7px); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateX(0) scale(1);          filter: blur(0); }
}
@keyframes dustInRight {
  0%   { opacity: 0; transform: translateX(-34px) scale(.97);    filter: blur(7px); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateX(0) scale(1);          filter: blur(0); }
}

.dust-out-left  { animation: dustOutLeft  .19s cubic-bezier(.4,0,1,1) forwards; }
.dust-out-right { animation: dustOutRight .19s cubic-bezier(.4,0,1,1) forwards; }
.dust-in-left   { animation: dustInLeft   .28s cubic-bezier(0,.6,.3,1) both; }
.dust-in-right  { animation: dustInRight  .28s cubic-bezier(0,.6,.3,1) both; }

/* Календарь тоже листается пальцем */
.calendar-wrap {
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

/* Кому анимация мешает — системная настройка уважается */
@media (prefers-reduced-motion: reduce) {
  .dust-out-left, .dust-out-right, .dust-in-left, .dust-in-right {
    animation-duration: .01ms !important;
  }
}

.back-today {
  /* Абсолютно, чтобы появление кнопки не раздвигало шапку
     и не сдвигало карточку под ней */
  position: absolute;
  right: 10px;
  bottom: 6px;
  z-index: 3;
  background: rgba(255,255,255,.22);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 3px 10px;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

/* Когда в шапке есть кнопка «назад на сегодня», подпись к фото
   уходит влево, чтобы они не наезжали друг на друга */
.today-header:has(.back-today) .bg-credit { right: 86px; }

/* Шесть кнопок вместо пяти: сжимаем подписи и поля,
   иначе на узких экранах текст переносится и ломает ряд */
.nav-tab { padding: 8px 2px; min-width: 0; }
.nav-tab .nav-label {
  font-size: 9px;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.nav-tab .nav-icon { font-size: 19px; }

/* ============================================================
   ЭКРАН ВХОДА: ОТПЕЧАТОК ГЛАВНЫЙ
   Крупная круглая кнопка по центру, клавиатура PIN — запасной
   путь, спрятана до нажатия.
   ============================================================ */
.bio-big {
  position: relative;
  width: 132px; height: 132px;
  margin: 30px auto 0;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.16);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease, background .15s ease;
}
.bio-big:active { transform: scale(.94); background: rgba(255,255,255,.26); }
.bio-icon { font-size: 58px; line-height: 1; }

/* Пульсирующее кольцо — подсказывает, что сюда надо нажать */
.bio-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45);
  animation: bioPulse 2.1s ease-out infinite;
}
@keyframes bioPulse {
  0%   { transform: scale(1);    opacity: .7; }
  70%  { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1.18); opacity: 0; }
}
.bio-big.busy .bio-ring { animation-duration: .8s; }
.bio-big.busy { background: rgba(255,255,255,.3); }

.bio-hint {
  font-size: 13.5px;
  color: rgba(255,255,255,.75);
  margin-top: 10px;
  text-align: center;
}

/* Клавиатура PIN раскрывается плавно, а не появляется рывком */
#pin-area {
  overflow: hidden;
  max-height: 420px;
  opacity: 1;
  transition: max-height .3s ease, opacity .22s ease, margin .3s ease;
}
#pin-area.collapsed {
  max-height: 0;
  opacity: 0;
  margin: 0;
}

.pin-toggle {
  margin-top: 14px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 14px;
  -webkit-tap-highlight-color: transparent;
}
.pin-toggle:active { color: #fff; }

.login-err {
  font-size: 12px;
  color: #FCA5A5;
  text-align: center;
  min-height: 17px;
  margin-top: 8px;
}
