:root {
  --bg: #090909;
  --surface: #151515;
  --surface-2: #202020;
  --line: rgba(212, 175, 55, 0.24);
  --gold: #d4af37;
  --gold-soft: rgba(212, 175, 55, 0.14);
  --text: #f8f8f8;
  --muted: #a7a7a7;
  --ok: #52c27d;
  --danger: #ff6b6b;
  --info: #66b7d9;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Poppins", sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  background:
    linear-gradient(135deg, rgba(212, 175, 55, 0.08), transparent 34%),
    linear-gradient(180deg, #111 0%, #070707 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--gold);
  color: #161616;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #101010;
  color: var(--text);
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.login-view {
  min-height: 100vh;
  display: none;
  place-items: center;
  padding: 20px;
}

.login-view.active {
  display: grid;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 18, 18, 0.96);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
}

.login-logo {
  width: min(240px, 68vw);
  max-height: 130px;
  height: auto;
  object-fit: contain;
  justify-self: center;
}

.login-panel h1,
.app-main h2,
.panel h3 {
  margin: 0;
}

.student-app {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px clamp(14px, 4vw, 30px);
  border-bottom: 1px solid var(--line);
  background: rgba(12, 12, 12, 0.94);
  backdrop-filter: blur(10px);
}

.app-header .secondary-btn {
  flex: 0 0 auto;
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-line img {
  width: 168px;
  height: 60px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-line span,
.muted,
.status {
  color: var(--muted);
}

.status.danger {
  color: var(--danger);
}

.status.ok {
  color: var(--ok);
}

.brand-line strong {
  display: block;
  overflow-wrap: anywhere;
}

.ghost-btn,
.secondary-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.app-tabs {
  position: sticky;
  top: 79px;
  z-index: 9;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 10px clamp(14px, 4vw, 30px);
  background: rgba(9, 9, 9, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tab-btn {
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--muted);
}

.tab-btn.active {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--text);
}

.app-main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 4vw, 30px) 40px;
}

.app-view {
  display: none;
}

.app-view.active {
  display: grid;
  gap: 16px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.contract-panel,
.biometric-panel {
  display: grid;
  gap: 12px;
}

.contract-status-row,
.biometric-status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: start;
}

.contract-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.contract-actions a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.contract-accept-panel[hidden] {
  display: none;
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}

.consent-check input {
  width: 20px;
  min-height: 20px;
  margin-top: 2px;
  accent-color: var(--gold);
  flex: 0 0 auto;
}

.consent-check.compact {
  font-size: 0.9rem;
}

.legal-documents {
  display: grid;
  gap: 12px;
}

.legal-document-card,
.anamnesis-panel {
  display: grid;
  gap: 12px;
}

.legal-document-card.accepted {
  border-color: rgba(54, 211, 153, 0.35);
}

.legal-document-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: start;
}

.legal-document-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.anamnesis-panel fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.anamnesis-panel legend {
  padding: 0 6px;
  color: var(--text);
  font-weight: 700;
}

.anamnesis-grid,
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.anamnesis-panel label,
.option-check {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.option-check {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  color: var(--text);
}

.option-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

.anamnesis-panel input,
.anamnesis-panel select,
.anamnesis-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

.anamnesis-panel textarea {
  min-height: 82px;
  resize: vertical;
}

.biometric-preview {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.biometric-preview img,
.biometric-preview .placeholder {
  width: 96px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.biometric-preview .placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  border-style: dashed;
}

.panel,
.workout-shell,
.student-card,
.profile-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(22, 22, 22, 0.96);
}

.panel,
.student-card,
.profile-card {
  padding: 14px;
}

.workout-shell {
  padding: 16px;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.card-list,
.timeline-list,
.compact-list {
  display: grid;
  gap: 10px;
}

.agenda-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.agenda-summary div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 8px;
  background: rgba(212, 175, 55, 0.08);
}

.agenda-summary span {
  color: var(--muted);
  font-size: 0.8rem;
}

.agenda-summary strong {
  font-size: 1.35rem;
}

.agenda-booking-card {
  display: grid;
  gap: 12px;
}

.student-card header,
.invoice-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.badge.ok {
  color: #07140d;
  background: var(--ok);
}

.badge.danger {
  color: #180808;
  background: var(--danger);
}

.badge.info {
  color: #061019;
  background: var(--info);
}

.exercise-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.workout-progress {
  display: grid;
  grid-template-columns: minmax(170px, max-content) 1fr max-content;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 8px;
  background: rgba(212, 175, 55, 0.08);
}

.workout-progress span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.workout-progress strong {
  display: block;
  overflow-wrap: anywhere;
}

.workout-progress button {
  min-height: 36px;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  transition: width 180ms ease;
}

.progress-bar.small {
  height: 7px;
}

.workout-session-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, 170px);
  gap: 12px;
  align-items: center;
}

.workout-session-btn {
  width: 100%;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(22, 22, 22, 0.96);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.workout-session-btn:hover,
.workout-session-btn.selected {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
}

.workout-session-btn.selected {
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.24);
}

.workout-session-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.workout-session-card.compact {
  grid-template-columns: minmax(0, 1fr) minmax(90px, 130px);
}

.workout-session-card .muted {
  display: block;
}

.session-progress {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px;
  align-items: center;
}

.exercise-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  transition: border-color 180ms ease, background 180ms ease, opacity 180ms ease;
}

.exercise-row.done {
  border-color: rgba(82, 194, 125, 0.38);
  background: rgba(82, 194, 125, 0.08);
}

.exercise-row.done .exercise-info {
  opacity: 0.68;
}

.exercise-row.done .exercise-info strong {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.exercise-info {
  min-width: 0;
}

.exercise-thumb {
  width: 72px;
  min-height: 72px;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0d0d;
  overflow: hidden;
  cursor: zoom-in;
}

.exercise-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.empty-thumb {
  width: 72px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.exercise-check {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.exercise-check input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--gold);
}

.exercise-check span {
  white-space: nowrap;
}

.action-row,
.payment-form,
.upload-panel {
  display: grid;
  gap: 10px;
}

.action-row {
  grid-template-columns: repeat(auto-fit, minmax(130px, max-content));
  margin-top: 12px;
}

.payment-form {
  margin-top: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.payment-form textarea,
.payment-form button,
.payment-form label:last-of-type,
.pix-payment-note {
  grid-column: 1 / -1;
}

.pix-payment-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 8px;
  background: rgba(212, 175, 55, 0.08);
}

.pix-payment-note span {
  color: var(--muted);
  font-size: 0.84rem;
}

.file-picker {
  display: grid;
  gap: 8px;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.file-picker span,
.file-picker em {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border-radius: 8px;
}

.file-picker span {
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.file-picker em {
  color: var(--muted);
  font-style: normal;
  overflow-wrap: anywhere;
}

.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(0, 0, 0, 0.92);
}

.camera-modal[hidden] {
  display: none;
}

.camera-modal-panel {
  width: min(520px, 100%);
  max-height: min(100dvh, 760px);
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 10px;
  padding: 12px;
  background: #080808;
}

.camera-modal-panel header,
.camera-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.camera-modal-panel h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.05rem;
}

.camera-stage {
  position: relative;
  height: clamp(330px, 62dvh, 500px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
  --camera-guide-width: min(70%, 310px);
  --camera-guide-height: min(76%, 440px);
}

.camera-stage video,
.camera-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.camera-stage video[hidden],
.camera-stage canvas[hidden] {
  display: none;
}

.camera-face-guide {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: var(--camera-guide-width);
  height: var(--camera-guide-height);
  transform: translate(-50%, -50%);
  border: 4px solid var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.42);
  pointer-events: none;
}

.camera-shade {
  display: none;
}

.camera-actions button {
  flex: 1 1 0;
}

@media (max-height: 680px) {
  .camera-stage {
    height: clamp(300px, 56dvh, 430px);
  }
}

.pix-panel {
  display: grid;
  gap: 4px;
}

.pix-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: center;
}

.pix-panel strong {
  overflow-wrap: anywhere;
}

.profile-card {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
}

.profile-photo img,
.profile-photo .placeholder {
  width: 130px;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: cover;
}

.profile-photo .placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  border-style: dashed;
}

.profile-data {
  display: grid;
  gap: 6px;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
}

.image-modal[hidden] {
  display: none;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 100%;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.82);
}

.image-modal-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: calc(100vh - 36px);
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.56);
}

.image-modal-panel img {
  width: 100%;
  max-height: calc(100vh - 150px);
  object-fit: contain;
  border-radius: 8px;
  background: #080808;
}

.image-modal-panel h3 {
  margin: 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.image-modal-close {
  justify-self: end;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.password-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.86);
}

.password-modal[hidden] {
  display: none;
}

.password-modal-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
}

.password-modal-panel h3,
.password-modal-panel p {
  margin: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 28px));
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #141414;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .app-header {
    align-items: flex-start;
    padding: 10px 12px;
  }

  .brand-line {
    gap: 8px;
  }

  .brand-line img {
    width: 122px;
    height: 44px;
  }

  .app-header .secondary-btn {
    min-height: 38px;
    padding: 8px 10px;
  }

  .app-tabs {
    top: 65px;
    display: flex;
    overflow-x: auto;
    scrollbar-width: thin;
    gap: 6px;
    padding: 8px 10px;
  }

  .tab-btn {
    flex: 0 0 auto;
    padding: 8px 6px;
    font-size: 0.86rem;
  }

  .section-head,
  .student-card header,
  .invoice-head,
  .profile-card,
  .contract-status-row,
  .legal-document-head,
  .biometric-status-row,
  .biometric-preview {
    grid-template-columns: 1fr;
    display: grid;
  }

  .grid-two,
  .payment-form,
  .agenda-summary,
  .anamnesis-grid,
  .checkbox-grid,
  .pix-copy-row,
  .workout-progress {
    grid-template-columns: 1fr;
  }

  .exercise-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .workout-session-card,
  .workout-session-card.compact {
    grid-template-columns: 1fr;
  }

  .exercise-check {
    grid-column: 2;
    justify-self: start;
  }

  .profile-photo img,
  .profile-photo .placeholder {
    width: 112px;
  }

  .image-modal {
    padding: 10px;
  }

  .image-modal-panel {
    max-height: calc(100vh - 20px);
  }
}