:root {
  color-scheme: light;
  --ink: #162027;
  --muted: #65727d;
  --line: #d9e0e5;
  --soft: #f4f7f4;
  --panel: #ffffff;
  --green: #1f7a5c;
  --green-dark: #12543e;
  --gold: #c6902e;
  --blue: #386fa4;
  --red: #b64a3a;
  --shadow: 0 18px 50px rgba(22, 32, 39, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(31, 122, 92, 0.09), transparent 34%),
    linear-gradient(315deg, rgba(198, 144, 46, 0.12), transparent 30%),
    #eef3f1;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 22px;
}

.login-card {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.login-brand {
  color: var(--ink);
}

.login-card h1 {
  font-size: 2.2rem;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px 20px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(18, 91, 142, 0.12), rgba(31, 122, 92, 0.06) 38%, transparent),
    #f5f8f7;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 16px;
  border: 1px solid #cbdce7;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(22, 32, 39, 0.08);
}

.brand-logo {
  width: 86px;
  height: 68px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  padding: 6px;
  border: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.brand small {
  color: var(--muted);
  margin-top: 3px;
}

.module-nav {
  display: grid;
  gap: 10px;
}

.current-user {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.current-user span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 750;
}

.current-user strong {
  color: var(--ink);
  line-height: 1.25;
}

.logout-button {
  border-color: rgba(182, 74, 58, 0.32);
  color: var(--red);
}

.logout-button:hover {
  background: rgba(182, 74, 58, 0.08);
}

.danger-button {
  border-color: rgba(182, 74, 58, 0.42);
  color: var(--red);
}

.danger-button:hover {
  background: rgba(182, 74, 58, 0.08);
}

.module-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: #ffffff;
}

.module-tab.active {
  color: #17382e;
  background: #f8c74e;
  border-color: #f8c74e;
}

.module-tab.locked {
  display: none;
}

.module-tab strong {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.main-content {
  padding: 30px;
}

.topbar,
.panel-heading,
.modal-heading,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.18rem;
  letter-spacing: 0;
}

.top-actions,
.session-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.lesson-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.primary-button,
.ghost-button,
.icon-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 750;
}

.primary-button {
  padding: 0 16px;
  color: #ffffff;
  background: var(--green);
}

.primary-button:hover {
  background: var(--green-dark);
}

.ghost-button {
  padding: 0 14px;
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
}

.sidebar .ghost-button {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
}

.full {
  width: 100%;
}

.icon-button {
  width: 38px;
  color: var(--muted);
  background: #f1f4f5;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.schedule-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: 0 10px 30px rgba(22, 32, 39, 0.06);
}

.schedule-strip div {
  min-height: 78px;
  padding: 16px;
  background: #ffffff;
}

.schedule-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.schedule-strip strong {
  display: block;
  margin-top: 7px;
  font-size: 1rem;
}

.summary-grid article {
  min-height: 94px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 30px rgba(22, 32, 39, 0.06);
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.attendance-panel,
.graduates-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.attendance-panel {
  min-width: 0;
  padding: 20px;
}

.graduates-panel {
  padding: 18px;
}

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

.session-controls button {
  width: 40px;
  padding: 0;
  color: var(--green-dark);
  background: #e8f2ed;
  border-color: transparent;
}

.session-controls button.active {
  color: #ffffff;
  background: var(--green);
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 170px;
  gap: 12px;
  margin: 18px 0;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 750;
}

input,
textarea,
select {
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
}

input,
select {
  min-height: 44px;
}

textarea {
  min-height: 180px;
  padding-top: 12px;
  line-height: 1.45;
  resize: vertical;
}

.helper-text {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.student-list,
.graduate-list {
  display: grid;
  gap: 10px;
}

.student-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.student-main {
  min-width: 0;
}

.student-main h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.meta-row,
.attendance-history {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.repeat-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--red);
  font-size: 0.78rem;
  font-weight: 850;
}

.attendance-history {
  margin-top: 10px;
}

.observation-field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.observation-field textarea {
  min-height: 76px;
  padding: 10px 11px;
  font-size: 0.9rem;
}

.observation-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.observation-history {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.observation-history > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.observation-chip {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: #f8faf9;
}

.observation-chip.active {
  border-color: rgba(31, 122, 92, 0.42);
  background: rgba(31, 122, 92, 0.08);
}

.observation-chip strong {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--green);
  font-size: 0.74rem;
}

.observation-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}

.dot {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 999px;
  color: #6c7780;
  background: #edf1f2;
  font-size: 0.78rem;
  font-weight: 850;
}

.dot.presente {
  color: #ffffff;
  background: var(--green);
}

.dot.ausente {
  color: #ffffff;
  background: var(--red);
}

.student-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  gap: 8px;
  width: 210px;
}

.status-button {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  font-size: 0.86rem;
  font-weight: 750;
}

.status-button.presente.active {
  color: #ffffff;
  background: var(--green);
}

.status-button.ausente.active {
  color: #ffffff;
  background: var(--red);
}

.status-button.advance {
  grid-column: 1 / 3;
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

.status-button.complete {
  grid-column: 1 / 3;
  color: #ffffff;
  background: var(--gold);
  border-color: var(--gold);
}

.status-button.danger {
  grid-column: 1 / 3;
  color: var(--red);
  background: #fff7f5;
  border-color: rgba(182, 74, 58, 0.42);
}

.status-button.danger:hover {
  color: #ffffff;
  background: var(--red);
}

.graduate-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.graduate-card h3 {
  margin: 0 0 7px;
  font-size: 0.98rem;
}

.graduate-card .ghost-button {
  width: 100%;
  margin-top: 12px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: 24px;
  border: 1px dashed #b9c6bf;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: var(--soft);
}

dialog {
  width: min(520px, calc(100vw - 26px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.wide-dialog {
  width: min(1120px, calc(100vw - 26px));
}

dialog::backdrop {
  background: rgba(14, 27, 23, 0.48);
}

form {
  display: grid;
  gap: 15px;
  padding: 22px;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.report-summary article {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.report-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.report-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 1.45rem;
}

.report-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-chart {
  display: grid;
  grid-column: 1 / -1;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.chart-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 54px;
  gap: 12px;
  align-items: center;
}

.chart-label {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 750;
}

.chart-track {
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eeeb;
}

.chart-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.chart-value {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: right;
}

.report-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #ffffff;
}

.report-table th,
.report-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.report-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.report-table tr:last-child td {
  border-bottom: 0;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: start;
}

.profile-fields {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

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

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

.photo-panel {
  display: grid;
  gap: 12px;
}

.photo-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  border: 2px solid #213849;
  color: var(--muted);
  background: #fbfcfa;
  font-size: 1.2rem;
  font-weight: 800;
  overflow: hidden;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-button {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.file-button span {
  margin: 0;
  color: var(--ink);
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#profileMembershipPact,
#profileModifications,
#profileFingerprint {
  min-height: 96px;
}

@media (max-width: 1050px) {
  .app-shell,
  .workspace,
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

@media (max-width: 720px) {
  .main-content,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .panel-heading,
  .student-card {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar,
  .panel-heading {
    display: grid;
  }

  .top-actions,
  .top-actions button,
  .student-actions {
    width: 100%;
  }

  .lesson-actions {
    justify-items: stretch;
  }

  .summary-grid,
  .report-summary,
  .chart-row,
  .schedule-strip,
  .filters,
  .module-nav,
  .form-grid.two,
  .form-grid.three {
    grid-template-columns: 1fr;
  }

  .student-card {
    grid-template-columns: 1fr;
  }
}
