:root {
  --ink: #17201d;
  --muted: #66726f;
  --line: #d8ded9;
  --paper: #fffdf8;
  --bg: #f5f2eb;
  --primary: #205244;
  --primary-2: #2e755f;
  --accent: #b54d35;
  --accent-2: #dca13b;
  --good: #256d4f;
  --warn: #9a5c18;
  --bad: #aa3939;
  --shadow: 0 18px 50px rgba(23, 32, 29, 0.12);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(32, 82, 68, 0.08), transparent 34rem),
    var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.shell {
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 1rem;
}

.login-panel {
  width: min(100%, 28rem);
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.auth-panel {
  width: min(100%, 32rem);
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin: 1rem 0;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.auth-tab {
  min-height: 2.75rem;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.auth-tab.active {
  background: var(--paper);
  color: var(--primary);
  box-shadow: 0 2px 10px rgba(23, 32, 29, 0.1);
}

.auth-form {
  margin-top: 0.5rem;
}

.auth-form h2,
.auth-help {
  margin-bottom: 0;
}

.brand-mark {
  width: 5.25rem;
  height: 5.25rem;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 1rem;
}

.image-brand {
  object-fit: contain;
  background: white;
  border: 1px solid var(--line);
  padding: 0.25rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.7rem);
  line-height: 1.05;
  letter-spacing: 0;
  margin-bottom: 0.65rem;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 0.65rem;
}

h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.muted {
  color: var(--muted);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 253, 248, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.school-id {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.school-id strong,
.school-id span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.school-id span {
  font-size: 0.8rem;
  color: var(--muted);
}

.mini-mark {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  flex: 0 0 auto;
}

.image-mark {
  object-fit: contain;
  background: white;
  border: 1px solid var(--line);
  padding: 0.1rem;
}

.content {
  padding: 1rem;
  padding-bottom: 6rem;
  max-width: 72rem;
  margin: 0 auto;
}

.install-offer {
  max-width: 72rem;
  margin: 1rem auto 0;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  background: #eef8f3;
  border: 1px solid #b9d8c8;
  border-radius: 8px;
}

.install-offer span {
  color: var(--muted);
  flex: 1 1 16rem;
}

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(3.4rem, 1fr));
  gap: 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.tab {
  min-height: 4rem;
  padding: 0.45rem 0.25rem;
  background: transparent;
  color: var(--muted);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.15rem;
  cursor: pointer;
}

.tab svg,
.icon-btn svg,
.action svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke-width: 2;
}

.tab.active {
  color: var(--primary);
  box-shadow: inset 0 3px 0 var(--primary);
  font-weight: 700;
}

.tab span {
  font-size: 0.72rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.cards-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cards-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.student-card,
.report-sheet {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  padding: 1rem;
}

.metric {
  display: grid;
  gap: 0.3rem;
}

.metric strong {
  font-size: 1.8rem;
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-size: 0.85rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.toolbar > * {
  flex: 1 1 9rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 0.72rem 0.75rem;
  min-height: 2.75rem;
}

textarea {
  resize: vertical;
  min-height: 5.5rem;
}

.btn,
.icon-btn,
.action {
  min-height: 2.75rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn {
  padding: 0.7rem 0.9rem;
  background: var(--primary);
  color: white;
  font-weight: 800;
}

.btn.secondary {
  background: #e8eee9;
  color: var(--primary);
}

.btn.warn {
  background: #f0dfd7;
  color: var(--accent);
}

.btn:hover,
.icon-btn:hover,
.action:hover {
  transform: translateY(-1px);
}

.icon-btn {
  width: 2.75rem;
  background: #edf2ee;
  color: var(--primary);
  flex: 0 0 auto;
}

.action {
  background: #edf2ee;
  color: var(--primary);
  padding: 0 0.75rem;
}

.form-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full {
  grid-column: 1 / -1;
}

.student-list {
  display: grid;
  gap: 0.7rem;
}

.student-card {
  display: grid;
  gap: 0.65rem;
  padding: 0.9rem;
}

.student-head {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.student-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.student-thumb {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #e8eee9;
}

.student-thumb.blank,
.report-photo.blank {
  display: grid;
  place-items: center;
  color: var(--primary);
  font-weight: 900;
}

.student-head strong {
  font-size: 1rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #edf2ee;
  color: #31433e;
  font-size: 0.76rem;
  font-weight: 700;
}

.pill.good {
  background: #dcf0e6;
  color: var(--good);
}

.pill.warn {
  background: #f8ead1;
  color: var(--warn);
}

.pill.bad {
  background: #f3dede;
  color: var(--bad);
}

.subject-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bar {
  height: 0.65rem;
  border-radius: 99px;
  background: #e4e8e4;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-2), var(--accent-2));
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th,
td {
  padding: 0.65rem 0.45rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: end center;
  background: rgba(12, 18, 16, 0.42);
  padding: 1rem;
}

.modal {
  width: min(100%, 42rem);
  max-height: 92vh;
  overflow: auto;
  background: var(--paper);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.modal-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.report-sheet {
  padding: 1.25rem;
  color: #111;
}

.report-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid #111;
  padding-bottom: 0.8rem;
  margin-bottom: 1rem;
}

.report-school {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.report-logo {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: contain;
  border: 1px solid #bbb;
  padding: 0.25rem;
}

.report-title {
  font-size: 1.25rem;
  font-weight: 900;
}

.report-student-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.report-staff {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem;
  border: 1px solid #bbb;
  margin-bottom: 1rem;
}

.report-staff p {
  margin: 0.2rem 0 0;
}

.report-student-summary h3,
.report-student-summary p {
  margin: 0;
}

.report-photo {
  width: 6rem;
  height: 6rem;
  border: 1px solid #999;
  object-fit: cover;
  background: #eef2ee;
}

.report-photo.staff {
  width: 4.75rem;
  height: 4.75rem;
}

.comparison {
  display: grid;
  gap: 0.7rem;
}

.comparison-row {
  display: grid;
  grid-template-columns: 7rem 1fr 3rem;
  align-items: center;
  gap: 0.6rem;
}

.notice {
  border-left: 4px solid var(--accent-2);
  background: #fff7e7;
  padding: 0.8rem;
  border-radius: 6px;
  color: #563e17;
}

.billing-status {
  border-left: 5px solid var(--accent-2);
}

.billing-status.good {
  border-left-color: var(--good);
  background: #f4fbf7;
}

.billing-status.bad {
  border-left-color: var(--bad);
  background: #fff6f6;
}

.billing-status h2 {
  margin-bottom: 0.35rem;
}

.payment-option {
  display: grid;
  gap: 0.5rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbff;
}

.visa-pay {
  text-decoration: none;
  background: #143a78;
}

.image-picker {
  display: grid;
  gap: 0.7rem;
  padding: 0.8rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.image-preview {
  min-height: 8rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
  display: grid;
  place-items: center;
  color: var(--muted);
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  max-height: 14rem;
  object-fit: contain;
}

.file-action {
  min-height: 2.75rem;
  border-radius: 6px;
  background: var(--primary);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
}

.file-action input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.camera-panel {
  display: grid;
  gap: 0.7rem;
}

.camera-panel[hidden] {
  display: none;
}

.camera-panel video {
  width: 100%;
  max-height: 18rem;
  background: #17201d;
  border-radius: 8px;
  object-fit: cover;
}

@media (min-width: 760px) {
  .shell {
    display: grid;
    grid-template-columns: 14rem 1fr;
  }

  .topbar {
    grid-column: 1 / -1;
  }

  .tabs {
    position: sticky;
    top: 4.05rem;
    left: auto;
    right: auto;
    bottom: auto;
    height: calc(100vh - 4.05rem);
    grid-template-columns: 1fr;
    grid-auto-rows: 4rem;
    align-content: start;
    border-top: 0;
    border-right: 1px solid var(--line);
  }

  .tab {
    justify-items: start;
    padding-left: 1rem;
    grid-template-columns: 1.5rem 1fr;
  }

  .tab.active {
    box-shadow: inset 4px 0 0 var(--primary);
  }

  .tab span {
    font-size: 0.88rem;
  }

  .content {
    padding: 1.25rem;
  }
}

@media (max-width: 680px) {
  .cards-2,
  .cards-3,
  .form-grid,
  .subject-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .hide-mobile {
    display: none;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .tabs,
  .content > :not(.print-area),
  .modal-title,
  .no-print {
    display: none !important;
  }

  .shell,
  .content {
    display: block;
    padding: 0;
    max-width: none;
  }

  .modal-backdrop {
    position: static;
    padding: 0;
    background: transparent;
  }

  .modal {
    box-shadow: none;
    width: 100%;
    max-height: none;
    overflow: visible;
    padding: 0;
  }

  .report-sheet {
    border: 0;
    border-radius: 0;
  }
}
