:root {
  --tinta: #191923;
  --papel: #ffffff;
  --mesa: #FBFEF9;
  --magenta: #BF1363;
  --magenta-suave: #FBE4EF;
  --laranja: #F39237;
  --laranja-suave: #FFF1E3;
  --azul: #0E79B2;
  --linha: #eadfe6;
  --ok: #0E79B2;
  --ok-fundo: #e8f4fb;
  --apagado: #6e6a72;
  --sombra: 0 18px 50px rgba(25, 25, 35, 0.08);
  --fonte: "Dosis", "Segoe UI", sans-serif;
  --titulo: "Quicksand", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 32%),
    var(--mesa);
  color: var(--tinta);
  font-family: var(--fonte);
  font-size: 17px;
  font-weight: 500;
}

button, input, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--azul);
  outline-offset: 2px;
}

.topo {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto minmax(180px, 1fr);
  gap: 12px 18px;
  align-items: center;
  padding: 16px 22px 14px;
  background: #fff;
  border-bottom: 3px solid var(--magenta);
}

.status {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--apagado);
  font-weight: 500;
}

.status.falha { color: var(--magenta); }

.topo h1 {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.35em;
  text-align: center;
  font-family: var(--titulo);
  font-size: 26px;
  font-weight: 600;
  color: var(--magenta);
  line-height: 1.2;
}

.topo h1 input {
  width: 10ch;
  border: none;
  border-bottom: 1px dashed transparent;
  background: transparent;
  text-align: center;
  font: inherit;
  color: inherit;
  padding: 0;
}

.topo h1 input:hover,
.topo h1 input:focus {
  border-bottom-color: var(--laranja);
  outline: none;
}

.acoes {
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.btn {
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.btn.primario {
  background: var(--magenta);
  color: white;
  border: none;
  font-family: var(--titulo);
  font-weight: 600;
}

.btn.primario:hover { background: #9d0f51; }

.btn.fantasma {
  background: transparent;
  border: 1px solid var(--magenta);
  color: var(--magenta);
  font-family: var(--titulo);
  font-weight: 600;
}

.btn.fantasma:hover { background: var(--magenta-suave); }

.btn.perigo {
  background: var(--tinta);
  color: white;
  border: none;
  font-family: var(--titulo);
  font-weight: 600;
}

.btn.perigo:hover { background: #000; }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.folha {
  width: calc(100% - 32px);
  margin: 22px auto 40px;
  background: var(--papel);
  border-radius: 18px;
  box-shadow: var(--sombra);
  overflow: hidden;
}

.contexto {
  display: grid;
  gap: 12px;
  padding: 18px 22px 8px;
}

.contexto label span,
.resumo p {
  font-size: 13px;
}

.contexto label {
  display: grid;
  gap: 4px;
}

.contexto label span {
  font-family: var(--titulo);
  font-weight: 600;
  color: var(--magenta);
  font-size: 16px;
}

.contexto textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 8px;
  resize: vertical;
  background: transparent;
  line-height: 1.45;
}

.contexto textarea:hover,
.contexto textarea:focus {
  border-color: #f0c6d8;
  background: white;
  outline: none;
}

.resumo {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
  align-items: center;
  padding: 4px 22px 16px;
}

.resumo p { margin: 0; color: #4c4852; font-weight: 400; }

.trilha {
  height: 8px;
  background: var(--magenta-suave);
  border-radius: 99px;
  overflow: hidden;
}

.trilha span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ok);
}

#calendario { overflow-x: auto; }

.grade { width: 100%; }

.dias-semana,
.semana {
  display: grid;
}

.dias-semana {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--magenta-suave);
  border-top: 1px solid var(--linha);
}

.dias-semana span,
.celula {
  border-right: 1px solid var(--linha);
  border-bottom: 1px solid var(--linha);
}

.dias-semana span:last-child,
.semana .celula:last-child { border-right: none; }

.dias-semana span {
  padding: 9px 8px;
  text-align: center;
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 15px;
  color: var(--magenta);
}

.celula {
  min-width: 0;
  background: white;
  vertical-align: top;
}

.celula.fora { background: #f7f4f6; }

.dia { padding: 0 10px 10px; }

.dia-topo,
.vazio .numero,
.vazio-fixo .numero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 0 -10px 8px;
  padding: 6px 10px;
  background: var(--laranja-suave);
  color: var(--tinta);
  font-weight: 600;
}

.vazio .numero,
.vazio-fixo .numero { margin: 0; }

.selo-hoje {
  font-size: 11px;
  font-family: var(--titulo);
  font-weight: 700;
  color: white;
  background: var(--laranja);
  border-radius: 999px;
  padding: 1px 6px;
}

.icon {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--magenta);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.icon:hover { background: rgba(255, 255, 255, 0.7); }

.turno + .turno {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--linha);
}

.turno-topo {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.nome-turno {
  width: 7.2em;
  border: none;
  background: transparent;
  font-weight: 700;
  padding: 2px 0;
}

.nome-turno:focus {
  background: white;
  outline: none;
  border-radius: 4px;
}

.link {
  border: none;
  background: transparent;
  color: var(--apagado);
  cursor: pointer;
  padding: 0;
  font-size: 12px;
}

.link:hover { color: var(--tinta); }

.quando { display: none; }

.acoes-exercicio { display: contents; }

.exercicio {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto auto;
  gap: 4px;
  align-items: start;
  margin: 3px 0;
  padding: 3px;
  border-radius: 8px;
}

.exercicio.feito {
  background: var(--ok-fundo);
}

.exercicio .marca {
  color: #6d6254;
  line-height: 1.7;
}

.exercicio textarea {
  width: 100%;
  min-height: 28px;
  resize: none;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  padding: 4px 4px 2px;
  line-height: 1.35;
}

.exercicio textarea:focus {
  border-color: var(--laranja);
  background: white;
  outline: none;
}

.corpo-exercicio {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.anexo {
  min-height: 32px;
  border-radius: 999px;
  border: 1.5px solid var(--magenta);
  background: white;
  color: var(--magenta);
  font-family: var(--titulo);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 10px;
}

.anexo:hover { background: var(--magenta-suave); }
.anexo:disabled { opacity: 0.6; cursor: wait; }

.midia {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
}

.midia img,
.midia video {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: 8px;
  background: white;
}

.nome-midia { margin: 0; font-size: 14px; }

.exercicio.feito textarea,
.exercicio.feito .descricao-fixa { color: #0b5f8c; }

body.perfil-usuario .exercicio {
  grid-template-columns: 12px minmax(0, 1fr) auto;
}

select:disabled {
  color: var(--tinta);
  background: #f4f7f8;
}

.ok {
  min-width: 44px;
  min-height: 32px;
  border-radius: 999px;
  border: 1.5px solid var(--azul);
  background: white;
  color: var(--azul);
  font-family: var(--titulo);
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.ok[aria-pressed="true"] {
  background: var(--ok);
  border-color: var(--ok);
  color: white;
}

.ok:hover { transform: translateY(-1px); }

.remover-exercicio {
  width: 28px;
  height: 32px;
  border: none;
  background: transparent;
  color: #b0a496;
  cursor: pointer;
  border-radius: 6px;
}

.remover-exercicio:hover {
  background: var(--magenta-suave);
  color: var(--magenta);
}

.adicionar {
  display: inline-flex;
  margin-top: 6px;
  border: none;
  background: transparent;
  color: var(--azul);
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}

.adicionar:hover { color: #0b5f8c; }

.vazio {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  min-height: 148px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.vazio .incluir {
  padding: 12px 10px;
  color: var(--apagado);
  font-weight: 650;
}

.vazio:hover { background: var(--laranja-suave); }
.vazio:hover .incluir { color: var(--laranja); }

.celula.hoje { box-shadow: inset 0 0 0 2px var(--laranja); }

dialog {
  width: min(420px, calc(100% - 24px));
  border: none;
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--sombra);
}

dialog::backdrop { background: rgba(25, 25, 35, 0.35); }

.senha-admin {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--linha);
}

dialog h2 {
  margin: 0 0 8px;
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 26px;
  color: var(--magenta);
}

dialog p { margin: 0 0 14px; color: #4c4852; font-weight: 400; }

dialog label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

dialog input[type="date"] {
  font-weight: 500;
  padding: 8px;
  border: 1px solid var(--linha);
  border-radius: 8px;
}

.dialogo-acoes {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

#aviso {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(8px);
  max-width: min(520px, calc(100% - 24px));
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--tinta);
  color: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#aviso.visivel {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.controles {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: end;
}

.controles label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
}

.controles select,
.controles input,
.campo input {
  font-weight: 500;
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid #e4d5de;
  border-radius: 8px;
  background: white;
}

#incluir { margin-left: auto; }

.quem {
  font-size: 13px;
  font-weight: 700;
  color: var(--magenta);
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.cartao-login {
  width: min(420px, 100%);
  background: var(--papel);
  border-radius: 18px;
  box-shadow: var(--sombra);
  padding: 28px 26px 24px;
}

.cartao-login h2 {
  margin: 18px 0 0;
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 32px;
  color: var(--magenta);
}

.olho {
  margin: 0;
  color: #8d6b32;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.apoio {
  margin: 6px 0 0;
  color: #4c4852;
  font-weight: 400;
}

.campo {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  font-weight: 700;
}

.campo select,
.campo input {
  width: 100%;
  box-sizing: border-box;
}

.campo select {
  font-weight: 500;
  padding: 8px 10px;
  border: 1px solid #e4d5de;
  border-radius: 8px;
  background: white;
}

.erro {
  min-height: 1.3em;
  margin: 12px 0 0;
  color: var(--magenta);
  font-weight: 600;
}

.btn.largo { width: 100%; margin-top: 8px; }

.voltar-site {
  display: block;
  margin-top: 14px;
  text-align: center;
  color: var(--magenta);
  font-weight: 700;
  text-decoration: none;
}

.voltar-site:hover { color: #9d0f51; }

body.sem-sessao #aplicacao { display: none; }
body:not(.sem-sessao) #login { display: none; }
body.perfil-usuario .somente-edicao { display: none; }
body:not(.perfil-mestre) .somente-mestre { display: none; }

#lista-usuarios {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
  margin-top: 16px;
}

#lista-usuarios:empty { display: none; }

.conta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e4d5de;
  border-radius: 8px;
}

.conta span { font-weight: 600; }

.conta .btn { padding: 6px 10px; }

.check-bloco { margin-top: 14px; }

.check-lista {
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
  margin-top: 8px;
}

.check-paciente {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 600;
}

.vazio-acesso {
  margin: 28px 8px;
}

.descricao-fixa {
  margin: 0;
  padding: 4px 4px 2px;
  line-height: 1.35;
}

.vazio-fixo {
  min-height: 72px;
}

textarea[readonly] {
  cursor: default;
}

#periodo { color: var(--laranja); }

.marca-topo {
  display: grid;
  justify-items: start;
  gap: 2px;
}

.logo-topo { width: 168px; height: auto; display: block; }

.marca-login {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.logo-login { width: min(340px, 100%); height: auto; display: block; }

.nome-marca {
  margin: 0;
  font-family: var(--titulo);
  font-weight: 700;
  font-size: 34px;
  letter-spacing: -0.03em;
  line-height: 1;
}

.marca-topo .nome-marca { font-size: 22px; }

.nome-marca .neuro { color: var(--laranja); }
.nome-marca .paiva { color: var(--magenta); }

.linha-clinica {
  margin: 2px 0 0;
  font-weight: 300;
  font-size: 18px;
  letter-spacing: 0.01em;
  color: var(--laranja);
}

.linha-clinica strong { font-weight: 600; }

.controles label {
  font-family: var(--titulo);
  font-weight: 600;
  color: var(--magenta);
}

@media (max-width: 800px) {
  .topo {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .status { order: 3; }
  .acoes { justify-self: center; }

  .resumo { grid-template-columns: 1fr; }

  #incluir { margin-left: 0; }

  #calendario { overflow-x: visible; }

  .dias-semana { display: none; }

  .semana { display: flex; flex-direction: column; }

  .celula.fora,
  .celula:not(:has(.dia)) { display: none; }

  .celula { border-right: none; }

  .dia { padding: 4px 12px 14px; }

  .dia-topo {
    margin: 0 -12px 10px;
    padding: 10px 12px;
  }

  .dia .numero { font-size: 0; }

  .quando {
    display: inline;
    font-size: 17px;
  }

  .exercicio,
  body.perfil-usuario .exercicio {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin: 8px 0;
    padding: 8px;
  }

  .exercicio .marca { display: none; }

  .corpo-exercicio { width: 100%; }

  .descricao-fixa,
  .exercicio textarea {
    font-size: 17px;
    line-height: 1.4;
  }

  .acoes-exercicio {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .nome-turno { width: min(100%, 12em); }
}
