/* Built by Adrian Ciorba - firestorm.ro */
:root {
  --navy:   #1B2D5B;
  --gold:   #F3C669;
  --gold-ink: #9A6B12;
  --cream:  #F0E8C8;
  --white:  #FFFFFF;
  --grey:   #F5F5F5;
  --text:   #222222;
  --muted:  #666666;
  --red:    #C0392B;
  --green:  #27AE60;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(27,45,91,0.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.header {
  background: var(--navy);
  color: var(--white);
  padding: 16px;
  text-align: center;
}
.header img { width: 72px; height: 72px; object-fit: contain; margin-bottom: 8px; }
.header h1 { font-size: 1.1rem; font-weight: 700; letter-spacing: .5px; }
.header p  { font-size: .8rem; opacity: .75; margin-top: 2px; }

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-top: 20px;
}
.card h2 { font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: 16px; }

label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--navy); }
input[type=text], input[type=password] {
  width: 100%; padding: 12px 14px;
  border: 2px solid #D0D0D0; border-radius: 8px;
  font-size: 1rem; transition: border-color .2s;
  background: var(--white);
}
input:focus { outline: none; border-color: var(--navy); }
.field { margin-bottom: 16px; }

.btn {
  display: block; width: 100%;
  padding: 14px; border: none; border-radius: 8px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary  { background: var(--gold);  color: var(--navy); }
.btn-navy     { background: var(--navy);  color: var(--white); }
.btn-danger   { background: var(--red);   color: var(--white); }
.btn-sm {
  display: inline-block; width: auto;
  padding: 8px 16px; font-size: .85rem;
}
.btn:disabled { opacity: .5; cursor: default; }

.alert {
  border-radius: 8px; padding: 12px 16px;
  font-size: .9rem; margin-bottom: 16px;
}
/* A hairline all the way round, like every card. A 4px bar down one side
   fights the 8px corner radius above - a rounded box with one square-ended
   stripe never looks deliberate. The rim takes the text colour, so the warning
   uses its own brown rather than the pale gold, which vanished at 1px. */
.alert-error   { background: #FDECEA; color: var(--red);   border: 1px solid var(--red); }
.alert-success { background: #E9F7EF; color: var(--green); border: 1px solid var(--green); }
.alert-info    { background: #EBF0FA; color: var(--navy);  border: 1px solid var(--navy); }
.alert-warn    { background: #FEF9E7; color: #8B6914;      border: 1px solid #8B6914; }

.child-card {
  border: 2px solid #E0E0E0;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  user-select: none;
}
.child-card.selected {
  border-color: var(--gold);
  background: #FFFBF0;
}
.child-card .child-name  { font-weight: 700; font-size: 1rem; color: var(--navy); }
.child-card .child-class { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.child-card .child-diet  { font-size: .78rem; color: var(--red); margin-top: 4px; font-weight: 600; }
.child-card .check-icon  { float: right; font-size: 1.4rem; color: var(--gold-ink); display: none; }
.child-card.selected .check-icon { display: inline; }
.child-card .child-status {
  display: none; margin-top: 8px;
  font-size: .8rem; font-weight: 700; color: var(--gold-ink);
  background: #FFF3D6; border-radius: 6px; padding: 4px 10px;
}
.child-card.selected .child-status { display: inline-block; }
.child-card input[type=checkbox] { display: none; }

.form-locked .child-card,
.form-locked .cal-day { cursor: default; }
.form-locked .cal-day.selectable:hover { background: transparent; }

.calendar-wrap { margin-top: 20px; }
.calendar-wrap h3 { font-size: .9rem; font-weight: 700; color: var(--navy); margin-bottom: 10px; }
.cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.cal-nav button {
  background: none; border: none; cursor: pointer;
  font-size: 1.3rem; color: var(--navy); padding: 4px 10px;
}
.cal-nav span { font-weight: 700; font-size: .95rem; color: var(--navy); }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px; text-align: center;
}
.cal-grid .day-header { font-size: .72rem; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: .85rem; cursor: pointer;
  border: 2px solid transparent; transition: all .15s;
}
.cal-day.today         { border-color: var(--navy); font-weight: 700; }
.cal-day.selectable:hover { background: #FEF3D0; }
.cal-day.selected      { background: var(--gold); color: var(--navy); font-weight: 700; border-color: var(--gold); }
.cal-day.past          { color: #CCC; cursor: default; }
/* An absence on a day whose cutoff has passed. It is no longer editable, but it
   still stands, so it must not fade into the greyed-out past. Two classes beat
   the single-class rules above whatever their order. */
.cal-day.selected.past { background: #F6E3B0; color: #8B6914; border-color: #E4CE8E;
                         font-weight: 700; cursor: default; }
.cal-day.weekend       { color: var(--muted); }
.cal-day.holiday       { color: #B0B0B0; background: #ECECEC; cursor: default; text-decoration: line-through; }
.cal-day.empty         { cursor: default; }
.cal-day.already-absent { background: #FDECEA; color: var(--red); border-color: var(--red); }

.selected-dates { margin-top: 12px; }
.date-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--navy); color: var(--white);
  border-radius: 20px; padding: 4px 12px;
  font-size: .8rem; margin: 4px 4px 4px 0;
}
.date-tag button {
  background: none; border: none; color: var(--white);
  cursor: pointer; font-size: 1rem; line-height: 1; padding: 0;
}

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 700;
}
.badge-green { background: #E9F7EF; color: var(--green); }
.badge-red   { background: #FDECEA; color: var(--red); }
.badge-gold  { background: #FEF9E7; color: #8B6914; }

hr { border: none; border-top: 1px solid #EEE; margin: 20px 0; }

.topbar {
  background: var(--navy); color: var(--white);
  padding: 10px 16px; display: flex; justify-content: space-between; align-items: center;
}
.topbar span { font-size: .85rem; }
.topbar a { color: var(--gold); font-size: .85rem; text-decoration: none; font-weight: 600; }

.locked-banner {
  background: var(--navy); color: var(--white);
  border-radius: var(--radius); padding: 24px; text-align: center; margin-top: 20px;
}
.locked-banner .lock-icon { font-size: 2.5rem; margin-bottom: 12px; }
.locked-banner h2 { font-size: 1.1rem; margin-bottom: 8px; }
.locked-banner p  { font-size: .85rem; opacity: .8; }

.install-banner {
  background: var(--gold); color: var(--navy);
  border-radius: var(--radius); padding: 14px 16px;
  margin-top: 16px; display: flex; align-items: center; gap: 12px;
}
.install-banner p    { font-size: .85rem; font-weight: 600; flex: 1; }
.install-banner button { white-space: nowrap; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th { background: var(--navy); color: var(--white); padding: 10px 12px; text-align: left; }
td { padding: 10px 12px; border-bottom: 1px solid #EEE; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--grey); }

.admin-wrap { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--navy); color: var(--white);
  padding: 24px 0; flex-shrink: 0;
}
.sidebar .logo { padding: 0 20px 24px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar .logo img  { width: 48px; }
.sidebar .logo span { display: block; font-size: .8rem; opacity: .7; margin-top: 6px; }
.sidebar .logo .school-name {
  display: block; font-size: .95rem; font-weight: 700;
  color: var(--white); margin-bottom: 12px; line-height: 1.25;
}

.mobile-topbar { display: none; }
.sidebar nav a {
  display: block; padding: 12px 20px;
  color: rgba(255,255,255,.75); text-decoration: none;
  font-size: .9rem; transition: background .15s, color .15s;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: rgba(255,255,255,.1); color: var(--white);
}
.sidebar nav a .icon { margin-right: 8px; }
.main-content { flex: 1; padding: 28px; background: var(--grey); }
.main-content h1 { font-size: 1.3rem; color: var(--navy); margin-bottom: 20px; }

@media (max-width: 600px) {
  .admin-wrap { flex-direction: column; }
  .mobile-topbar {
    display: flex; align-items: center; gap: 12px;
    background: var(--navy); color: var(--white);
    padding: 10px 16px; position: sticky; top: 0; z-index: 50;
  }
  .mobile-topbar img { width: 34px; height: 34px; object-fit: contain; }
  .mobile-topbar .mt-title { flex: 1; font-weight: 700; font-size: .95rem; }
  .mobile-topbar button {
    background: none; border: none; color: var(--white);
    font-size: 1.7rem; line-height: 1; cursor: pointer; padding: 0 4px;
  }
  .sidebar { width: 100%; display: none; padding: 12px 0; }
  .sidebar.open {
    display: block;
    position: fixed; top: 54px; left: 0; right: 0;
    max-height: calc(100vh - 54px); overflow-y: auto;
    z-index: 49; box-shadow: 0 10px 24px rgba(0,0,0,.28);
  }
  .sidebar .logo { display: none; }
  .main-content { padding: 16px; }
}

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 16px; text-align: center; box-shadow: var(--shadow);
}
.stat-card .num  { font-size: 2rem; font-weight: 800; color: var(--navy); }
.stat-card .lbl  { font-size: .75rem; color: var(--muted); margin-top: 4px; }

.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); font-size: .85rem; }
.text-red    { color: var(--red); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
